diff options
author | Damien George <damien@micropython.org> | 2024-02-16 16:53:47 +1100 |
---|---|---|
committer | Damien George <damien@micropython.org> | 2024-02-20 10:56:24 +1100 |
commit | 6d403eb6972b7f6137838d89dba1ae3f76846c8b (patch) | |
tree | 2d466c2a66a011be1e5896d2939b66e7af7fd236 /py/objfun.c | |
parent | 9400229766624e80db6a6f95af287a5542dc1b43 (diff) | |
download | micropython-6d403eb6972b7f6137838d89dba1ae3f76846c8b.tar.gz micropython-6d403eb6972b7f6137838d89dba1ae3f76846c8b.zip |
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/objfun.c')
-rw-r--r-- | py/objfun.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/py/objfun.c b/py/objfun.c index 1bdbb39166..31f4a1f83b 100644 --- a/py/objfun.c +++ b/py/objfun.c @@ -401,7 +401,7 @@ mp_obj_t mp_obj_new_fun_bc(const mp_obj_t *def_args, const byte *code, const mp_ STATIC mp_obj_t fun_native_call(mp_obj_t self_in, size_t n_args, size_t n_kw, const mp_obj_t *args) { MP_STACK_CHECK(); mp_obj_fun_bc_t *self = MP_OBJ_TO_PTR(self_in); - mp_call_fun_t fun = MICROPY_MAKE_POINTER_CALLABLE((void *)self->bytecode); + mp_call_fun_t fun = mp_obj_fun_native_get_function_start(self); return fun(self_in, n_args, n_kw, args); } |