-
Notifications
You must be signed in to change notification settings - Fork 787
Improve inlining "heavyweight" mode by excluding call sites #3085
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
Improve inlining "heavyweight" mode by excluding call sites #3085
Conversation
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.
More generally, at the high level I think we need to decide on what the API should be here. And have specific reasons for why we think calls vs loops etc. matter.
As I said earlier, the existing logic was basically motivated by the fact that code without loops and without calls will run exactly once at most and as no surprising additional work happening. So it's fairly straightforward to estimate how much work will be done there. And specifically, to see that the work is likely very small, hence the inlining can help by removing call overhead to there.
So starting with a clear design about what you want to achieve here would be a good starting point I think @MaxGraey
As far as I understood the motivation for this change was that we are currently seeing Binaryen hanging forever when we try to compile the AssemblyScript compiler with |
inlining functions with calls should be avoided in any case, we could only enable / disable funcs with loops so current approach I think is fine) |
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 PR remove
lightweight
property fromFunctionInfo
and use two booleanshasCalls
andhasLoops
instead of it. It allows exclude functions with call sites. Otherwise potentially recursive functions will explode compilation time or/and code size.Also rename
allowHeavyweight
toallowFunctionsWithLoops
.