diff options
author | Damien George <damien.p.george@gmail.com> | 2014-12-27 17:20:41 +0000 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2014-12-27 17:33:30 +0000 |
commit | 83204f34067b765293b791563bdd5756bdfc5aa4 (patch) | |
tree | c3492e6ba82b9c1ae00cfe4cf33b359bec486fe1 /py/emitnative.c | |
parent | e37dcaafb43c1246ab55d79ebb8889a61f280533 (diff) | |
download | micropython-83204f34067b765293b791563bdd5756bdfc5aa4.tar.gz micropython-83204f34067b765293b791563bdd5756bdfc5aa4.zip |
py: Allow to properly disable builtin slice operation.
This patch makes the MICROPY_PY_BUILTINS_SLICE compile-time option
fully disable the builtin slice operation (when set to 0). This
includes removing the slice sytanx from the grammar. Now, enabling
slice costs 4228 bytes on unix x64, and 1816 bytes on stmhal.
Diffstat (limited to 'py/emitnative.c')
-rw-r--r-- | py/emitnative.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/py/emitnative.c b/py/emitnative.c index 9f5733425c..c2fe951be8 100644 --- a/py/emitnative.c +++ b/py/emitnative.c @@ -2084,6 +2084,7 @@ STATIC void emit_native_set_add(emit_t *emit, mp_uint_t set_index) { } #endif +#if MICROPY_PY_BUILTINS_SLICE STATIC void emit_native_build_slice(emit_t *emit, mp_uint_t n_args) { DEBUG_printf("build_slice %d\n", n_args); if (n_args == 2) { @@ -2104,6 +2105,7 @@ STATIC void emit_native_build_slice(emit_t *emit, mp_uint_t n_args) { emit_post_push_reg(emit, VTYPE_PYOBJ, REG_RET); } } +#endif STATIC void emit_native_unpack_sequence(emit_t *emit, mp_uint_t n_args) { DEBUG_printf("unpack_sequence %d\n", n_args); @@ -2336,7 +2338,9 @@ const emit_method_table_t EXPORT_FUN(method_table) = { emit_native_build_set, emit_native_set_add, #endif + #if MICROPY_PY_BUILTINS_SLICE emit_native_build_slice, + #endif emit_native_unpack_sequence, emit_native_unpack_ex, emit_native_make_function, |