@@ -159,7 +159,7 @@ struct location {
159
159
#define LOCATION (LNO , END_LNO , COL , END_COL ) \
160
160
((struct location){(LNO), (END_LNO), (COL), (END_COL)})
161
161
162
- #define NO_LOCATION (LOCATION(-1, -1, -1, -1))
162
+ static struct location NO_LOCATION = (LOCATION (-1 , -1 , -1 , -1 ));
163
163
164
164
struct instr {
165
165
int i_opcode ;
@@ -348,7 +348,6 @@ enum {
348
348
COMPILER_SCOPE_COMPREHENSION ,
349
349
};
350
350
351
-
352
351
/* The following items change on entry and exit of code blocks.
353
352
They must be saved and restored when returning to a block.
354
353
*/
@@ -1273,7 +1272,7 @@ compiler_use_new_implicit_block_if_needed(struct compiler *c)
1273
1272
1274
1273
static int
1275
1274
basicblock_addop (basicblock * b , int opcode , int oparg ,
1276
- basicblock * target , struct location loc )
1275
+ basicblock * target , const struct location * loc )
1277
1276
{
1278
1277
assert (IS_WITHIN_OPCODE_RANGE (opcode ));
1279
1278
assert (!IS_ASSEMBLER_OPCODE (opcode ));
@@ -1292,7 +1291,7 @@ basicblock_addop(basicblock *b, int opcode, int oparg,
1292
1291
i -> i_opcode = opcode ;
1293
1292
i -> i_oparg = oparg ;
1294
1293
i -> i_target = target ;
1295
- i -> i_loc = loc ;
1294
+ i -> i_loc = * loc ;
1296
1295
1297
1296
return 1 ;
1298
1297
}
@@ -1305,7 +1304,7 @@ compiler_addop(struct compiler *c, int opcode, bool line)
1305
1304
return -1 ;
1306
1305
}
1307
1306
1308
- struct location loc = line ? c -> u -> u_loc : NO_LOCATION ;
1307
+ const struct location * loc = line ? & c -> u -> u_loc : & NO_LOCATION ;
1309
1308
return basicblock_addop (c -> u -> u_curblock , opcode , 0 , NULL , loc );
1310
1309
}
1311
1310
@@ -1513,7 +1512,7 @@ compiler_addop_i(struct compiler *c, int opcode, Py_ssize_t oparg, bool line)
1513
1512
1514
1513
int oparg_ = Py_SAFE_DOWNCAST (oparg , Py_ssize_t , int );
1515
1514
1516
- struct location loc = line ? c -> u -> u_loc : NO_LOCATION ;
1515
+ const struct location * loc = line ? & c -> u -> u_loc : & NO_LOCATION ;
1517
1516
return basicblock_addop (c -> u -> u_curblock , opcode , oparg_ , NULL , loc );
1518
1517
}
1519
1518
@@ -1523,7 +1522,7 @@ compiler_addop_j(struct compiler *c, int opcode, basicblock *target, bool line)
1523
1522
if (compiler_use_new_implicit_block_if_needed (c ) < 0 ) {
1524
1523
return -1 ;
1525
1524
}
1526
- struct location loc = line ? c -> u -> u_loc : NO_LOCATION ;
1525
+ const struct location * loc = line ? & c -> u -> u_loc : & NO_LOCATION ;
1527
1526
assert (target != NULL );
1528
1527
assert (IS_JUMP_OPCODE (opcode ) || IS_BLOCK_PUSH_OPCODE (opcode ));
1529
1528
return basicblock_addop (c -> u -> u_curblock , opcode , 0 , target , loc );
@@ -7387,7 +7386,7 @@ push_cold_blocks_to_end(struct compiler *c, basicblock *entry, int code_flags) {
7387
7386
if (explicit_jump == NULL ) {
7388
7387
return -1 ;
7389
7388
}
7390
- basicblock_addop (explicit_jump , JUMP , 0 , b -> b_next , NO_LOCATION );
7389
+ basicblock_addop (explicit_jump , JUMP , 0 , b -> b_next , & NO_LOCATION );
7391
7390
7392
7391
explicit_jump -> b_cold = 1 ;
7393
7392
explicit_jump -> b_next = b -> b_next ;
0 commit comments