mirror of
https://github.com/micropython/micropython.git
synced 2026-01-04 19:20:22 +01:00
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.
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user