Skip to content

Commit 0abb560

Browse files
committed
py: Remove unnecessary id_flags argument from emitter's load_fast.
Saves 24 bytes in bare-arm.
1 parent 2276eb8 commit 0abb560

6 files changed

Lines changed: 9 additions & 9 deletions

File tree

py/compile.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -981,7 +981,7 @@ STATIC void close_over_variables_etc(compiler_t *comp, scope_t *this_scope, int
981981
EMIT_ARG(load_closure, id->qst, id->local_num);
982982
#else
983983
// in Micro Python we load closures using LOAD_FAST
984-
EMIT_ARG(load_fast, id->qst, id->flags, id->local_num);
984+
EMIT_ARG(load_fast, id->qst, id->local_num);
985985
#endif
986986
nfree += 1;
987987
}
@@ -2487,7 +2487,7 @@ STATIC void compile_trailer_paren_helper(compiler_t *comp, mp_parse_node_t pn_ar
24872487
for (int i = 0; i < comp->scope_cur->id_info_len; i++) {
24882488
if (comp->scope_cur->id_info[i].flags & ID_FLAG_IS_PARAM) {
24892489
// first argument found; load it and call super
2490-
EMIT_ARG(load_fast, MP_QSTR_, comp->scope_cur->id_info[i].flags, comp->scope_cur->id_info[i].local_num);
2490+
EMIT_ARG(load_fast, MP_QSTR_, comp->scope_cur->id_info[i].local_num);
24912491
EMIT_ARG(call_function, 2, 0, 0);
24922492
return;
24932493
}
@@ -3384,7 +3384,7 @@ STATIC void compile_scope(compiler_t *comp, scope_t *scope, pass_kind_t pass) {
33843384
#if MICROPY_EMIT_CPYTHON
33853385
EMIT_ARG(load_closure, MP_QSTR___class__, 0); // XXX check this is the correct local num
33863386
#else
3387-
EMIT_ARG(load_fast, MP_QSTR___class__, id->flags, id->local_num);
3387+
EMIT_ARG(load_fast, MP_QSTR___class__, id->local_num);
33883388
#endif
33893389
}
33903390
EMIT(return_value);

py/emit.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ typedef struct _emit_method_table_t {
8282
void (*load_const_str)(emit_t *emit, qstr qst, bool bytes);
8383
void (*load_const_obj)(emit_t *emit, void *obj);
8484
void (*load_null)(emit_t *emit);
85-
void (*load_fast)(emit_t *emit, qstr qst, mp_uint_t id_flags, mp_uint_t local_num);
85+
void (*load_fast)(emit_t *emit, qstr qst, mp_uint_t local_num);
8686
void (*load_deref)(emit_t *emit, qstr qst, mp_uint_t local_num);
8787
void (*load_name)(emit_t *emit, qstr qst);
8888
void (*load_global)(emit_t *emit, qstr qst);

py/emitbc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,7 @@ STATIC void emit_bc_load_null(emit_t *emit) {
498498
emit_write_bytecode_byte(emit, MP_BC_LOAD_NULL);
499499
};
500500

501-
STATIC void emit_bc_load_fast(emit_t *emit, qstr qst, mp_uint_t id_flags, mp_uint_t local_num) {
501+
STATIC void emit_bc_load_fast(emit_t *emit, qstr qst, mp_uint_t local_num) {
502502
assert(local_num >= 0);
503503
emit_bc_pre(emit, 1);
504504
if (local_num <= 15) {

py/emitcommon.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ void emit_common_load_id(emit_t *emit, const emit_method_table_t *emit_method_ta
4444
} else if (id->kind == ID_INFO_KIND_GLOBAL_EXPLICIT) {
4545
EMIT(load_global, qst);
4646
} else if (id->kind == ID_INFO_KIND_LOCAL) {
47-
EMIT(load_fast, qst, id->flags, id->local_num);
47+
EMIT(load_fast, qst, id->local_num);
4848
} else if (id->kind == ID_INFO_KIND_CELL || id->kind == ID_INFO_KIND_FREE) {
4949
EMIT(load_deref, qst, id->local_num);
5050
} else {

py/emitcpy.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ STATIC void emit_cpy_load_null(emit_t *emit) {
245245
assert(0);
246246
}
247247

248-
STATIC void emit_cpy_load_fast(emit_t *emit, qstr qst, mp_uint_t id_flags, mp_uint_t local_num) {
248+
STATIC void emit_cpy_load_fast(emit_t *emit, qstr qst, mp_uint_t local_num) {
249249
emit_pre(emit, 1, 3);
250250
if (emit->pass == MP_PASS_EMIT) {
251251
printf("LOAD_FAST " UINT_FMT " %s\n", local_num, qstr_str(qst));

py/emitnative.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1184,8 +1184,8 @@ STATIC void emit_native_load_null(emit_t *emit) {
11841184
emit_post_push_imm(emit, VTYPE_PYOBJ, 0);
11851185
}
11861186

1187-
STATIC void emit_native_load_fast(emit_t *emit, qstr qst, mp_uint_t id_flags, mp_uint_t local_num) {
1188-
DEBUG_printf("load_fast(%s, " UINT_FMT ", " UINT_FMT ")\n", qstr_str(qst), id_flags, local_num);
1187+
STATIC void emit_native_load_fast(emit_t *emit, qstr qst, mp_uint_t local_num) {
1188+
DEBUG_printf("load_fast(%s, " UINT_FMT ")\n", qstr_str(qst), local_num);
11891189
vtype_kind_t vtype = emit->local_vtype[local_num];
11901190
if (vtype == VTYPE_UNBOUND) {
11911191
printf("ViperTypeError: local %s used before type known\n", qstr_str(qst));

0 commit comments

Comments
 (0)