mirror of
https://github.com/pocketpy/pocketpy
synced 2025-10-20 19:40:18 +00:00
Update ceval.h
This commit is contained in:
parent
58315b22ef
commit
d9df9d1e05
13
src/ceval.h
13
src/ceval.h
@ -7,6 +7,13 @@
|
|||||||
namespace pkpy{
|
namespace pkpy{
|
||||||
|
|
||||||
inline PyObject* VM::_run_top_frame(){
|
inline PyObject* VM::_run_top_frame(){
|
||||||
|
DEF_SNAME(add);
|
||||||
|
DEF_SNAME(dict);
|
||||||
|
DEF_SNAME(set);
|
||||||
|
DEF_SNAME(__enter__);
|
||||||
|
DEF_SNAME(__exit__);
|
||||||
|
DEF_SNAME(__doc__);
|
||||||
|
|
||||||
FrameId frame = top_frame();
|
FrameId frame = top_frame();
|
||||||
const int base_id = frame.index;
|
const int base_id = frame.index;
|
||||||
bool need_raise = false;
|
bool need_raise = false;
|
||||||
@ -234,14 +241,12 @@ __NEXT_STEP:;
|
|||||||
PUSH(_0);
|
PUSH(_0);
|
||||||
DISPATCH();
|
DISPATCH();
|
||||||
TARGET(BUILD_DICT)
|
TARGET(BUILD_DICT)
|
||||||
DEF_SNAME(dict);
|
|
||||||
_0 = VAR(STACK_VIEW(byte.arg).to_tuple());
|
_0 = VAR(STACK_VIEW(byte.arg).to_tuple());
|
||||||
_0 = call(builtins->attr(dict), _0);
|
_0 = call(builtins->attr(dict), _0);
|
||||||
STACK_SHRINK(byte.arg);
|
STACK_SHRINK(byte.arg);
|
||||||
PUSH(_0);
|
PUSH(_0);
|
||||||
DISPATCH();
|
DISPATCH();
|
||||||
TARGET(BUILD_SET)
|
TARGET(BUILD_SET)
|
||||||
DEF_SNAME(set);
|
|
||||||
_0 = VAR(STACK_VIEW(byte.arg).to_tuple());
|
_0 = VAR(STACK_VIEW(byte.arg).to_tuple());
|
||||||
_0 = call(builtins->attr(set), _0);
|
_0 = call(builtins->attr(set), _0);
|
||||||
STACK_SHRINK(byte.arg);
|
STACK_SHRINK(byte.arg);
|
||||||
@ -427,7 +432,6 @@ __NEXT_STEP:;
|
|||||||
call_method(SECOND(), __setitem__, t[0], t[1]);
|
call_method(SECOND(), __setitem__, t[0], t[1]);
|
||||||
} DISPATCH();
|
} DISPATCH();
|
||||||
TARGET(SET_ADD)
|
TARGET(SET_ADD)
|
||||||
DEF_SNAME(add);
|
|
||||||
_0 = POPX();
|
_0 = POPX();
|
||||||
call_method(SECOND(), add, _0);
|
call_method(SECOND(), add, _0);
|
||||||
DISPATCH();
|
DISPATCH();
|
||||||
@ -535,11 +539,9 @@ __NEXT_STEP:;
|
|||||||
/*****************************************/
|
/*****************************************/
|
||||||
// TODO: using "goto" inside with block may cause __exit__ not called
|
// TODO: using "goto" inside with block may cause __exit__ not called
|
||||||
TARGET(WITH_ENTER)
|
TARGET(WITH_ENTER)
|
||||||
DEF_SNAME(__enter__);
|
|
||||||
call_method(POPX(), __enter__);
|
call_method(POPX(), __enter__);
|
||||||
DISPATCH();
|
DISPATCH();
|
||||||
TARGET(WITH_EXIT)
|
TARGET(WITH_EXIT)
|
||||||
DEF_SNAME(__exit__);
|
|
||||||
call_method(POPX(), __exit__);
|
call_method(POPX(), __exit__);
|
||||||
DISPATCH();
|
DISPATCH();
|
||||||
/*****************************************/
|
/*****************************************/
|
||||||
@ -569,7 +571,6 @@ __NEXT_STEP:;
|
|||||||
TARGET(RE_RAISE) _raise(); DISPATCH();
|
TARGET(RE_RAISE) _raise(); DISPATCH();
|
||||||
/*****************************************/
|
/*****************************************/
|
||||||
TARGET(SETUP_DOCSTRING)
|
TARGET(SETUP_DOCSTRING)
|
||||||
DEF_SNAME(__doc__);
|
|
||||||
TOP()->attr().set(__doc__, co_consts[byte.arg]);
|
TOP()->attr().set(__doc__, co_consts[byte.arg]);
|
||||||
DISPATCH();
|
DISPATCH();
|
||||||
TARGET(FORMAT_STRING) {
|
TARGET(FORMAT_STRING) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user