mirror of
https://github.com/python/cpython.git
synced 2026-05-06 12:49:07 -04:00
gh-137030: Fix YIELD_VALUE bytecode assertion (#149184)
(cherry picked from commit 952784af47)
Co-authored-by: Mark Shannon <mark@hotpy.org>
This commit is contained in:
+6
-7
@@ -1388,13 +1388,12 @@ dummy_func(
|
||||
gen_frame->previous = NULL;
|
||||
/* We don't know which of these is relevant here, so keep them equal */
|
||||
assert(INLINE_CACHE_ENTRIES_SEND == INLINE_CACHE_ENTRIES_FOR_ITER);
|
||||
#if TIER_ONE
|
||||
assert(frame->instr_ptr->op.code == INSTRUMENTED_LINE ||
|
||||
frame->instr_ptr->op.code == INSTRUMENTED_INSTRUCTION ||
|
||||
_PyOpcode_Deopt[frame->instr_ptr->op.code] == SEND ||
|
||||
_PyOpcode_Deopt[frame->instr_ptr->op.code] == FOR_ITER ||
|
||||
_PyOpcode_Deopt[frame->instr_ptr->op.code] == INTERPRETER_EXIT ||
|
||||
_PyOpcode_Deopt[frame->instr_ptr->op.code] == ENTER_EXECUTOR);
|
||||
#if TIER_ONE && defined(Py_DEBUG)
|
||||
if (!PyStackRef_IsNone(frame->f_executable)) {
|
||||
int i = frame->instr_ptr - _PyFrame_GetBytecode(frame);
|
||||
int opcode = _Py_GetBaseCodeUnit(_PyFrame_GetCode(frame), i).op.code;
|
||||
assert(opcode == SEND || opcode == FOR_ITER);
|
||||
}
|
||||
#endif
|
||||
RELOAD_STACK();
|
||||
LOAD_IP(1 + INLINE_CACHE_ENTRIES_SEND);
|
||||
|
||||
Generated
+6
-7
@@ -1975,13 +1975,12 @@
|
||||
frame = tstate->current_frame = frame->previous;
|
||||
gen_frame->previous = NULL;
|
||||
assert(INLINE_CACHE_ENTRIES_SEND == INLINE_CACHE_ENTRIES_FOR_ITER);
|
||||
#if TIER_ONE
|
||||
assert(frame->instr_ptr->op.code == INSTRUMENTED_LINE ||
|
||||
frame->instr_ptr->op.code == INSTRUMENTED_INSTRUCTION ||
|
||||
_PyOpcode_Deopt[frame->instr_ptr->op.code] == SEND ||
|
||||
_PyOpcode_Deopt[frame->instr_ptr->op.code] == FOR_ITER ||
|
||||
_PyOpcode_Deopt[frame->instr_ptr->op.code] == INTERPRETER_EXIT ||
|
||||
_PyOpcode_Deopt[frame->instr_ptr->op.code] == ENTER_EXECUTOR);
|
||||
#if TIER_ONE && defined(Py_DEBUG)
|
||||
if (!PyStackRef_IsNone(frame->f_executable)) {
|
||||
int i = frame->instr_ptr - _PyFrame_GetBytecode(frame);
|
||||
int opcode = _Py_GetBaseCodeUnit(_PyFrame_GetCode(frame), i).op.code;
|
||||
assert(opcode == SEND || opcode == FOR_ITER);
|
||||
}
|
||||
#endif
|
||||
stack_pointer = _PyFrame_GetStackPointer(frame);
|
||||
LOAD_IP(1 + INLINE_CACHE_ENTRIES_SEND);
|
||||
|
||||
Generated
+14
-14
@@ -7617,6 +7617,7 @@
|
||||
frame->instr_ptr = next_instr;
|
||||
next_instr += 1;
|
||||
INSTRUCTION_STATS(INSTRUMENTED_YIELD_VALUE);
|
||||
opcode = INSTRUMENTED_YIELD_VALUE;
|
||||
_PyStackRef val;
|
||||
_PyStackRef retval;
|
||||
_PyStackRef value;
|
||||
@@ -7656,13 +7657,12 @@
|
||||
frame = tstate->current_frame = frame->previous;
|
||||
gen_frame->previous = NULL;
|
||||
assert(INLINE_CACHE_ENTRIES_SEND == INLINE_CACHE_ENTRIES_FOR_ITER);
|
||||
#if TIER_ONE
|
||||
assert(frame->instr_ptr->op.code == INSTRUMENTED_LINE ||
|
||||
frame->instr_ptr->op.code == INSTRUMENTED_INSTRUCTION ||
|
||||
_PyOpcode_Deopt[frame->instr_ptr->op.code] == SEND ||
|
||||
_PyOpcode_Deopt[frame->instr_ptr->op.code] == FOR_ITER ||
|
||||
_PyOpcode_Deopt[frame->instr_ptr->op.code] == INTERPRETER_EXIT ||
|
||||
_PyOpcode_Deopt[frame->instr_ptr->op.code] == ENTER_EXECUTOR);
|
||||
#if TIER_ONE && defined(Py_DEBUG)
|
||||
if (!PyStackRef_IsNone(frame->f_executable)) {
|
||||
int i = frame->instr_ptr - _PyFrame_GetBytecode(frame);
|
||||
int opcode = _Py_GetBaseCodeUnit(_PyFrame_GetCode(frame), i).op.code;
|
||||
assert(opcode == SEND || opcode == FOR_ITER);
|
||||
}
|
||||
#endif
|
||||
stack_pointer = _PyFrame_GetStackPointer(frame);
|
||||
LOAD_IP(1 + INLINE_CACHE_ENTRIES_SEND);
|
||||
@@ -12320,6 +12320,7 @@
|
||||
frame->instr_ptr = next_instr;
|
||||
next_instr += 1;
|
||||
INSTRUCTION_STATS(YIELD_VALUE);
|
||||
opcode = YIELD_VALUE;
|
||||
_PyStackRef retval;
|
||||
_PyStackRef value;
|
||||
retval = stack_pointer[-1];
|
||||
@@ -12340,13 +12341,12 @@
|
||||
frame = tstate->current_frame = frame->previous;
|
||||
gen_frame->previous = NULL;
|
||||
assert(INLINE_CACHE_ENTRIES_SEND == INLINE_CACHE_ENTRIES_FOR_ITER);
|
||||
#if TIER_ONE
|
||||
assert(frame->instr_ptr->op.code == INSTRUMENTED_LINE ||
|
||||
frame->instr_ptr->op.code == INSTRUMENTED_INSTRUCTION ||
|
||||
_PyOpcode_Deopt[frame->instr_ptr->op.code] == SEND ||
|
||||
_PyOpcode_Deopt[frame->instr_ptr->op.code] == FOR_ITER ||
|
||||
_PyOpcode_Deopt[frame->instr_ptr->op.code] == INTERPRETER_EXIT ||
|
||||
_PyOpcode_Deopt[frame->instr_ptr->op.code] == ENTER_EXECUTOR);
|
||||
#if TIER_ONE && defined(Py_DEBUG)
|
||||
if (!PyStackRef_IsNone(frame->f_executable)) {
|
||||
int i = frame->instr_ptr - _PyFrame_GetBytecode(frame);
|
||||
int opcode = _Py_GetBaseCodeUnit(_PyFrame_GetCode(frame), i).op.code;
|
||||
assert(opcode == SEND || opcode == FOR_ITER);
|
||||
}
|
||||
#endif
|
||||
stack_pointer = _PyFrame_GetStackPointer(frame);
|
||||
LOAD_IP(1 + INLINE_CACHE_ENTRIES_SEND);
|
||||
|
||||
Reference in New Issue
Block a user