@@ -9691,8 +9691,12 @@ cfg_to_instructions(cfg_builder *g)
9691
9691
if (instructions == NULL ) {
9692
9692
return NULL ;
9693
9693
}
9694
+ int lbl = 1 ;
9694
9695
for (basicblock * b = g -> g_entryblock ; b != NULL ; b = b -> b_next ) {
9695
- PyObject * lbl = PyLong_FromUnsignedLongLong ((uintptr_t )b );
9696
+ b -> b_label = lbl ++ ;
9697
+ }
9698
+ for (basicblock * b = g -> g_entryblock ; b != NULL ; b = b -> b_next ) {
9699
+ PyObject * lbl = PyLong_FromLong (b -> b_label );
9696
9700
if (lbl == NULL ) {
9697
9701
goto error ;
9698
9702
}
@@ -9704,14 +9708,9 @@ cfg_to_instructions(cfg_builder *g)
9704
9708
for (int i = 0 ; i < b -> b_iused ; i ++ ) {
9705
9709
struct instr * instr = & b -> b_instr [i ];
9706
9710
struct location loc = instr -> i_loc ;
9707
- uintptr_t arg = instr -> i_oparg ;
9708
- if (HAS_TARGET (instr -> i_opcode )) {
9709
- /* Use the address of the block as its unique ID (for the label) */
9710
- arg = (uintptr_t )instr -> i_target ;
9711
- }
9712
-
9711
+ int arg = HAS_TARGET (instr -> i_opcode ) ? instr -> i_target -> b_label : instr -> i_oparg ;
9713
9712
PyObject * inst_tuple = Py_BuildValue (
9714
- "(iLiiii )" , instr -> i_opcode , arg ,
9713
+ "(iiiiii )" , instr -> i_opcode , arg ,
9715
9714
loc .lineno , loc .end_lineno ,
9716
9715
loc .col_offset , loc .end_col_offset );
9717
9716
if (inst_tuple == NULL ) {
0 commit comments