summaryrefslogtreecommitdiff
path: root/py/emitbc.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/emitbc.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/emitbc.c')
-rw-r--r--py/emitbc.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/py/emitbc.c b/py/emitbc.c
index 7957a2131..2f5304deb 100644
--- a/py/emitbc.c
+++ b/py/emitbc.c
@@ -34,6 +34,8 @@
#include "py/emit.h"
#include "py/bc0.h"
+#if MICROPY_ENABLE_COMPILER
+
#define BYTES_FOR_INT ((BYTES_PER_WORD * 8 + 6) / 7)
#define DUMMY_DATA_SIZE (BYTES_FOR_INT)
@@ -1070,3 +1072,5 @@ const mp_emit_method_table_id_ops_t mp_emit_bc_method_table_delete_id_ops = {
mp_emit_bc_delete_global,
};
#endif
+
+#endif //MICROPY_ENABLE_COMPILER