From dd5353a4054024a411aa343a22ffcd16195a16ad Mon Sep 17 00:00:00 2001 From: Damien George Date: Fri, 18 Dec 2015 12:35:44 +0000 Subject: py: Add MICROPY_ENABLE_COMPILER and MICROPY_PY_BUILTINS_EVAL_EXEC opts. MICROPY_ENABLE_COMPILER can be used to enable/disable the entire compiler, which is useful when only loading of pre-compiled bytecode is supported. It is enabled by default. MICROPY_PY_BUILTINS_EVAL_EXEC controls support of eval and exec builtin functions. By default they are only included if MICROPY_ENABLE_COMPILER is enabled. Disabling both options saves about 40k of code size on 32-bit x86. --- py/builtinevex.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'py/builtinevex.c') diff --git a/py/builtinevex.c b/py/builtinevex.c index c14869e35..cac74e94f 100644 --- a/py/builtinevex.c +++ b/py/builtinevex.c @@ -107,6 +107,8 @@ MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_builtin_compile_obj, 3, 6, mp_builtin_com #endif // MICROPY_PY_BUILTINS_COMPILE +#if MICROPY_PY_BUILTINS_EVAL_EXEC + STATIC mp_obj_t eval_exec_helper(mp_uint_t n_args, const mp_obj_t *args, mp_parse_input_kind_t parse_input_kind) { // work out the context mp_obj_dict_t *globals = mp_globals_get(); @@ -155,6 +157,8 @@ STATIC mp_obj_t mp_builtin_exec(mp_uint_t n_args, const mp_obj_t *args) { } MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_builtin_exec_obj, 1, 3, mp_builtin_exec); +#endif // MICROPY_PY_BUILTINS_EVAL_EXEC + #if MICROPY_PY_BUILTINS_EXECFILE STATIC mp_obj_t mp_builtin_execfile(mp_uint_t n_args, const mp_obj_t *args) { // MP_PARSE_SINGLE_INPUT is used to indicate a file input -- cgit v1.2.3