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.
This commit is contained in:
Damien George
2015-12-18 12:35:44 +00:00
parent ab8012bd80
commit dd5353a405
12 changed files with 60 additions and 1 deletions

View File

@@ -38,6 +38,8 @@
#include "py/runtime.h"
#include "py/builtin.h"
#if MICROPY_ENABLE_COMPILER
#define RULE_ACT_ARG_MASK (0x0f)
#define RULE_ACT_KIND_MASK (0x30)
#define RULE_ACT_ALLOW_IDENT (0x40)
@@ -1079,3 +1081,5 @@ void mp_parse_tree_clear(mp_parse_tree_t *tree) {
chunk = next;
}
}
#endif // MICROPY_ENABLE_COMPILER