diff options
author | Damien George <damien.p.george@gmail.com> | 2014-03-31 11:59:23 +0100 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2014-03-31 11:59:23 +0100 |
commit | 523b575039d96d63669ad8c1fa318ba4db046aca (patch) | |
tree | bc191c86845b3c5714d11f24e8848f22020308e5 /py/runtime.c | |
parent | 3056509e00c02e4faef44d90bf3953dcf0b0d4a0 (diff) |
py: Add LOAD_NULL bytecode and use it to simplify function calls.
Adding this bytecode allows to remove 4 others related to
function/method calls with * and ** support. Will also help with
bytecodes that make functions/closures with default positional and
keyword args.
Diffstat (limited to 'py/runtime.c')
-rw-r--r-- | py/runtime.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/py/runtime.c b/py/runtime.c index 489886496..7e0287945 100644 --- a/py/runtime.c +++ b/py/runtime.c @@ -505,7 +505,7 @@ mp_obj_t mp_call_method_n_kw(uint n_args, uint n_kw, const mp_obj_t *args) { return mp_call_function_n_kw(args[0], n_args + adjust, n_kw, args + 2 - adjust); } -mp_obj_t mp_call_method_n_kw_var(bool have_self, uint n_args_n_kw, const mp_obj_t *args, mp_obj_t pos_seq, mp_obj_t kw_dict) { +mp_obj_t mp_call_method_n_kw_var(bool have_self, uint n_args_n_kw, const mp_obj_t *args) { mp_obj_t fun = *args++; mp_obj_t self = MP_OBJ_NULL; if (have_self) { @@ -513,6 +513,8 @@ mp_obj_t mp_call_method_n_kw_var(bool have_self, uint n_args_n_kw, const mp_obj_ } uint n_args = n_args_n_kw & 0xff; uint n_kw = (n_args_n_kw >> 8) & 0xff; + mp_obj_t pos_seq = args[n_args + 2 * n_kw]; // map be MP_OBJ_NULL + mp_obj_t kw_dict = args[n_args + 2 * n_kw + 1]; // map be MP_OBJ_NULL DEBUG_OP_printf("call method var (fun=%p, self=%p, n_args=%u, n_kw=%u, args=%p, seq=%p, dict=%p)\n", fun, self, n_args, n_kw, args, pos_seq, kw_dict); |