diff options
author | Damien George <damien.p.george@gmail.com> | 2015-12-18 12:35:44 +0000 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2015-12-18 12:35:44 +0000 |
commit | dd5353a4054024a411aa343a22ffcd16195a16ad (patch) | |
tree | faa3f91ab3a37f1b2f3469e01a9228e83853dc7b /py/builtinevex.c | |
parent | ab8012bd8098e155e38ef6dead62bca8a200e613 (diff) | |
download | micropython-dd5353a4054024a411aa343a22ffcd16195a16ad.tar.gz micropython-dd5353a4054024a411aa343a22ffcd16195a16ad.zip |
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.
Diffstat (limited to 'py/builtinevex.c')
-rw-r--r-- | py/builtinevex.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/py/builtinevex.c b/py/builtinevex.c index c14869e350..cac74e94fd 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 |