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.
diff --git a/py/builtinevex.c b/py/builtinevex.c
index c14869e..cac74e9 100644
--- a/py/builtinevex.c
+++ b/py/builtinevex.c
@@ -107,6 +107,8 @@
#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 @@
}
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