mirror of
https://github.com/python/cpython.git
synced 2025-08-22 09:45:06 +00:00
GH-118095: Handle RETURN_GENERATOR
in tier 2 (GH-118180)
This commit is contained in:
parent
10bb90ed49
commit
f180b31e76
16 changed files with 143 additions and 81 deletions
|
@ -837,12 +837,7 @@ dummy_func(
|
|||
_PyFrame_StackPush(frame, retval);
|
||||
LOAD_SP();
|
||||
LOAD_IP(frame->return_offset);
|
||||
#if LLTRACE && TIER_ONE
|
||||
lltrace = maybe_lltrace_resume_frame(frame, &entry_frame, GLOBALS());
|
||||
if (lltrace < 0) {
|
||||
goto exit_unwind;
|
||||
}
|
||||
#endif
|
||||
LLTRACE_RESUME_FRAME();
|
||||
}
|
||||
|
||||
macro(RETURN_VALUE) =
|
||||
|
@ -3186,12 +3181,7 @@ dummy_func(
|
|||
tstate->py_recursion_remaining--;
|
||||
LOAD_SP();
|
||||
LOAD_IP(0);
|
||||
#if LLTRACE && TIER_ONE
|
||||
lltrace = maybe_lltrace_resume_frame(frame, &entry_frame, GLOBALS());
|
||||
if (lltrace < 0) {
|
||||
goto exit_unwind;
|
||||
}
|
||||
#endif
|
||||
LLTRACE_RESUME_FRAME();
|
||||
}
|
||||
|
||||
macro(CALL_BOUND_METHOD_EXACT_ARGS) =
|
||||
|
@ -3877,7 +3867,7 @@ dummy_func(
|
|||
}
|
||||
}
|
||||
|
||||
tier1 inst(RETURN_GENERATOR, (--)) {
|
||||
inst(RETURN_GENERATOR, (-- res)) {
|
||||
assert(PyFunction_Check(frame->f_funcobj));
|
||||
PyFunctionObject *func = (PyFunctionObject *)frame->f_funcobj;
|
||||
PyGenObject *gen = (PyGenObject *)_Py_MakeCoro(func);
|
||||
|
@ -3887,19 +3877,19 @@ dummy_func(
|
|||
assert(EMPTY());
|
||||
_PyFrame_SetStackPointer(frame, stack_pointer);
|
||||
_PyInterpreterFrame *gen_frame = (_PyInterpreterFrame *)gen->gi_iframe;
|
||||
frame->instr_ptr = next_instr;
|
||||
frame->instr_ptr++;
|
||||
_PyFrame_Copy(frame, gen_frame);
|
||||
assert(frame->frame_obj == NULL);
|
||||
gen->gi_frame_state = FRAME_CREATED;
|
||||
gen_frame->owner = FRAME_OWNED_BY_GENERATOR;
|
||||
_Py_LeaveRecursiveCallPy(tstate);
|
||||
assert(frame != &entry_frame);
|
||||
res = (PyObject *)gen;
|
||||
_PyInterpreterFrame *prev = frame->previous;
|
||||
_PyThreadState_PopFrame(tstate, frame);
|
||||
frame = tstate->current_frame = prev;
|
||||
_PyFrame_StackPush(frame, (PyObject *)gen);
|
||||
LOAD_IP(frame->return_offset);
|
||||
goto resume_frame;
|
||||
LOAD_SP();
|
||||
LLTRACE_RESUME_FRAME();
|
||||
}
|
||||
|
||||
inst(BUILD_SLICE, (start, stop, step if (oparg == 3) -- slice)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue