Skip to content

Commit 9d3297e

Browse files
committed
address review
1 parent bfa67f5 commit 9d3297e

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

Python/flowgraph.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1344,14 +1344,14 @@ add_const(PyObject *newconst, PyObject *consts, PyObject *const_cache)
13441344
}
13451345

13461346
/*
1347-
Walk basic block backwards starting from "start" trying to collect "size" number of
1348-
subsequent instructions that load constants into instruction array "instrs" ignoring NOP's in between.
1349-
Caller must make sure that length of "instrs" is sufficient to fit in at least "size" instructions.
1347+
Traverse the instructions of the basic block backwards from index "start", skipping over NOPs.
1348+
Try to collect "size" number of consecutive instructions that load constants into the array "instrs".
1349+
Caller must make sure that length of "instrs" is sufficient to fit in at least "size" instructions.
13501350
1351-
Returns boolean indicating whether succeeded to collect requested number of instructions.
1351+
Return boolean indicating whether "size" such instructions were found.
13521352
*/
13531353
static bool
1354-
get_subsequent_const_instrs(basicblock *bb, int start, cfg_instr **instrs, int size)
1354+
get_const_loading_instrs(basicblock *bb, int start, cfg_instr **instrs, int size)
13551355
{
13561356
assert(start < bb->b_iused);
13571357
assert(size >= 0);
@@ -1428,7 +1428,7 @@ fold_tuple_of_constants(basicblock *bb, int i, PyObject *consts, PyObject *const
14281428
}
14291429

14301430
cfg_instr *const_instrs[_PY_STACK_USE_GUIDELINE];
1431-
if (!get_subsequent_const_instrs(bb, i-1, const_instrs, seq_size)) {
1431+
if (!get_const_loading_instrs(bb, i-1, const_instrs, seq_size)) {
14321432
/* not a const sequence */
14331433
return SUCCESS;
14341434
}
@@ -1484,7 +1484,7 @@ optimize_lists_and_sets(basicblock *bb, int i, int nextop,
14841484
}
14851485

14861486
cfg_instr *const_instrs[_PY_STACK_USE_GUIDELINE];
1487-
if (!get_subsequent_const_instrs(bb, i-1, const_instrs, seq_size)) { /* not a const sequence */
1487+
if (!get_const_loading_instrs(bb, i-1, const_instrs, seq_size)) { /* not a const sequence */
14881488
if (contains_or_iter && instr->i_opcode == BUILD_LIST) {
14891489
/* iterate over a tuple instead of list */
14901490
INSTR_SET_OP1(instr, BUILD_TUPLE, instr->i_oparg);
@@ -1724,7 +1724,7 @@ fold_const_binop(basicblock *bb, int i, PyObject *consts, PyObject *const_cache)
17241724
assert(binop->i_opcode == BINARY_OP);
17251725

17261726
cfg_instr *operands_instrs[BINOP_OPERAND_COUNT];
1727-
if (!get_subsequent_const_instrs(bb, i-1, operands_instrs, BINOP_OPERAND_COUNT)) {
1727+
if (!get_const_loading_instrs(bb, i-1, operands_instrs, BINOP_OPERAND_COUNT)) {
17281728
/* not a const sequence */
17291729
return SUCCESS;
17301730
}
@@ -1806,7 +1806,7 @@ fold_const_unaryop(basicblock *bb, int i, PyObject *consts, PyObject *const_cach
18061806
cfg_instr *unaryop = &bb->b_instr[i];
18071807

18081808
cfg_instr *operand_instr;
1809-
if (!get_subsequent_const_instrs(bb, i-1, &operand_instr, UNARYOP_OPERAND_COUNT)) {
1809+
if (!get_const_loading_instrs(bb, i-1, &operand_instr, UNARYOP_OPERAND_COUNT)) {
18101810
/* not a const */
18111811
return SUCCESS;
18121812
}

0 commit comments

Comments
 (0)