@@ -175,13 +175,13 @@ static struct jump_target_label_ NO_LABEL = {-1};
175
175
#define IS_LABEL (L ) (!SAME_LABEL((L), (NO_LABEL)))
176
176
177
177
#define NEW_JUMP_TARGET_LABEL (C , NAME ) \
178
- jump_target_label NAME = instr_sequence_new_label(INSTR_STREAM (C)); \
178
+ jump_target_label NAME = instr_sequence_new_label(INSTR_SEQUENCE (C)); \
179
179
if (!IS_LABEL(NAME)) { \
180
180
return ERROR; \
181
181
}
182
182
183
183
#define USE_LABEL (C , LBL ) \
184
- RETURN_IF_ERROR(instr_sequence_use_label(INSTR_STREAM (C), (LBL).id))
184
+ RETURN_IF_ERROR(instr_sequence_use_label(INSTR_SEQUENCE (C), (LBL).id))
185
185
186
186
struct cfg_instr {
187
187
int i_opcode ;
@@ -428,20 +428,20 @@ typedef struct instr_sequence_ {
428
428
int s_next_free_label ; /* next free label id */
429
429
} instr_sequence ;
430
430
431
- #define INITIAL_INSTR_STREAM_SIZE 100
432
- #define INITIAL_INSTR_STREAM_LABELS_MAP_SIZE 10
431
+ #define INITIAL_INSTR_SEQUENCE_SIZE 100
432
+ #define INITIAL_INSTR_SEQUENCE_LABELS_MAP_SIZE 10
433
433
434
434
static int
435
435
instr_sequence_next_inst (instr_sequence * seq ) {
436
436
if (seq -> s_instrs == NULL ) {
437
437
assert (seq -> s_allocated == 0 );
438
438
assert (seq -> s_used == 0 );
439
439
seq -> s_instrs = (instruction * )PyObject_Calloc (
440
- INITIAL_INSTR_STREAM_SIZE , sizeof (instruction ));
440
+ INITIAL_INSTR_SEQUENCE_SIZE , sizeof (instruction ));
441
441
if (seq -> s_instrs == NULL ) {
442
442
return ERROR ;
443
443
}
444
- seq -> s_allocated = INITIAL_INSTR_STREAM_SIZE ;
444
+ seq -> s_allocated = INITIAL_INSTR_SEQUENCE_SIZE ;
445
445
}
446
446
if (seq -> s_used == seq -> s_allocated ) {
447
447
instruction * tmp = (instruction * )PyObject_Realloc (
@@ -470,7 +470,7 @@ instr_sequence_use_label(instr_sequence *seq, int lbl) {
470
470
int * tmp = NULL ;
471
471
if (seq -> s_labelmap == NULL ) {
472
472
old_size = 0 ;
473
- new_size = INITIAL_INSTR_STREAM_LABELS_MAP_SIZE ;
473
+ new_size = INITIAL_INSTR_SEQUENCE_LABELS_MAP_SIZE ;
474
474
if (new_size < 2 * lbl ) {
475
475
new_size = 2 * lbl ;
476
476
}
@@ -645,7 +645,7 @@ struct compiler {
645
645
PyArena * c_arena ; /* pointer to memory allocation arena */
646
646
};
647
647
648
- #define INSTR_STREAM (C ) (&((C)->u->u_instr_sequence))
648
+ #define INSTR_SEQUENCE (C ) (&((C)->u->u_instr_sequence))
649
649
650
650
651
651
typedef struct {
@@ -1513,7 +1513,7 @@ compiler_addop_load_const(struct compiler *c, location loc, PyObject *o)
1513
1513
if (arg < 0 ) {
1514
1514
return ERROR ;
1515
1515
}
1516
- return codegen_addop_i (INSTR_STREAM (c ), LOAD_CONST , arg , loc );
1516
+ return codegen_addop_i (INSTR_SEQUENCE (c ), LOAD_CONST , arg , loc );
1517
1517
}
1518
1518
1519
1519
static int
@@ -1524,7 +1524,7 @@ compiler_addop_o(struct compiler *c, location loc,
1524
1524
if (arg < 0 ) {
1525
1525
return ERROR ;
1526
1526
}
1527
- return codegen_addop_i (INSTR_STREAM (c ), opcode , arg , loc );
1527
+ return codegen_addop_i (INSTR_SEQUENCE (c ), opcode , arg , loc );
1528
1528
}
1529
1529
1530
1530
static int
@@ -1550,7 +1550,7 @@ compiler_addop_name(struct compiler *c, location loc,
1550
1550
arg <<= 1 ;
1551
1551
arg |= 1 ;
1552
1552
}
1553
- return codegen_addop_i (INSTR_STREAM (c ), opcode , arg , loc );
1553
+ return codegen_addop_i (INSTR_SEQUENCE (c ), opcode , arg , loc );
1554
1554
}
1555
1555
1556
1556
/* Add an opcode with an integer argument */
@@ -1579,10 +1579,10 @@ codegen_addop_j(instr_sequence *seq, location loc,
1579
1579
}
1580
1580
1581
1581
#define ADDOP (C , LOC , OP ) \
1582
- RETURN_IF_ERROR(codegen_addop_noarg(INSTR_STREAM (C), (OP), (LOC)))
1582
+ RETURN_IF_ERROR(codegen_addop_noarg(INSTR_SEQUENCE (C), (OP), (LOC)))
1583
1583
1584
1584
#define ADDOP_IN_SCOPE (C , LOC , OP ) { \
1585
- if (codegen_addop_noarg(INSTR_STREAM (C), (OP), (LOC)) < 0) { \
1585
+ if (codegen_addop_noarg(INSTR_SEQUENCE (C), (OP), (LOC)) < 0) { \
1586
1586
compiler_exit_scope(C); \
1587
1587
return ERROR; \
1588
1588
} \
@@ -1617,10 +1617,10 @@ codegen_addop_j(instr_sequence *seq, location loc,
1617
1617
RETURN_IF_ERROR(compiler_addop_name((C), (LOC), (OP), (C)->u->u_ ## TYPE, (O)))
1618
1618
1619
1619
#define ADDOP_I (C , LOC , OP , O ) \
1620
- RETURN_IF_ERROR(codegen_addop_i(INSTR_STREAM (C), (OP), (O), (LOC)))
1620
+ RETURN_IF_ERROR(codegen_addop_i(INSTR_SEQUENCE (C), (OP), (O), (LOC)))
1621
1621
1622
1622
#define ADDOP_JUMP (C , LOC , OP , O ) \
1623
- RETURN_IF_ERROR(codegen_addop_j(INSTR_STREAM (C), (LOC), (OP), (O)))
1623
+ RETURN_IF_ERROR(codegen_addop_j(INSTR_SEQUENCE (C), (LOC), (OP), (O)))
1624
1624
1625
1625
#define ADDOP_COMPARE (C , LOC , CMP ) \
1626
1626
RETURN_IF_ERROR(compiler_addcompare((C), (LOC), (cmpop_ty)(CMP)))
@@ -2545,7 +2545,7 @@ wrap_in_stopiteration_handler(struct compiler *c)
2545
2545
/* Insert SETUP_CLEANUP at start */
2546
2546
RETURN_IF_ERROR (
2547
2547
instr_sequence_insert_instruction (
2548
- INSTR_STREAM (c ), 0 ,
2548
+ INSTR_SEQUENCE (c ), 0 ,
2549
2549
SETUP_CLEANUP , handler .id , NO_LOCATION ));
2550
2550
2551
2551
ADDOP_LOAD_CONST (c , NO_LOCATION , Py_None );
@@ -4235,7 +4235,7 @@ compiler_nameop(struct compiler *c, location loc,
4235
4235
if (op == LOAD_GLOBAL ) {
4236
4236
arg <<= 1 ;
4237
4237
}
4238
- return codegen_addop_i (INSTR_STREAM (c ), op , arg , loc );
4238
+ return codegen_addop_i (INSTR_SEQUENCE (c ), op , arg , loc );
4239
4239
}
4240
4240
4241
4241
static int
@@ -6254,7 +6254,7 @@ emit_and_reset_fail_pop(struct compiler *c, location loc,
6254
6254
}
6255
6255
while (-- pc -> fail_pop_size ) {
6256
6256
USE_LABEL (c , pc -> fail_pop [pc -> fail_pop_size ]);
6257
- if (codegen_addop_noarg (INSTR_STREAM (c ), POP_TOP , loc ) < 0 ) {
6257
+ if (codegen_addop_noarg (INSTR_SEQUENCE (c ), POP_TOP , loc ) < 0 ) {
6258
6258
pc -> fail_pop_size = 0 ;
6259
6259
PyObject_Free (pc -> fail_pop );
6260
6260
pc -> fail_pop = NULL ;
@@ -6694,7 +6694,7 @@ compiler_pattern_or(struct compiler *c, pattern_ty p, pattern_context *pc)
6694
6694
pc -> fail_pop = NULL ;
6695
6695
pc -> fail_pop_size = 0 ;
6696
6696
pc -> on_top = 0 ;
6697
- if (codegen_addop_i (INSTR_STREAM (c ), COPY , 1 , LOC (alt )) < 0 ||
6697
+ if (codegen_addop_i (INSTR_SEQUENCE (c ), COPY , 1 , LOC (alt )) < 0 ||
6698
6698
compiler_pattern (c , alt , pc ) < 0 ) {
6699
6699
goto error ;
6700
6700
}
@@ -6757,7 +6757,7 @@ compiler_pattern_or(struct compiler *c, pattern_ty p, pattern_context *pc)
6757
6757
}
6758
6758
}
6759
6759
assert (control );
6760
- if (codegen_addop_j (INSTR_STREAM (c ), LOC (alt ), JUMP , end ) < 0 ||
6760
+ if (codegen_addop_j (INSTR_SEQUENCE (c ), LOC (alt ), JUMP , end ) < 0 ||
6761
6761
emit_and_reset_fail_pop (c , LOC (alt ), pc ) < 0 )
6762
6762
{
6763
6763
goto error ;
@@ -6769,7 +6769,7 @@ compiler_pattern_or(struct compiler *c, pattern_ty p, pattern_context *pc)
6769
6769
// Need to NULL this for the PyObject_Free call in the error block.
6770
6770
old_pc .fail_pop = NULL ;
6771
6771
// No match. Pop the remaining copy of the subject and fail:
6772
- if (codegen_addop_noarg (INSTR_STREAM (c ), POP_TOP , LOC (p )) < 0 ||
6772
+ if (codegen_addop_noarg (INSTR_SEQUENCE (c ), POP_TOP , LOC (p )) < 0 ||
6773
6773
jump_to_fail_pop (c , LOC (p ), pc , JUMP ) < 0 ) {
6774
6774
goto error ;
6775
6775
}
@@ -8719,7 +8719,7 @@ assemble(struct compiler *c, int addNone)
8719
8719
}
8720
8720
8721
8721
/** Preprocessing **/
8722
- if (instr_sequence_to_cfg (INSTR_STREAM (c ), g ) < 0 ) {
8722
+ if (instr_sequence_to_cfg (INSTR_SEQUENCE (c ), g ) < 0 ) {
8723
8723
goto error ;
8724
8724
}
8725
8725
assert (cfg_builder_check (g ));
@@ -9996,7 +9996,7 @@ _PyCompile_CodeGen(PyObject *ast, PyObject *filename, PyCompilerFlags *pflags,
9996
9996
}
9997
9997
9998
9998
cfg_builder g ;
9999
- if (instr_sequence_to_cfg (INSTR_STREAM (c ), & g ) < 0 ) {
9999
+ if (instr_sequence_to_cfg (INSTR_SEQUENCE (c ), & g ) < 0 ) {
10000
10000
goto finally ;
10001
10001
}
10002
10002
if (translate_jump_labels_to_targets (g .g_entryblock ) < 0 ) {
0 commit comments