summaryrefslogtreecommitdiffstatshomepage
path: root/py
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2015-06-25 13:58:41 +0000
committerDamien George <damien.p.george@gmail.com>2015-06-25 13:58:41 +0000
commited570e4b2a0a68e43b191fb0d5b45fb2ec83aca4 (patch)
tree63e95d7626abfaf062496d4734341315ae91810e /py
parent484adac0bb6712dca968e3db22e2a10a79b96448 (diff)
downloadmicropython-ed570e4b2a0a68e43b191fb0d5b45fb2ec83aca4.tar.gz
micropython-ed570e4b2a0a68e43b191fb0d5b45fb2ec83aca4.zip
py: Remove mp_load_const_str and replace uses with inlined version.
Diffstat (limited to 'py')
-rw-r--r--py/emitnative.c5
-rw-r--r--py/nativeglue.c1
-rw-r--r--py/runtime.c5
-rw-r--r--py/runtime.h1
-rw-r--r--py/runtime0.h1
-rw-r--r--py/vm.c2
6 files changed, 3 insertions, 12 deletions
diff --git a/py/emitnative.c b/py/emitnative.c
index 34df2e034c..974b8fc7b5 100644
--- a/py/emitnative.c
+++ b/py/emitnative.c
@@ -167,7 +167,6 @@
STATIC byte mp_f_n_args[MP_F_NUMBER_OF] = {
[MP_F_CONVERT_OBJ_TO_NATIVE] = 2,
[MP_F_CONVERT_NATIVE_TO_OBJ] = 2,
- [MP_F_LOAD_CONST_STR] = 1,
[MP_F_LOAD_CONST_BYTES] = 1,
[MP_F_LOAD_NAME] = 1,
[MP_F_LOAD_GLOBAL] = 1,
@@ -1311,10 +1310,10 @@ STATIC void emit_native_load_const_str(emit_t *emit, qstr qst, bool bytes) {
{
if (bytes) {
emit_call_with_imm_arg(emit, MP_F_LOAD_CONST_BYTES, qst, REG_ARG_1);
+ emit_post_push_reg(emit, VTYPE_PYOBJ, REG_RET);
} else {
- emit_call_with_imm_arg(emit, MP_F_LOAD_CONST_STR, qst, REG_ARG_1);
+ emit_post_push_imm(emit, VTYPE_PYOBJ, (mp_uint_t)MP_OBJ_NEW_QSTR(qst));
}
- emit_post_push_reg(emit, VTYPE_PYOBJ, REG_RET);
}
}
diff --git a/py/nativeglue.c b/py/nativeglue.c
index d0896eedd3..4252bb88cd 100644
--- a/py/nativeglue.c
+++ b/py/nativeglue.c
@@ -92,7 +92,6 @@ void mp_native_raise(mp_obj_t o) {
void *const mp_fun_table[MP_F_NUMBER_OF] = {
mp_convert_obj_to_native,
mp_convert_native_to_obj,
- mp_load_const_str,
mp_load_const_bytes,
mp_load_name,
mp_load_global,
diff --git a/py/runtime.c b/py/runtime.c
index 4959617eff..5fcfa6f905 100644
--- a/py/runtime.c
+++ b/py/runtime.c
@@ -104,11 +104,6 @@ void mp_deinit(void) {
#endif
}
-mp_obj_t mp_load_const_str(qstr qst) {
- DEBUG_OP_printf("load '%s'\n", qstr_str(qst));
- return MP_OBJ_NEW_QSTR(qst);
-}
-
mp_obj_t mp_load_const_bytes(qstr qst) {
DEBUG_OP_printf("load b'%s'\n", qstr_str(qst));
mp_uint_t len;
diff --git a/py/runtime.h b/py/runtime.h
index d171f1582c..419b1d059b 100644
--- a/py/runtime.h
+++ b/py/runtime.h
@@ -90,7 +90,6 @@ mp_obj_t mp_binary_op(mp_uint_t op, mp_obj_t lhs, mp_obj_t rhs);
mp_obj_t mp_load_const_int(qstr qst);
mp_obj_t mp_load_const_dec(qstr qst);
-mp_obj_t mp_load_const_str(qstr qst);
mp_obj_t mp_load_const_bytes(qstr qst);
mp_obj_t mp_call_function_0(mp_obj_t fun);
diff --git a/py/runtime0.h b/py/runtime0.h
index cdcb6e3dca..de637fb469 100644
--- a/py/runtime0.h
+++ b/py/runtime0.h
@@ -109,7 +109,6 @@ typedef enum {
typedef enum {
MP_F_CONVERT_OBJ_TO_NATIVE = 0,
MP_F_CONVERT_NATIVE_TO_OBJ,
- MP_F_LOAD_CONST_STR,
MP_F_LOAD_CONST_BYTES,
MP_F_LOAD_NAME,
MP_F_LOAD_GLOBAL,
diff --git a/py/vm.c b/py/vm.c
index d6ff15356e..3423e9e5c5 100644
--- a/py/vm.c
+++ b/py/vm.c
@@ -213,7 +213,7 @@ dispatch_loop:
ENTRY(MP_BC_LOAD_CONST_STRING): {
DECODE_QSTR;
- PUSH(mp_load_const_str(qst));
+ PUSH(MP_OBJ_NEW_QSTR(qst));
DISPATCH();
}