py: add UNPACK_SEQUENCE and keyword methods to VM.

This commit is contained in:
Damien 2013-11-26 15:15:50 +00:00
parent ff099f36d6
commit 6f3e7fc505

20
py/vm.c
View File

@ -369,6 +369,12 @@ bool py_execute_byte_code_2(const byte **ip_in_out, py_obj_t *fastn, py_obj_t **
sp++; sp++;
break; break;
case PYBC_UNPACK_SEQUENCE:
DECODE_UINT;
rt_unpack_sequence(sp[0], unum, sp - unum + 1);
sp -= unum - 1;
break;
case PYBC_MAKE_FUNCTION: case PYBC_MAKE_FUNCTION:
DECODE_UINT; DECODE_UINT;
PUSH(rt_make_function_from_id(unum)); PUSH(rt_make_function_from_id(unum));
@ -384,10 +390,16 @@ bool py_execute_byte_code_2(const byte **ip_in_out, py_obj_t *fastn, py_obj_t **
case PYBC_CALL_METHOD: case PYBC_CALL_METHOD:
DECODE_UINT; DECODE_UINT;
assert((unum & 0xff00) == 0); // n_keyword if ((unum & 0xff00) == 0) {
unum &= 0xff; // no keywords
obj1 = rt_call_method_n(unum, sp); unum &= 0xff;
sp += unum + 1; obj1 = rt_call_method_n(unum, sp);
sp += unum + 1;
} else {
// keywords
obj1 = rt_call_method_n_kw(unum & 0xff, (unum >> 8) & 0xff, sp);
sp += (unum & 0xff) + ((unum >> 7) & 0x1fe) + 1;
}
*sp = obj1; *sp = obj1;
break; break;