-
-
Notifications
You must be signed in to change notification settings - Fork 31.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GH-112354: END_FOR
instruction to only pop one value.
#114247
Conversation
…TOP instead of END_FOR. To support tier 2 side exits in loops.
EDIT: Never mind, it's needed for instrumentation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, never mind my premature commend about END_FOR/POP_TOP.
string = &_Py_ID(alias); | ||
assert(_PyUnicode_CheckConsistency(string, 1)); | ||
_PyUnicode_InternInPlace(interp, &string); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(The updates to this file (and a few other generated files) are spurious and will disappear after merging the latest main.)
The benchmarks show no performance impact. |
That's evidently not clear. The order of the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Oh, fun stuff. Windows compilation error. :-( |
Misc/NEWS.d/next/Core and Builtins/2024-01-17-05-09-32.gh-issue-112354.Run9ko.rst
Show resolved
Hide resolved
…GH-114247) * Compiler emits END_FOR; POP_TOP instead of END_FOR. To support tier 2 side exits in loops.
…GH-114247) * Compiler emits END_FOR; POP_TOP instead of END_FOR. To support tier 2 side exits in loops.
In order to support tier 2 side-exits from
FOR_ITER
variants, we need a target that has the same stack as the exhaustion guard.Currently we can either jump to the
END_FOR
, as we do for generators or the instruction afterwards, which we do forFOR_ITER
.In order to exit a guard we need a target in between those instructions, that pops the iterator, but not the value.
The compiler emits END_FOR; POP_TOP instead of END_FOR.
Previously:
Now: