mirror of
https://github.com/pocketpy/pocketpy
synced 2025-10-20 11:30:18 +00:00
add EVAL_CONST
This commit is contained in:
parent
814bd3e640
commit
b8100bcce5
@ -90,7 +90,7 @@ OPCODE(LOOP_CONTINUE)
|
||||
OPCODE(LOOP_BREAK)
|
||||
OPCODE(GOTO)
|
||||
/**************************/
|
||||
OPCODE(EVAL)
|
||||
OPCODE(EVAL_CONST)
|
||||
OPCODE(REPR)
|
||||
OPCODE(CALL)
|
||||
OPCODE(CALL_TP)
|
||||
|
@ -568,9 +568,10 @@ __NEXT_STEP:;
|
||||
frame->jump_abs_break(index);
|
||||
} DISPATCH();
|
||||
/*****************************************/
|
||||
TARGET(EVAL){
|
||||
TARGET(EVAL_CONST){
|
||||
PyObject* _0 = builtins->attr(pk_id_eval);
|
||||
TOP() = call(_0, TOP());
|
||||
PyObject* _1 = co_consts[byte.arg];
|
||||
PUSH(call(_0, _1));
|
||||
} DISPATCH();
|
||||
TARGET(REPR)
|
||||
TOP() = py_repr(TOP());
|
||||
|
@ -392,8 +392,7 @@ namespace pkpy{
|
||||
}
|
||||
}else{
|
||||
int index = ctx->add_const(py_var(ctx->vm, expr));
|
||||
ctx->emit_(OP_LOAD_CONST, index, line);
|
||||
ctx->emit_(OP_EVAL, BC_NOARG, line);
|
||||
ctx->emit_(OP_EVAL_CONST, index, line);
|
||||
}
|
||||
if(repr){
|
||||
ctx->emit_(OP_REPR, BC_NOARG, line);
|
||||
|
Loading…
x
Reference in New Issue
Block a user