From 0abb5609b01c1b59d229bde8a0b3fc1df6dce060 Mon Sep 17 00:00:00 2001 From: Damien George Date: Fri, 16 Jan 2015 12:24:49 +0000 Subject: [PATCH] py: Remove unnecessary id_flags argument from emitter's load_fast. Saves 24 bytes in bare-arm. --- py/compile.c | 6 +++--- py/emit.h | 2 +- py/emitbc.c | 2 +- py/emitcommon.c | 2 +- py/emitcpy.c | 2 +- py/emitnative.c | 4 ++-- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/py/compile.c b/py/compile.c index f554854252..7d94412652 100644 --- a/py/compile.c +++ b/py/compile.c @@ -981,7 +981,7 @@ STATIC void close_over_variables_etc(compiler_t *comp, scope_t *this_scope, int EMIT_ARG(load_closure, id->qst, id->local_num); #else // in Micro Python we load closures using LOAD_FAST - EMIT_ARG(load_fast, id->qst, id->flags, id->local_num); + EMIT_ARG(load_fast, id->qst, id->local_num); #endif nfree += 1; } @@ -2487,7 +2487,7 @@ STATIC void compile_trailer_paren_helper(compiler_t *comp, mp_parse_node_t pn_ar for (int i = 0; i < comp->scope_cur->id_info_len; i++) { if (comp->scope_cur->id_info[i].flags & ID_FLAG_IS_PARAM) { // first argument found; load it and call super - EMIT_ARG(load_fast, MP_QSTR_, comp->scope_cur->id_info[i].flags, comp->scope_cur->id_info[i].local_num); + EMIT_ARG(load_fast, MP_QSTR_, comp->scope_cur->id_info[i].local_num); EMIT_ARG(call_function, 2, 0, 0); return; } @@ -3384,7 +3384,7 @@ STATIC void compile_scope(compiler_t *comp, scope_t *scope, pass_kind_t pass) { #if MICROPY_EMIT_CPYTHON EMIT_ARG(load_closure, MP_QSTR___class__, 0); // XXX check this is the correct local num #else - EMIT_ARG(load_fast, MP_QSTR___class__, id->flags, id->local_num); + EMIT_ARG(load_fast, MP_QSTR___class__, id->local_num); #endif } EMIT(return_value); diff --git a/py/emit.h b/py/emit.h index 06a4201e7f..2ca3d0420d 100644 --- a/py/emit.h +++ b/py/emit.h @@ -82,7 +82,7 @@ typedef struct _emit_method_table_t { void (*load_const_str)(emit_t *emit, qstr qst, bool bytes); void (*load_const_obj)(emit_t *emit, void *obj); void (*load_null)(emit_t *emit); - void (*load_fast)(emit_t *emit, qstr qst, mp_uint_t id_flags, mp_uint_t local_num); + void (*load_fast)(emit_t *emit, qstr qst, mp_uint_t local_num); void (*load_deref)(emit_t *emit, qstr qst, mp_uint_t local_num); void (*load_name)(emit_t *emit, qstr qst); void (*load_global)(emit_t *emit, qstr qst); diff --git a/py/emitbc.c b/py/emitbc.c index 436fdf1430..6be8f46229 100644 --- a/py/emitbc.c +++ b/py/emitbc.c @@ -498,7 +498,7 @@ STATIC void emit_bc_load_null(emit_t *emit) { emit_write_bytecode_byte(emit, MP_BC_LOAD_NULL); }; -STATIC void emit_bc_load_fast(emit_t *emit, qstr qst, mp_uint_t id_flags, mp_uint_t local_num) { +STATIC void emit_bc_load_fast(emit_t *emit, qstr qst, mp_uint_t local_num) { assert(local_num >= 0); emit_bc_pre(emit, 1); if (local_num <= 15) { diff --git a/py/emitcommon.c b/py/emitcommon.c index 4d909839ad..8011c0fb0b 100644 --- a/py/emitcommon.c +++ b/py/emitcommon.c @@ -44,7 +44,7 @@ void emit_common_load_id(emit_t *emit, const emit_method_table_t *emit_method_ta } else if (id->kind == ID_INFO_KIND_GLOBAL_EXPLICIT) { EMIT(load_global, qst); } else if (id->kind == ID_INFO_KIND_LOCAL) { - EMIT(load_fast, qst, id->flags, id->local_num); + EMIT(load_fast, qst, id->local_num); } else if (id->kind == ID_INFO_KIND_CELL || id->kind == ID_INFO_KIND_FREE) { EMIT(load_deref, qst, id->local_num); } else { diff --git a/py/emitcpy.c b/py/emitcpy.c index c54345c907..924a5566d9 100644 --- a/py/emitcpy.c +++ b/py/emitcpy.c @@ -245,7 +245,7 @@ STATIC void emit_cpy_load_null(emit_t *emit) { assert(0); } -STATIC void emit_cpy_load_fast(emit_t *emit, qstr qst, mp_uint_t id_flags, mp_uint_t local_num) { +STATIC void emit_cpy_load_fast(emit_t *emit, qstr qst, mp_uint_t local_num) { emit_pre(emit, 1, 3); if (emit->pass == MP_PASS_EMIT) { printf("LOAD_FAST " UINT_FMT " %s\n", local_num, qstr_str(qst)); diff --git a/py/emitnative.c b/py/emitnative.c index c7cbbf4516..a8e547f0d3 100644 --- a/py/emitnative.c +++ b/py/emitnative.c @@ -1184,8 +1184,8 @@ STATIC void emit_native_load_null(emit_t *emit) { emit_post_push_imm(emit, VTYPE_PYOBJ, 0); } -STATIC void emit_native_load_fast(emit_t *emit, qstr qst, mp_uint_t id_flags, mp_uint_t local_num) { - DEBUG_printf("load_fast(%s, " UINT_FMT ", " UINT_FMT ")\n", qstr_str(qst), id_flags, local_num); +STATIC void emit_native_load_fast(emit_t *emit, qstr qst, mp_uint_t local_num) { + DEBUG_printf("load_fast(%s, " UINT_FMT ")\n", qstr_str(qst), local_num); vtype_kind_t vtype = emit->local_vtype[local_num]; if (vtype == VTYPE_UNBOUND) { printf("ViperTypeError: local %s used before type known\n", qstr_str(qst));