Skip to content

Commit 8872abc

Browse files
committed
py: Remove LOAD_CONST_ELLIPSIS bytecode, use LOAD_CONST_OBJ instead.
Ellipsis constant is rarely used so no point having an extra bytecode for it.
1 parent 37c6555 commit 8872abc

File tree

5 files changed

+1
-11
lines changed

5 files changed

+1
-11
lines changed

py/bc0.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
#define MP_BC_LOAD_CONST_FALSE (0x10)
3333
#define MP_BC_LOAD_CONST_NONE (0x11)
3434
#define MP_BC_LOAD_CONST_TRUE (0x12)
35-
#define MP_BC_LOAD_CONST_ELLIPSIS (0x13)
3635
#define MP_BC_LOAD_CONST_SMALL_INT (0x14) // signed var-int
3736
#define MP_BC_LOAD_CONST_BYTES (0x15) // qstr
3837
#define MP_BC_LOAD_CONST_STRING (0x16) // qstr

py/emitbc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,7 @@ void mp_emit_bc_load_const_tok(emit_t *emit, mp_token_kind_t tok) {
454454
case MP_TOKEN_KW_NONE: emit_write_bytecode_byte(emit, MP_BC_LOAD_CONST_NONE); break;
455455
case MP_TOKEN_KW_TRUE: emit_write_bytecode_byte(emit, MP_BC_LOAD_CONST_TRUE); break;
456456
no_other_choice:
457-
case MP_TOKEN_ELLIPSIS: emit_write_bytecode_byte(emit, MP_BC_LOAD_CONST_ELLIPSIS); break;
457+
case MP_TOKEN_ELLIPSIS: emit_write_bytecode_byte_ptr(emit, MP_BC_LOAD_CONST_OBJ, (void*)&mp_const_ellipsis_obj); break;
458458
default: assert(0); goto no_other_choice; // to help flow control analysis
459459
}
460460
}

py/showbc.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,10 +142,6 @@ const byte *mp_bytecode_print_str(const byte *ip) {
142142
printf("LOAD_CONST_TRUE");
143143
break;
144144

145-
case MP_BC_LOAD_CONST_ELLIPSIS:
146-
printf("LOAD_CONST_ELLIPSIS");
147-
break;
148-
149145
case MP_BC_LOAD_CONST_SMALL_INT: {
150146
mp_int_t num = 0;
151147
if ((ip[0] & 0x40) != 0) {

py/vm.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -192,10 +192,6 @@ run_code_state: ;
192192
PUSH(mp_const_true);
193193
DISPATCH();
194194

195-
ENTRY(MP_BC_LOAD_CONST_ELLIPSIS):
196-
PUSH((mp_obj_t)&mp_const_ellipsis_obj);
197-
DISPATCH();
198-
199195
ENTRY(MP_BC_LOAD_CONST_SMALL_INT): {
200196
mp_int_t num = 0;
201197
if ((ip[0] & 0x40) != 0) {

py/vmentrytable.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ static void* entry_table[256] = {
3434
[MP_BC_LOAD_CONST_FALSE] = &&entry_MP_BC_LOAD_CONST_FALSE,
3535
[MP_BC_LOAD_CONST_NONE] = &&entry_MP_BC_LOAD_CONST_NONE,
3636
[MP_BC_LOAD_CONST_TRUE] = &&entry_MP_BC_LOAD_CONST_TRUE,
37-
[MP_BC_LOAD_CONST_ELLIPSIS] = &&entry_MP_BC_LOAD_CONST_ELLIPSIS,
3837
[MP_BC_LOAD_CONST_SMALL_INT] = &&entry_MP_BC_LOAD_CONST_SMALL_INT,
3938
[MP_BC_LOAD_CONST_BYTES] = &&entry_MP_BC_LOAD_CONST_BYTES,
4039
[MP_BC_LOAD_CONST_STRING] = &&entry_MP_BC_LOAD_CONST_STRING,

0 commit comments

Comments
 (0)