py/nativeglue: Remove dependency on mp_fun_table in dyn-compiler mode.
mpy-cross uses MICROPY_DYNAMIC_COMPILER and MICROPY_EMIT_NATIVE but does not actually need to execute native functions, and does not need mp_fun_table. This commit makes it so mp_fun_table and all its entries are not built when MICROPY_DYNAMIC_COMPILER is enabled, significantly reducing the size of the mpy-cross executable and allowing it to be built on more machines/OS's.
This commit is contained in:
parent
bff4e13009
commit
a4f1d82757
|
@ -609,8 +609,11 @@ STATIC void emit_native_end_pass(emit_t *emit) {
|
||||||
const_table_alloc += nqstr;
|
const_table_alloc += nqstr;
|
||||||
}
|
}
|
||||||
emit->const_table = m_new(mp_uint_t, const_table_alloc);
|
emit->const_table = m_new(mp_uint_t, const_table_alloc);
|
||||||
|
#if !MICROPY_DYNAMIC_COMPILER
|
||||||
// Store mp_fun_table pointer just after qstrs
|
// Store mp_fun_table pointer just after qstrs
|
||||||
|
// (but in dynamic-compiler mode eliminate dependency on mp_fun_table)
|
||||||
emit->const_table[nqstr] = (mp_uint_t)(uintptr_t)mp_fun_table;
|
emit->const_table[nqstr] = (mp_uint_t)(uintptr_t)mp_fun_table;
|
||||||
|
#endif
|
||||||
|
|
||||||
#if MICROPY_PERSISTENT_CODE_SAVE
|
#if MICROPY_PERSISTENT_CODE_SAVE
|
||||||
size_t qstr_link_alloc = emit->qstr_link_cur;
|
size_t qstr_link_alloc = emit->qstr_link_cur;
|
||||||
|
|
|
@ -338,6 +338,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Whether the compiler is dynamically configurable (ie at runtime)
|
// Whether the compiler is dynamically configurable (ie at runtime)
|
||||||
|
// This will disable the ability to execute native/viper code
|
||||||
#ifndef MICROPY_DYNAMIC_COMPILER
|
#ifndef MICROPY_DYNAMIC_COMPILER
|
||||||
#define MICROPY_DYNAMIC_COMPILER (0)
|
#define MICROPY_DYNAMIC_COMPILER (0)
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -95,7 +95,7 @@ mp_obj_t mp_native_to_obj(mp_uint_t val, mp_uint_t type) {
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if MICROPY_EMIT_NATIVE
|
#if MICROPY_EMIT_NATIVE && !MICROPY_DYNAMIC_COMPILER
|
||||||
|
|
||||||
STATIC mp_obj_dict_t *mp_native_swap_globals(mp_obj_dict_t *new_globals) {
|
STATIC mp_obj_dict_t *mp_native_swap_globals(mp_obj_dict_t *new_globals) {
|
||||||
if (new_globals == NULL) {
|
if (new_globals == NULL) {
|
||||||
|
|
Loading…
Reference in New Issue