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.
This commit is contained in:
Damien George 2014-09-12 23:15:06 +01:00
parent 89ab3be0b1
commit bb29546868
1 changed files with 6 additions and 1 deletions

View File

@ -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 {