Commit bb295468 authored by Damien George's avatar Damien George
Browse files

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.
parent 89ab3be0
......@@ -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 {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment