mirror of
https://github.com/micropython/micropython.git
synced 2026-01-08 05:00:26 +01:00
Split qstr into pools, and put initial pool in ROM.
Qstr's are now split into a linked-list of qstr pools. This has 2 benefits: the first pool can be in ROM (huge benefit, since we no longer use RAM for the core qstrs), and subsequent pools use m_new for the next pool instead of m_renew (thus avoiding a huge single table for all the qstrs). Still would be better to use a hash table, but this scheme takes us part of the way (eventually convert the pools to hash tables). Also fixed bug with import. Also improved the way the module code is referenced (not magic number 1 anymore).
This commit is contained in:
@@ -58,7 +58,9 @@ mp_obj_t mp_builtin___import__(int n, mp_obj_t *args) {
|
||||
return mp_const_none;
|
||||
}
|
||||
|
||||
if (!mp_compile(pn, false)) {
|
||||
mp_obj_t module_fun = mp_compile(pn, false);
|
||||
|
||||
if (module_fun == mp_const_none) {
|
||||
// TODO handle compile error correctly
|
||||
rt_locals_set(old_locals);
|
||||
rt_globals_set(old_globals);
|
||||
@@ -66,7 +68,6 @@ mp_obj_t mp_builtin___import__(int n, mp_obj_t *args) {
|
||||
}
|
||||
|
||||
// complied successfully, execute it
|
||||
mp_obj_t module_fun = rt_make_function_from_id(1); // TODO we should return from mp_compile the unique_code_id for the module
|
||||
nlr_buf_t nlr;
|
||||
if (nlr_push(&nlr) == 0) {
|
||||
rt_call_function_0(module_fun);
|
||||
|
||||
Reference in New Issue
Block a user