[mypyc] Remove symbol table and value index table from Environment - #9768
Merged
Conversation
Also refactor Register.__init__ and temp register generation.
Collaborator
Author
|
Hopefully #9782 will help with the build failures. |
Collaborator
|
Thanks for fixing the build! I took a quick and it looks great! I'll do a full review tomorrow |
Collaborator
Author
|
I'm going to merge this now since I have a bunch of other PRs I'm working on that depend on this. Code review after the fact would still be appreciated, and I will create a follow-up PR to address feedback. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Instead of maintaining symbol tables in
Environment, they are maintained inIRBuilderand discarded after they are no longer needed.I also removed the value index table (
indexes) fromEnvironment. It wasmostly used for three purposes:
These use cases are now handled differently:
all_values, that find values in IR byiterating over it and collecting them.
FuncIRnow stores argument registers explicitly.(
make_value_ordering).There are three main reasons why I think that this PR makes sense. First, it
simplifies the IR and makes things easier to understand. Second, transforming
IR is easier and less error-prone, as the symbol tables and index dictionaries
no longer need to be kept in sync with the IR. Third, this makes it easy to get
rid of
Environmentaltogether (in a follow-up PR).A nice side effect is that we can now just create a
Registerinstance directlyand start using it, instead of having to call
alloc_temp().Some tests had to be updated, since the registers are now numbered differently
in some cases. Arguably, it's now more logical and predictable. There won't be
gaps in the numbering.
Work on mypyc/mypyc#781.