diff options
| author | Damien George <damien.p.george@gmail.com> | 2015-02-08 01:57:40 +0000 |
|---|---|---|
| committer | Damien George <damien.p.george@gmail.com> | 2015-02-08 01:57:40 +0000 |
| commit | 7d414a1b52d193bab2c94cf56932e1eba23ba542 (patch) | |
| tree | 69f6840e4f825ffc1047fe7cb0f52eba27b20d86 /py/emitnative.c | |
| parent | 5f97aaeca4dc607a2d32e758c3ef6131ffb168a6 (diff) | |
py: Parse big-int/float/imag constants directly in parser.
Previous to this patch, a big-int, float or imag constant was interned
(made into a qstr) and then parsed at runtime to create an object each
time it was needed. This is wasteful in RAM and not efficient. Now,
these constants are parsed straight away in the parser and turned into
objects. This allows constants with large numbers of digits (so
addresses issue #1103) and takes us a step closer to #722.
Diffstat (limited to 'py/emitnative.c')
| -rw-r--r-- | py/emitnative.c | 17 |
1 files changed, 0 insertions, 17 deletions
diff --git a/py/emitnative.c b/py/emitnative.c index b1135f96d..ca6dd186e 100644 --- a/py/emitnative.c +++ b/py/emitnative.c @@ -1142,21 +1142,6 @@ STATIC void emit_native_load_const_small_int(emit_t *emit, mp_int_t arg) { } } -STATIC void emit_native_load_const_int(emit_t *emit, qstr qst) { - DEBUG_printf("load_const_int %s\n", qstr_str(qst)); - // for viper: load integer, check fits in 32 bits - emit_native_pre(emit); - emit_call_with_imm_arg(emit, MP_F_LOAD_CONST_INT, qst, REG_ARG_1); - emit_post_push_reg(emit, VTYPE_PYOBJ, REG_RET); -} - -STATIC void emit_native_load_const_dec(emit_t *emit, qstr qst) { - // for viper, a float/complex is just a Python object - emit_native_pre(emit); - emit_call_with_imm_arg(emit, MP_F_LOAD_CONST_DEC, qst, REG_ARG_1); - emit_post_push_reg(emit, VTYPE_PYOBJ, REG_RET); -} - 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 @@ -2317,8 +2302,6 @@ const emit_method_table_t EXPORT_FUN(method_table) = { emit_native_import_star, emit_native_load_const_tok, emit_native_load_const_small_int, - emit_native_load_const_int, - emit_native_load_const_dec, emit_native_load_const_str, emit_native_load_const_obj, emit_native_load_null, |
