diff options
author | Damien George <damien.p.george@gmail.com> | 2018-09-14 17:40:59 +1000 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2018-09-15 22:39:27 +1000 |
commit | 43f1848bfa81aa3cb0acd1e34eece0a11aa130d0 (patch) | |
tree | 525de05e2d2fffaa8700ff010204a888d0838b07 /py/emitglue.c | |
parent | 460954734e12074d29056b446d1406a27e2aed9f (diff) |
py: Make viper functions have the same entry signature as native.
This commit makes viper functions have the same signature as native
functions, at the level of the emitter/assembler. This means that viper
functions can now be wrapped in the same uPy object as native functions.
Viper functions are now responsible for parsing their arguments (before it
was done by the runtime), and this makes calling them more efficient (in
most cases) because the viper entry code can be custom generated to suit
the signature of the function.
This change also opens the way forward for viper functions to take
arbitrary numbers of arguments, and for them to handle globals correctly,
among other things.
Diffstat (limited to 'py/emitglue.c')
-rw-r--r-- | py/emitglue.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/py/emitglue.c b/py/emitglue.c index f75a57437..f99631450 100644 --- a/py/emitglue.c +++ b/py/emitglue.c @@ -134,10 +134,8 @@ mp_obj_t mp_make_function_from_raw_code(const mp_raw_code_t *rc, mp_obj_t def_ar switch (rc->kind) { #if MICROPY_EMIT_NATIVE case MP_CODE_NATIVE_PY: - fun = mp_obj_new_fun_native(def_args, def_kw_args, rc->data.u_native.fun_data, rc->data.u_native.const_table); - break; case MP_CODE_NATIVE_VIPER: - fun = mp_obj_new_fun_viper(rc->n_pos_args, rc->data.u_native.fun_data, rc->data.u_native.type_sig); + fun = mp_obj_new_fun_native(def_args, def_kw_args, rc->data.u_native.fun_data, rc->data.u_native.const_table); break; #endif #if MICROPY_EMIT_INLINE_ASM |