gh-101632: Add the new RETURN_CONST opcode (#101633)

This commit is contained in:
penguin_wwy 2023-02-08 06:32:21 +08:00 committed by GitHub
parent 0d3d5007b1
commit 753fc8a5d6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 186 additions and 154 deletions

View file

@ -555,6 +555,23 @@ dummy_func(
goto resume_frame;
}
inst(RETURN_CONST, (--)) {
PyObject *retval = GETITEM(consts, oparg);
Py_INCREF(retval);
assert(EMPTY());
_PyFrame_SetStackPointer(frame, stack_pointer);
TRACE_FUNCTION_EXIT();
DTRACE_FUNCTION_EXIT();
_Py_LeaveRecursiveCallPy(tstate);
assert(frame != &entry_frame);
// GH-99729: We need to unlink the frame *before* clearing it:
_PyInterpreterFrame *dying = frame;
frame = cframe.current_frame = dying->previous;
_PyEvalFrameClearAndPop(tstate, dying);
_PyFrame_StackPush(frame, retval);
goto resume_frame;
}
inst(GET_AITER, (obj -- iter)) {
unaryfunc getter = NULL;
PyTypeObject *type = Py_TYPE(obj);