GH-118095: Add tier 2 support for YIELD_VALUE (GH-118380)

This commit is contained in:
Mark Shannon 2024-04-30 11:33:13 +01:00 committed by GitHub
parent 0f797402bc
commit 5b05d452cd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 92 additions and 16 deletions

View file

@ -704,7 +704,7 @@ top: // Jump here after _PUSH_FRAME or likely branches
int nuops = expansion->nuops;
RESERVE(nuops + 1); /* One extra for exit */
int16_t last_op = expansion->uops[nuops-1].uop;
if (last_op == _POP_FRAME || last_op == _RETURN_GENERATOR) {
if (last_op == _POP_FRAME || last_op == _RETURN_GENERATOR || last_op == _YIELD_VALUE) {
// Check for trace stack underflow now:
// We can't bail e.g. in the middle of
// LOAD_CONST + _POP_FRAME.
@ -763,7 +763,7 @@ top: // Jump here after _PUSH_FRAME or likely branches
Py_FatalError("garbled expansion");
}
if (uop == _POP_FRAME || uop == _RETURN_GENERATOR) {
if (uop == _POP_FRAME || uop == _RETURN_GENERATOR || uop == _YIELD_VALUE) {
TRACE_STACK_POP();
/* Set the operand to the function or code object returned to,
* to assist optimization passes. (See _PUSH_FRAME below.)