Skip to content

Commit 50b9329

Browse files
committed
py/runtime0.h: Move MP_BINARY_OP_DIVMOD to the end of mp_binary_op_t.
It starts a dichotomy of mp_binary_op_t values which can't appear in the bytecode. Another reason to move it is to VALUES of OP_* and OP_INPLACE_* nicely adjacent. This also will be needed for OP_REVERSE_*, to be soon introduced.
1 parent d4d1c45 commit 50b9329

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

py/runtime0.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ typedef enum {
8484

8585
MP_BINARY_OP_MODULO,
8686
MP_BINARY_OP_POWER,
87-
MP_BINARY_OP_DIVMOD, // not emitted by the compiler but supported by the runtime
8887
MP_BINARY_OP_INPLACE_OR,
8988
MP_BINARY_OP_INPLACE_XOR,
9089

@@ -99,6 +98,11 @@ typedef enum {
9998
MP_BINARY_OP_INPLACE_TRUE_DIVIDE,
10099
MP_BINARY_OP_INPLACE_MODULO,
101100
MP_BINARY_OP_INPLACE_POWER,
101+
102+
// Operations below this line don't appear in bytecode, they
103+
// just identify special methods.
104+
105+
MP_BINARY_OP_DIVMOD, // not emitted by the compiler but supported by the runtime
102106
} mp_binary_op_t;
103107

104108
typedef enum {

tests/cmdline/cmd_showbc.py.exp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ Raw bytecode (code_info_size=\\d\+, bytecode_size=\\d\+):
132132
\\d\+ DUP_TOP_TWO
133133
\\d\+ LOAD_SUBSCR
134134
\\d\+ LOAD_FAST 12
135-
\\d\+ BINARY_OP 29 __iadd__
135+
\\d\+ BINARY_OP 28 __iadd__
136136
\\d\+ ROT_THREE
137137
\\d\+ STORE_SUBSCR
138138
\\d\+ LOAD_DEREF 14

0 commit comments

Comments
 (0)