mirror of
https://github.com/python/cpython.git
synced 2025-08-23 18:24:46 +00:00
GH-120619: Clean up RETURN_VALUE
instruction (GH-120624)
* Rename _POP_FRAME to _RETURN_VALUE as it returns a value as well as popping a frame. * Remove remaining _POP_FRAMEs
This commit is contained in:
parent
79e09e60d8
commit
274f844830
11 changed files with 67 additions and 61 deletions
12
Python/generated_cases.c.h
generated
12
Python/generated_cases.c.h
generated
|
@ -5202,12 +5202,13 @@
|
|||
INSTRUCTION_STATS(RETURN_CONST);
|
||||
PyObject *value;
|
||||
PyObject *retval;
|
||||
PyObject *res;
|
||||
// _LOAD_CONST
|
||||
{
|
||||
value = GETITEM(FRAME_CO_CONSTS, oparg);
|
||||
Py_INCREF(value);
|
||||
}
|
||||
// _POP_FRAME
|
||||
// _RETURN_VALUE
|
||||
retval = value;
|
||||
{
|
||||
#if TIER_ONE
|
||||
|
@ -5220,11 +5221,13 @@
|
|||
_PyInterpreterFrame *dying = frame;
|
||||
frame = tstate->current_frame = dying->previous;
|
||||
_PyEval_FrameClearAndPop(tstate, dying);
|
||||
_PyFrame_StackPush(frame, retval);
|
||||
LOAD_SP();
|
||||
LOAD_IP(frame->return_offset);
|
||||
res = retval;
|
||||
LLTRACE_RESUME_FRAME();
|
||||
}
|
||||
stack_pointer[0] = res;
|
||||
stack_pointer += 1;
|
||||
DISPATCH();
|
||||
}
|
||||
|
||||
|
@ -5265,6 +5268,7 @@
|
|||
next_instr += 1;
|
||||
INSTRUCTION_STATS(RETURN_VALUE);
|
||||
PyObject *retval;
|
||||
PyObject *res;
|
||||
retval = stack_pointer[-1];
|
||||
#if TIER_ONE
|
||||
assert(frame != &entry_frame);
|
||||
|
@ -5277,10 +5281,12 @@
|
|||
_PyInterpreterFrame *dying = frame;
|
||||
frame = tstate->current_frame = dying->previous;
|
||||
_PyEval_FrameClearAndPop(tstate, dying);
|
||||
_PyFrame_StackPush(frame, retval);
|
||||
LOAD_SP();
|
||||
LOAD_IP(frame->return_offset);
|
||||
res = retval;
|
||||
LLTRACE_RESUME_FRAME();
|
||||
stack_pointer[0] = res;
|
||||
stack_pointer += 1;
|
||||
DISPATCH();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue