- Notifications
You must be signed in to change notification settings - Fork 817
Make the J2clOpts pass more effective when there are transitive dependencies in constant intialization. #6571
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
…ant hoisted from in "optimize-j2cl" pass.
…tive propagating getters that recurse through the hierarchy.
Let's put some detailed description of what and why we are doing for future reference. |
I think all the comments were addressed. Let me know if there is anything else. |
re. tests: It s kind of difficult to check all the coverage but do you mind double checking we have have coverage for
|
test/lit/passes/j2cl-inline.wast Outdated
@@ -1,8 +1,8 @@ | |||
;; NOTE: Assertions have been generated by update_lit_checks.py --all-items and should not be edited. | |||
| |||
;; NOTE: In real world example no-inline would use _<once>_ but there is escaping problem in a multi-platform |
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.
If escaping is fixed, this comment is now stale.
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.
Updated j2cl-inline.wast to show that without the inlining it has the same result as before.
LGTM minus the comments. (one of them ended up being hidden behind resolved comments) |
Both of those are already reflected in j2cl.wat. The module at line 156 shows a transitive inline and hoisting that is 3 deep. |
Sorry post an LGTM earlier but didn't notice I can mark it as approved. Thanks. |
Constants that need to be hoisted sometimes are initialized by calling getters of other constants that need to be hoisted. These getters are non-trivial, e.g.
and can only be simplified after the constants they initialize are hoisted. After the constant is hoisted the getter can be inlined and constants that depend on it for their initialization can now be hoisted.
Before this pass, inilining would happen after the pass was run by a subsquent run of the inliner (likely as part of
-O3
), requiring as many runs of this pass, interleaved with the inliner, as the depth in the call sequence.By having a simpler inliner run as part of the loop in this pass, the pass becomes more effective and more independent of the call depths.