aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Python/executor_cases.c.h
diff options
context:
space:
mode:
Diffstat (limited to 'Python/executor_cases.c.h')
-rw-r--r--Python/executor_cases.c.h43
1 files changed, 31 insertions, 12 deletions
diff --git a/Python/executor_cases.c.h b/Python/executor_cases.c.h
index 7403d6fdaf0..1eb3da9b700 100644
--- a/Python/executor_cases.c.h
+++ b/Python/executor_cases.c.h
@@ -988,12 +988,7 @@
_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();
break;
}
@@ -3213,12 +3208,7 @@
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();
break;
}
@@ -3833,6 +3823,35 @@
break;
}
+ case _RETURN_GENERATOR: {
+ PyObject *res;
+ assert(PyFunction_Check(frame->f_funcobj));
+ PyFunctionObject *func = (PyFunctionObject *)frame->f_funcobj;
+ PyGenObject *gen = (PyGenObject *)_Py_MakeCoro(func);
+ if (gen == NULL) {
+ JUMP_TO_ERROR();
+ }
+ assert(EMPTY());
+ _PyFrame_SetStackPointer(frame, stack_pointer);
+ _PyInterpreterFrame *gen_frame = (_PyInterpreterFrame *)gen->gi_iframe;
+ 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);
+ res = (PyObject *)gen;
+ _PyInterpreterFrame *prev = frame->previous;
+ _PyThreadState_PopFrame(tstate, frame);
+ frame = tstate->current_frame = prev;
+ LOAD_IP(frame->return_offset);
+ LOAD_SP();
+ LLTRACE_RESUME_FRAME();
+ stack_pointer[0] = res;
+ stack_pointer += 1;
+ break;
+ }
+
case _BUILD_SLICE: {
PyObject *step = NULL;
PyObject *stop;