Skip to content

Commit 60665c9

Browse files
committed
Remove parameter to calculate stackdepth
1 parent 03c474e commit 60665c9

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

Python/flowgraph.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2740,17 +2740,12 @@ load_fast_push_block(basicblock ***sp, basicblock *target,
27402740
* non-violating LOAD_FAST{_LOAD_FAST} can be optimized.
27412741
*/
27422742
static int
2743-
optimize_load_fast(cfg_builder *g, bool compute_stackdepth)
2743+
optimize_load_fast(cfg_builder *g)
27442744
{
27452745
int status;
27462746
ref_stack refs = {0};
27472747
int max_instrs = 0;
27482748
basicblock *entryblock = g->g_entryblock;
2749-
if (compute_stackdepth) {
2750-
if (calculate_stackdepth(g) == ERROR) {
2751-
return ERROR;
2752-
}
2753-
}
27542749
for (basicblock *b = entryblock; b != NULL; b = b->b_next) {
27552750
max_instrs = Py_MAX(max_instrs, b->b_iused);
27562751
}
@@ -3885,7 +3880,7 @@ _PyCfg_OptimizedCfgToInstructionSequence(cfg_builder *g,
38853880
/* Can't modify the bytecode after inserting instructions that produce
38863881
* borrowed references.
38873882
*/
3888-
RETURN_IF_ERROR(optimize_load_fast(g, /* compute_stackdepth */ false));
3883+
RETURN_IF_ERROR(optimize_load_fast(g));
38893884

38903885
/* Can't modify the bytecode after computing jump offsets. */
38913886
if (_PyCfg_ToInstructionSequence(g, seq) < 0) {
@@ -3991,7 +3986,12 @@ _PyCompile_OptimizeLoadFast(PyObject *seq)
39913986
return NULL;
39923987
}
39933988

3994-
if (optimize_load_fast(g, /* compute_stackdepth */ true) != SUCCESS) {
3989+
if (calculate_stackdepth(g) == ERROR) {
3990+
_PyCfgBuilder_Free(g);
3991+
return NULL;
3992+
}
3993+
3994+
if (optimize_load_fast(g) != SUCCESS) {
39953995
_PyCfgBuilder_Free(g);
39963996
return NULL;
39973997
}

0 commit comments

Comments
 (0)