summaryrefslogtreecommitdiff
path: root/py/emitbc.c
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2016-02-11 22:30:53 +0000
committerDamien George <damien.p.george@gmail.com>2016-02-25 10:05:46 +0000
commitea23520403777f9b026f49245d39f8be1ccdbdac (patch)
tree949532b08d2614af11e8616a2d902ac8ca9ad3c2 /py/emitbc.c
parent57b96a7be214c8f2493db7d430348f5efcc8ad34 (diff)
py: Add MICROPY_DYNAMIC_COMPILER option to config compiler at runtime.
This new compile-time option allows to make the bytecode compiler configurable at runtime by setting the fields in the mp_dynamic_compiler structure. By using this feature, the compiler can generate bytecode that targets any MicroPython runtime/VM, regardless of the host and target compile-time settings. Options so far that fall under this dynamic setting are: - maximum number of bits that a small int can hold; - whether caching of lookups is used in the bytecode; - whether to use unicode strings or not (lexer behaviour differs, and therefore generated string constants differ).
Diffstat (limited to 'py/emitbc.c')
-rw-r--r--py/emitbc.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/py/emitbc.c b/py/emitbc.c
index 2f5304deb..14298bad4 100644
--- a/py/emitbc.c
+++ b/py/emitbc.c
@@ -579,7 +579,7 @@ void mp_emit_bc_load_name(emit_t *emit, qstr qst) {
(void)qst;
emit_bc_pre(emit, 1);
emit_write_bytecode_byte_qstr(emit, MP_BC_LOAD_NAME, qst);
- if (MICROPY_OPT_CACHE_MAP_LOOKUP_IN_BYTECODE) {
+ if (MICROPY_OPT_CACHE_MAP_LOOKUP_IN_BYTECODE_DYNAMIC) {
emit_write_bytecode_byte(emit, 0);
}
}
@@ -588,7 +588,7 @@ void mp_emit_bc_load_global(emit_t *emit, qstr qst) {
(void)qst;
emit_bc_pre(emit, 1);
emit_write_bytecode_byte_qstr(emit, MP_BC_LOAD_GLOBAL, qst);
- if (MICROPY_OPT_CACHE_MAP_LOOKUP_IN_BYTECODE) {
+ if (MICROPY_OPT_CACHE_MAP_LOOKUP_IN_BYTECODE_DYNAMIC) {
emit_write_bytecode_byte(emit, 0);
}
}
@@ -596,7 +596,7 @@ void mp_emit_bc_load_global(emit_t *emit, qstr qst) {
void mp_emit_bc_load_attr(emit_t *emit, qstr qst) {
emit_bc_pre(emit, 0);
emit_write_bytecode_byte_qstr(emit, MP_BC_LOAD_ATTR, qst);
- if (MICROPY_OPT_CACHE_MAP_LOOKUP_IN_BYTECODE) {
+ if (MICROPY_OPT_CACHE_MAP_LOOKUP_IN_BYTECODE_DYNAMIC) {
emit_write_bytecode_byte(emit, 0);
}
}
@@ -646,7 +646,7 @@ void mp_emit_bc_store_global(emit_t *emit, qstr qst) {
void mp_emit_bc_store_attr(emit_t *emit, qstr qst) {
emit_bc_pre(emit, -2);
emit_write_bytecode_byte_qstr(emit, MP_BC_STORE_ATTR, qst);
- if (MICROPY_OPT_CACHE_MAP_LOOKUP_IN_BYTECODE) {
+ if (MICROPY_OPT_CACHE_MAP_LOOKUP_IN_BYTECODE_DYNAMIC) {
emit_write_bytecode_byte(emit, 0);
}
}