summaryrefslogtreecommitdiffstatshomepage
path: root/py
diff options
context:
space:
mode:
authorPaul Sokolovsky <pfalcon@users.sourceforge.net>2015-03-28 01:14:44 +0200
committerPaul Sokolovsky <pfalcon@users.sourceforge.net>2015-04-03 00:03:07 +0300
commit390e92688c4fc70dea4998f0298a9f1bea90d24f (patch)
treeb0d7a0c9ff0a287c848736aa50c72c12bf9609ab /py
parent332a909d44382cbd9c0c08f70753e5310da0f693 (diff)
downloadmicropython-390e92688c4fc70dea4998f0298a9f1bea90d24f.tar.gz
micropython-390e92688c4fc70dea4998f0298a9f1bea90d24f.zip
vm: Stackless support for MP_BC_CALL_METHOD.
Diffstat (limited to 'py')
-rw-r--r--py/vm.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/py/vm.c b/py/vm.c
index 2359f1f019..53c6da2dcb 100644
--- a/py/vm.c
+++ b/py/vm.c
@@ -904,6 +904,25 @@ unwind_jump:;
// unum & 0xff == n_positional
// (unum >> 8) & 0xff == n_keyword
sp -= (unum & 0xff) + ((unum >> 7) & 0x1fe) + 1;
+ #if MICROPY_STACKLESS
+ if (mp_obj_get_type(*sp) == &mp_type_fun_bc) {
+ code_state->ip = ip;
+ code_state->sp = sp;
+ code_state->exc_sp = MP_TAGPTR_MAKE(exc_sp, currently_in_except_block);
+
+ mp_uint_t n_args = unum & 0xff;
+ mp_uint_t n_kw = (unum >> 8) & 0xff;
+ int adjust = (sp[1] == NULL) ? 0 : 1;
+
+ mp_code_state *new_state = mp_obj_fun_bc_prepare_codestate(*sp, n_args + adjust, n_kw, sp + 2 - adjust);
+ if (new_state) {
+ new_state->prev = code_state;
+ code_state = new_state;
+ nlr_pop();
+ goto run_code_state;
+ }
+ }
+ #endif
SET_TOP(mp_call_method_n_kw(unum & 0xff, (unum >> 8) & 0xff, sp));
DISPATCH();
}