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
[compiler] simplify PruneDeadFields #14509
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. Join @patrick-schultz and the rest of your teammates on Graphite |
bf520b0
to
b6f50d6
Compare
b6f50d6
to
cd3e539
Compare
cd3e539
to
7b26b14
Compare
7b26b14
to
00f9063
Compare
00f9063
to
4a018f5
Compare
4a018f5
to
cf8e1e5
Compare
cf8e1e5
to
5611ec9
Compare
5611ec9
to
9ecd8ab
Compare
9acf643
to
578e1c7
Compare
e84931a
to
12383d2
Compare
578e1c7
to
cde4d74
Compare
12383d2
to
c8b6f3b
Compare
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.
rebase plz
c8b6f3b
to
0cd012c
Compare
cde4d74
to
4a4616c
Compare
0cd012c
to
1aead6f
Compare
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.
brilliant
1aead6f
to
804a488
Compare
4a4616c
to
c743e5a
Compare
c743e5a
to
e706b0e
Compare
7fc916b
to
fcffa37
Compare
e706b0e
to
4ea526f
Compare
cb112bb
to
60955f0
Compare
60955f0
to
edf40c1
Compare
Makes some further progress on simplifying the
PruneDeadFields
pass, with the primary goal of decoupling it from the details of the binding structure.The primary change is to
memoizeValueIR
. Before, it passed in only the requested type of the node, and returned and environment containing all free variables and their requested types. Any bound variables would then need to be removed, and the environments of all children then merged. This low-level manipulation of environments made it closely tied to the binding structure, essentially redundantly encoding everything inBinds.scala
.Now we pass an environment down into the children, which maps variables to a mutable state tracking the requested type. Each
Ref
node unions the requested type at the reference with the state in the environment. This lets us use the general environment infrastructure.I didn't do an assertion directly comparing the old and new implementations, as I've done with some other pass rewrites. But
PruneDeadFields
has pretty good test coverage.