summaryrefslogtreecommitdiff
path: root/py/bc.c
diff options
context:
space:
mode:
authorDamien George <damien@micropython.org>2024-02-16 16:53:47 +1100
committerDamien George <damien@micropython.org>2024-02-20 10:56:24 +1100
commit6d403eb6972b7f6137838d89dba1ae3f76846c8b (patch)
tree2d466c2a66a011be1e5896d2939b66e7af7fd236 /py/bc.c
parent9400229766624e80db6a6f95af287a5542dc1b43 (diff)
py/emitnative: Simplify layout and loading of native function prelude.
Now native functions and native generators have similar behaviour: the first machine-word of their code is an index to get to the prelude. This simplifies the handling of these types of functions, and also reduces the size of the emitted native machine code by no longer requiring special code at the start of the function to load a pointer to the prelude. Signed-off-by: Damien George <damien@micropython.org>
Diffstat (limited to 'py/bc.c')
-rw-r--r--py/bc.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/py/bc.c b/py/bc.c
index e1795ce41..dc70fddf2 100644
--- a/py/bc.c
+++ b/py/bc.c
@@ -336,9 +336,9 @@ void mp_setup_code_state(mp_code_state_t *code_state, size_t n_args, size_t n_kw
// On entry code_state should be allocated somewhere (stack/heap) and
// contain the following valid entries:
// - code_state->fun_bc should contain a pointer to the function object
-// - code_state->ip should contain a pointer to the beginning of the prelude
// - code_state->n_state should be the number of objects in the local state
void mp_setup_code_state_native(mp_code_state_native_t *code_state, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+ code_state->ip = mp_obj_fun_native_get_prelude_ptr(code_state->fun_bc);
code_state->sp = &code_state->state[0] - 1;
mp_setup_code_state_helper((mp_code_state_t *)code_state, n_args, n_kw, args);
}