Skip to content

Commit ed570e4

Browse files
committed
py: Remove mp_load_const_str and replace uses with inlined version.
1 parent 484adac commit ed570e4

File tree

6 files changed

+3
-12
lines changed

6 files changed

+3
-12
lines changed

py/emitnative.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,6 @@
167167
STATIC byte mp_f_n_args[MP_F_NUMBER_OF] = {
168168
[MP_F_CONVERT_OBJ_TO_NATIVE] = 2,
169169
[MP_F_CONVERT_NATIVE_TO_OBJ] = 2,
170-
[MP_F_LOAD_CONST_STR] = 1,
171170
[MP_F_LOAD_CONST_BYTES] = 1,
172171
[MP_F_LOAD_NAME] = 1,
173172
[MP_F_LOAD_GLOBAL] = 1,
@@ -1311,10 +1310,10 @@ STATIC void emit_native_load_const_str(emit_t *emit, qstr qst, bool bytes) {
13111310
{
13121311
if (bytes) {
13131312
emit_call_with_imm_arg(emit, MP_F_LOAD_CONST_BYTES, qst, REG_ARG_1);
1313+
emit_post_push_reg(emit, VTYPE_PYOBJ, REG_RET);
13141314
} else {
1315-
emit_call_with_imm_arg(emit, MP_F_LOAD_CONST_STR, qst, REG_ARG_1);
1315+
emit_post_push_imm(emit, VTYPE_PYOBJ, (mp_uint_t)MP_OBJ_NEW_QSTR(qst));
13161316
}
1317-
emit_post_push_reg(emit, VTYPE_PYOBJ, REG_RET);
13181317
}
13191318
}
13201319

py/nativeglue.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,6 @@ void mp_native_raise(mp_obj_t o) {
9292
void *const mp_fun_table[MP_F_NUMBER_OF] = {
9393
mp_convert_obj_to_native,
9494
mp_convert_native_to_obj,
95-
mp_load_const_str,
9695
mp_load_const_bytes,
9796
mp_load_name,
9897
mp_load_global,

py/runtime.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -104,11 +104,6 @@ void mp_deinit(void) {
104104
#endif
105105
}
106106

107-
mp_obj_t mp_load_const_str(qstr qst) {
108-
DEBUG_OP_printf("load '%s'\n", qstr_str(qst));
109-
return MP_OBJ_NEW_QSTR(qst);
110-
}
111-
112107
mp_obj_t mp_load_const_bytes(qstr qst) {
113108
DEBUG_OP_printf("load b'%s'\n", qstr_str(qst));
114109
mp_uint_t len;

py/runtime.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@ mp_obj_t mp_binary_op(mp_uint_t op, mp_obj_t lhs, mp_obj_t rhs);
9090

9191
mp_obj_t mp_load_const_int(qstr qst);
9292
mp_obj_t mp_load_const_dec(qstr qst);
93-
mp_obj_t mp_load_const_str(qstr qst);
9493
mp_obj_t mp_load_const_bytes(qstr qst);
9594

9695
mp_obj_t mp_call_function_0(mp_obj_t fun);

py/runtime0.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,6 @@ typedef enum {
109109
typedef enum {
110110
MP_F_CONVERT_OBJ_TO_NATIVE = 0,
111111
MP_F_CONVERT_NATIVE_TO_OBJ,
112-
MP_F_LOAD_CONST_STR,
113112
MP_F_LOAD_CONST_BYTES,
114113
MP_F_LOAD_NAME,
115114
MP_F_LOAD_GLOBAL,

py/vm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ run_code_state: ;
213213

214214
ENTRY(MP_BC_LOAD_CONST_STRING): {
215215
DECODE_QSTR;
216-
PUSH(mp_load_const_str(qst));
216+
PUSH(MP_OBJ_NEW_QSTR(qst));
217217
DISPATCH();
218218
}
219219

0 commit comments

Comments
 (0)