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.
pull/1230/head
Damien George 2015-05-05 22:15:42 +01:00
rodzic 37c6555b44
commit 8872abcbc4
5 zmienionych plików z 1 dodań i 11 usunięć

Wyświetl plik

@ -32,7 +32,6 @@
#define MP_BC_LOAD_CONST_FALSE (0x10)
#define MP_BC_LOAD_CONST_NONE (0x11)
#define MP_BC_LOAD_CONST_TRUE (0x12)
#define MP_BC_LOAD_CONST_ELLIPSIS (0x13)
#define MP_BC_LOAD_CONST_SMALL_INT (0x14) // signed var-int
#define MP_BC_LOAD_CONST_BYTES (0x15) // qstr
#define MP_BC_LOAD_CONST_STRING (0x16) // qstr

Wyświetl plik

@ -454,7 +454,7 @@ void mp_emit_bc_load_const_tok(emit_t *emit, mp_token_kind_t tok) {
case MP_TOKEN_KW_NONE: emit_write_bytecode_byte(emit, MP_BC_LOAD_CONST_NONE); break;
case MP_TOKEN_KW_TRUE: emit_write_bytecode_byte(emit, MP_BC_LOAD_CONST_TRUE); break;
no_other_choice:
case MP_TOKEN_ELLIPSIS: emit_write_bytecode_byte(emit, MP_BC_LOAD_CONST_ELLIPSIS); break;
case MP_TOKEN_ELLIPSIS: emit_write_bytecode_byte_ptr(emit, MP_BC_LOAD_CONST_OBJ, (void*)&mp_const_ellipsis_obj); break;
default: assert(0); goto no_other_choice; // to help flow control analysis
}
}

Wyświetl plik

@ -142,10 +142,6 @@ const byte *mp_bytecode_print_str(const byte *ip) {
printf("LOAD_CONST_TRUE");
break;
case MP_BC_LOAD_CONST_ELLIPSIS:
printf("LOAD_CONST_ELLIPSIS");
break;
case MP_BC_LOAD_CONST_SMALL_INT: {
mp_int_t num = 0;
if ((ip[0] & 0x40) != 0) {

Wyświetl plik

@ -192,10 +192,6 @@ dispatch_loop:
PUSH(mp_const_true);
DISPATCH();
ENTRY(MP_BC_LOAD_CONST_ELLIPSIS):
PUSH((mp_obj_t)&mp_const_ellipsis_obj);
DISPATCH();
ENTRY(MP_BC_LOAD_CONST_SMALL_INT): {
mp_int_t num = 0;
if ((ip[0] & 0x40) != 0) {

Wyświetl plik

@ -34,7 +34,6 @@ static void* entry_table[256] = {
[MP_BC_LOAD_CONST_FALSE] = &&entry_MP_BC_LOAD_CONST_FALSE,
[MP_BC_LOAD_CONST_NONE] = &&entry_MP_BC_LOAD_CONST_NONE,
[MP_BC_LOAD_CONST_TRUE] = &&entry_MP_BC_LOAD_CONST_TRUE,
[MP_BC_LOAD_CONST_ELLIPSIS] = &&entry_MP_BC_LOAD_CONST_ELLIPSIS,
[MP_BC_LOAD_CONST_SMALL_INT] = &&entry_MP_BC_LOAD_CONST_SMALL_INT,
[MP_BC_LOAD_CONST_BYTES] = &&entry_MP_BC_LOAD_CONST_BYTES,
[MP_BC_LOAD_CONST_STRING] = &&entry_MP_BC_LOAD_CONST_STRING,