Skip to content

Commit 7e284d1

Browse files
committed
rename fields of cfg_builder to all have g_ prefixes
1 parent 03c34be commit 7e284d1

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

Python/compile.c

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -350,12 +350,12 @@ enum {
350350
typedef struct cfg_builder_ {
351351
/* The entryblock, at which control flow begins. All blocks of the
352352
CFG are reachable through the b_next links */
353-
basicblock *cfg_entryblock;
353+
basicblock *g_entryblock;
354354
/* Pointer to the most recently allocated block. By following
355355
b_list links, you can reach all allocated blocks. */
356-
basicblock *block_list;
356+
basicblock *g_block_list;
357357
/* pointer to the block currently being constructed */
358-
basicblock *curblock;
358+
basicblock *g_curblock;
359359
/* label for the next instruction to be placed */
360360
jump_target_label g_current_label;
361361
/* next free label id */
@@ -751,7 +751,7 @@ dictbytype(PyObject *src, int scope_type, int flag, Py_ssize_t offset)
751751
static void
752752
cfg_builder_check(cfg_builder *g)
753753
{
754-
for (basicblock *block = g->block_list; block != NULL; block = block->b_list) {
754+
for (basicblock *block = g->g_block_list; block != NULL; block = block->b_list) {
755755
assert(!_PyMem_IsPtrFreed(block));
756756
if (block->b_instr != NULL) {
757757
assert(block->b_ialloc > 0);
@@ -769,7 +769,7 @@ static void
769769
cfg_builder_free(cfg_builder* g)
770770
{
771771
cfg_builder_check(g);
772-
basicblock *b = g->block_list;
772+
basicblock *b = g->g_block_list;
773773
while (b != NULL) {
774774
if (b->b_instr) {
775775
PyObject_Free((void *)b->b_instr);
@@ -884,8 +884,8 @@ cfg_builder_new_block(cfg_builder *g)
884884
return NULL;
885885
}
886886
/* Extend the singly linked list of blocks with new block. */
887-
b->b_list = g->block_list;
888-
g->block_list = b;
887+
b->b_list = g->g_block_list;
888+
g->g_block_list = b;
889889
b->b_label = -1;
890890
return b;
891891
}
@@ -894,8 +894,8 @@ static basicblock *
894894
cfg_builder_use_next_block(cfg_builder *g, basicblock *block)
895895
{
896896
assert(block != NULL);
897-
g->curblock->b_next = block;
898-
g->curblock = block;
897+
g->g_curblock->b_next = block;
898+
g->g_curblock = block;
899899
return block;
900900
}
901901

@@ -1313,7 +1313,7 @@ cfg_builder_current_block_is_terminated(cfg_builder *g)
13131313
if (IS_LABEL(g->g_current_label)) {
13141314
return true;
13151315
}
1316-
struct instr *last = basicblock_last_instr(g->curblock);
1316+
struct instr *last = basicblock_last_instr(g->g_curblock);
13171317
return last && IS_TERMINATOR_OPCODE(last->i_opcode);
13181318
}
13191319

@@ -1339,7 +1339,7 @@ cfg_builder_addop(cfg_builder *g, int opcode, int oparg, jump_target_label targe
13391339
if (cfg_builder_maybe_start_new_block(g) != 0) {
13401340
return -1;
13411341
}
1342-
return basicblock_addop(g->curblock, opcode, oparg, target, loc);
1342+
return basicblock_addop(g->g_curblock, opcode, oparg, target, loc);
13431343
}
13441344

13451345
static int
@@ -1788,11 +1788,11 @@ compiler_enter_scope(struct compiler *c, identifier name,
17881788
c->c_nestlevel++;
17891789

17901790
cfg_builder *g = CFG_BUILDER(c);
1791-
g->block_list = NULL;
1791+
g->g_block_list = NULL;
17921792
block = cfg_builder_new_block(g);
17931793
if (block == NULL)
17941794
return 0;
1795-
g->curblock = g->cfg_entryblock = block;
1795+
g->g_curblock = g->g_entryblock = block;
17961796
g->g_current_label = NO_LABEL;
17971797

17981798
if (u->u_scope_type == COMPILER_SCOPE_MODULE) {
@@ -7386,7 +7386,7 @@ mark_cold(basicblock *entryblock) {
73867386

73877387
static int
73887388
push_cold_blocks_to_end(cfg_builder *g, int code_flags) {
7389-
basicblock *entryblock = g->cfg_entryblock;
7389+
basicblock *entryblock = g->g_entryblock;
73907390
if (entryblock->b_next == NULL) {
73917391
/* single basicblock, no need to reorder */
73927392
return 0;
@@ -8516,7 +8516,7 @@ assemble(struct compiler *c, int addNone)
85168516
}
85178517

85188518
/* Make sure every block that falls off the end returns None. */
8519-
if (!basicblock_returns(CFG_BUILDER(c)->curblock)) {
8519+
if (!basicblock_returns(CFG_BUILDER(c)->g_curblock)) {
85208520
UNSET_LOC(c);
85218521
if (addNone)
85228522
ADDOP_LOAD_CONST(c, Py_None);
@@ -8538,7 +8538,7 @@ assemble(struct compiler *c, int addNone)
85388538
}
85398539

85408540
int nblocks = 0;
8541-
for (basicblock *b = CFG_BUILDER(c)->block_list; b != NULL; b = b->b_list) {
8541+
for (basicblock *b = CFG_BUILDER(c)->g_block_list; b != NULL; b = b->b_list) {
85428542
nblocks++;
85438543
}
85448544
if ((size_t)nblocks > SIZE_MAX / sizeof(basicblock *)) {
@@ -8547,7 +8547,7 @@ assemble(struct compiler *c, int addNone)
85478547
}
85488548

85498549
cfg_builder *g = CFG_BUILDER(c);
8550-
basicblock *entryblock = g->cfg_entryblock;
8550+
basicblock *entryblock = g->g_entryblock;
85518551
assert(entryblock != NULL);
85528552

85538553
/* Set firstlineno if it wasn't explicitly set. */
@@ -9569,7 +9569,7 @@ duplicate_exits_without_lineno(cfg_builder *g)
95699569
{
95709570
/* Copy all exit blocks without line number that are targets of a jump.
95719571
*/
9572-
basicblock *entryblock = g->cfg_entryblock;
9572+
basicblock *entryblock = g->g_entryblock;
95739573
for (basicblock *b = entryblock; b != NULL; b = b->b_next) {
95749574
if (b->b_iused > 0 && is_jump(&b->b_instr[b->b_iused-1])) {
95759575
basicblock *target = b->b_instr[b->b_iused-1].i_target;

0 commit comments

Comments
 (0)