-
-
Notifications
You must be signed in to change notification settings - Fork 30.2k
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-120619: Tier 2 partial evaluator foundations #124910
base: main
Are you sure you want to change the base?
Conversation
This reverts commit 4361821.
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.
Great work, Ken!
I don't understand why any of bytecodes.c, optimizer_analysis.c, optimizer_bytecodes.c, optimizer_symbols.c, or the structs in pycore_optimizer.h need to change. What does Rather than removing the |
I reused the infra for the old pass to build the new one. Though I can separate them totally for separation of concerns. Let me know what you think.
It means potentially static in the context of binding-time analysis. It's more liberal than |
@markshannon I split it out into its own files, and own symbols, so it doesn't share the type information too. This simplifies the lattice quite a bit. |
This PR sets up a tier 2 partial evaluation pass' foundations. It does the following:
As a litmus test, it does simple dead store elimination by tracking locals. For example, the code
x = x
is now optimized to a nop.This is different than the previous PR at #123652. The main difference is that we create the residual in-place. By "looking backwards" at the originating instruction and marking that as virtual/non-virtual. If you want a visualization of how this will work. See Mark's talk at EuroPython 2023 here https://youtu.be/dgrtgtT-UXM?t=1198.
Also up for discussion: the generator for the partial evaluator is exactly the same as the specializer. Should I just remove it?