8000 move a few things around · python/cpython@103c9ae · GitHub
[go: up one dir, main page]

Skip to content

Commit 103c9ae

Browse files
committed
move a few things around
1 parent 9827030 commit 103c9ae

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

Python/compile.c

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8628,10 +8628,7 @@ assemble(struct compiler *c, int addNone)
86288628
}
86298629
nlocalsplus -= numdropped;
86308630

8631-
consts = consts_dict_keys_inorder(c->u->u_consts);
8632-
if (consts == NULL) {
8633-
goto error;
8634-
}
8631+
/** Desugaring **/
86358632
if (calculate_jump_targets(g->g_entryblock)) {
86368633
goto error;
86378634
}
@@ -8641,6 +8638,12 @@ assemble(struct compiler *c, int addNone)
86418638
if (label_exception_targets(g->g_entryblock)) {
86428639
goto error;
86438640
}
8641+
8642+
/** Optimization **/
8643+
consts = consts_dict_keys_inorder(c->u->u_consts);
8644+
if (consts == NULL) {
8645+
goto error;
8646+
}
86448647
if (optimize_cfg(g, consts, c->c_const_cache)) {
86458648
goto error;
86468649
}
@@ -8665,6 +8668,7 @@ assemble(struct compiler *c, int addNone)
86658668
remove_redundant_nops(b);
86668669
}
86678670

8671+
/** Assembly **/
86688672
/* Order of basic blocks must have been determined by now */
86698673
if (normalize_jumps(g) < 0) {
86708674
goto error;
@@ -9599,12 +9603,14 @@ is_exit_without_lineno(basicblock *b) {
95999603
static int
96009604
duplicate_exits_without_lineno(cfg_builder *g)
96019605
{
9606+
assert(no_empty_basic_blocks(g));
96029607
/* Copy all exit blocks without line number that are targets of a jump.
96039608
*/
96049609
basicblock *entryblock = g->g_entryblock;
96059610
for (basicblock *b = entryblock; b != NULL; b = b->b_next) {
96069611
struct instr *last = basicblock_last_instr(b);
9607-
if (last != NULL && is_jump(last)) {
9612+
assert(last != NULL);
9613+
if (is_jump(last)) {
96089614
basicblock *target = last->i_target;
96099615
if (is_exit_without_lineno(target) && target->b_predecessors > 1) {
96109616
basicblock *new_target = copy_basicblock(g, target);
@@ -9621,8 +9627,6 @@ duplicate_exits_without_lineno(cfg_builder *g)
96219627
}
96229628
}
96239629

9624-
assert(no_empty_basic_blocks(g));
9625-
96269630
/* Any remaining reachable exit blocks without line number can only be reached by
96279631
* fall through, and thus can only have a single predecessor */
96289632
for (basicblock *b = entryblock; b != NULL; b = b->b_next) {

0 commit comments

Comments
 (0)
0