-
Notifications
You must be signed in to change notification settings - Fork 816
[Custom Descriptors] Optimize descriptors in Unsubtyping #7929
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
Conversation
With the upcoming stricter validation rules for descriptor types, we can no longer use the placeholder describee trick in GlobalTypeOptimization, so its ability to optimize out unneeded descriptors will be significantly restricted. Because of the increasing coupling between the validation for subtyping and descriptor relationships, it makes most sense to optimize both at the same time in Unsubtyping. Update Unsubtyping to start the analysis assuming no descriptors are necessary, then add them in as it discovers that they are indeed necessary either to preserve behavior or validitiy. Discovering new required descriptors can imply that new subtypings are necessary and vice versa.
All comments addressed except the one about the side effects of null descriptors in allocations. |
Ok, now the traps are properly preserved. Will fuzz overnight. |
) | ||
) | ||
|
||
;; No fixup is necessary if the descriptor cannot be null in the first place. |
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.
Perhaps add a test for a non-nullable descriptor in a global?
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.
This is tested toward the bottom with the comment ;; When we optimize out descriptors, we may need to update allocations.
.
;; Test the case where a newly discovered descriptor has a supertype that now | ||
;; needs to be a descriptor as well. Set this up: | ||
;; | ||
;; top top.desc |
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.
Is there intentionally no arrow from top to top.desc?
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.
Yes, the arrows in this diagram are only the initial edges required by the code.
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.
Maybe that can be clarified? I was reading all these diagrams assuming they describe the situation in the wasm, and the wasm itself does contain a descriptor relationship there. I think that is what you've done elsewhere?
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.
Maybe a good way to do this is to graph the initial wasm, and then put this second graph after it?
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 "described by" arrows in the other diagrams are inherited from before this change, when we never removed descriptors, so they were irrelevant to the test cases. I'll update them to include only the initially required descriptor edges, just like they include only the initially required subtype edges.
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.
lgtm otherwise
With the upcoming stricter validation rules for descriptor types, we can
no longer use the placeholder describee trick in GlobalTypeOptimization,
so its ability to optimize out unneeded descriptors will be
significantly restricted. Because of the increasing coupling between the
validation for subtyping and descriptor relationships, it makes most
sense to optimize both at the same time in Unsubtyping.
Update Unsubtyping to start the analysis assuming no descriptors are
necessary, then add them in as it discovers that they are indeed
necessary either to preserve behavior or validitiy. Discovering new
required descriptors can imply that new subtypings are necessary and
vice versa.