summaryrefslogtreecommitdiffstatshomepage
path: root/py
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2014-09-12 23:15:06 +0100
committerDamien George <damien.p.george@gmail.com>2014-09-12 23:15:06 +0100
commitbb29546868f5748f1df657687c0405428f971d7d (patch)
tree16b9934a343a23359f9b13a335ecaac5106bec03 /py
parent89ab3be0b1802b574df18ad39d4415bcefbc4b07 (diff)
downloadmicropython-bb29546868f5748f1df657687c0405428f971d7d.tar.gz
micropython-bb29546868f5748f1df657687c0405428f971d7d.zip
py: Load strings as objects when compiling viper.
Eventually, viper wants to be able to use raw pointers to strings and arrays for efficient access. But for now, let's just load strings as a Python object so they can be used as normal. This will anyway be compatible with eventual intended viper behaviour. Addresses issue #857.
Diffstat (limited to 'py')
-rw-r--r--py/emitnative.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/py/emitnative.c b/py/emitnative.c
index 078ad5fc1e..0bddfbabad 100644
--- a/py/emitnative.c
+++ b/py/emitnative.c
@@ -1017,12 +1017,17 @@ STATIC void emit_native_load_const_dec(emit_t *emit, qstr qst) {
STATIC void emit_native_load_const_str(emit_t *emit, qstr qst, bool bytes) {
emit_native_pre(emit);
+ // TODO: Eventually we want to be able to work with raw pointers in viper to
+ // do native array access. For now we just load them as any other object.
+ /*
if (emit->do_viper_types) {
// not implemented properly
// load a pointer to the asciiz string?
assert(0);
emit_post_push_imm(emit, VTYPE_PTR, (mp_uint_t)qstr_str(qst));
- } else {
+ } else
+ */
+ {
if (bytes) {
emit_call_with_imm_arg(emit, MP_F_LOAD_CONST_BYTES, qst, REG_ARG_1);
} else {