summaryrefslogtreecommitdiff
path: root/py/compile.c
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2015-12-18 12:35:44 +0000
committerDamien George <damien.p.george@gmail.com>2015-12-18 12:35:44 +0000
commitdd5353a4054024a411aa343a22ffcd16195a16ad (patch)
treefaa3f91ab3a37f1b2f3469e01a9228e83853dc7b /py/compile.c
parentab8012bd8098e155e38ef6dead62bca8a200e613 (diff)
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/compile.c')
-rw-r--r--py/compile.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/py/compile.c b/py/compile.c
index 4b929d52f..f349dca2b 100644
--- a/py/compile.c
+++ b/py/compile.c
@@ -35,6 +35,8 @@
#include "py/compile.h"
#include "py/runtime.h"
+#if MICROPY_ENABLE_COMPILER
+
// TODO need to mangle __attr names
typedef enum {
@@ -3310,3 +3312,5 @@ mp_obj_t mp_compile(mp_parse_tree_t *parse_tree, qstr source_file, uint emit_opt
// return function that executes the outer module
return mp_make_function_from_raw_code(rc, MP_OBJ_NULL, MP_OBJ_NULL);
}
+
+#endif // MICROPY_ENABLE_COMPILER