diff options
| author | Damien George <damien@micropython.org> | 2022-03-21 16:36:13 +1100 |
|---|---|---|
| committer | Damien George <damien@micropython.org> | 2022-03-28 15:43:09 +1100 |
| commit | 6d11c69983f8084459e5bb037d931d5e2d283c78 (patch) | |
| tree | 326ba09cf5a38fba7c384e764e76bece924a2413 /py/emitbc.c | |
| parent | acd2c5c8349a4cd713b1b36c0e6ec6f39791ca19 (diff) | |
py: Change jump-if-x-or-pop opcodes to have unsigned offset argument.
These jumps are always forwards, and it's more efficient in the VM to
decode an unsigned argument. These opcodes are already optimised versions
of the sequence "dup-top pop-jump-if-x pop" so it doesn't hurt generality
to optimise them further.
Signed-off-by: Damien George <damien@micropython.org>
Diffstat (limited to 'py/emitbc.c')
| -rw-r--r-- | py/emitbc.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/py/emitbc.c b/py/emitbc.c index 90ab6c0a9..1f5cd9d32 100644 --- a/py/emitbc.c +++ b/py/emitbc.c @@ -224,7 +224,7 @@ STATIC void emit_write_bytecode_byte_label(emit_t *emit, int stack_adj, byte b1, mp_emit_bc_adjust_stack_size(emit, stack_adj); // Determine if the jump offset is signed or unsigned, based on the opcode. - const bool is_signed = b1 <= MP_BC_JUMP_IF_FALSE_OR_POP; + const bool is_signed = b1 <= MP_BC_POP_JUMP_IF_FALSE; // Default to a 2-byte encoding (the largest) with an unknown jump offset. unsigned int jump_encoding_size = 1; |
