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