Warn on functions that may be too big for some VMs #1246
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.
Background: WebAssembly/design#1138 - browser vendors are starting to apply a new limit on function body size, to 128K. This was apparently agreed upon before, but not applied. There is also a movement to a larger constant than 128K, but at least Edge will have the 128K limit for several months (and Chrome just started to apply it on Canary, but might get the new larger constant soon, not clear).
So this PR emits a warning when a function body is 128K or more. The warning might be enough for some users, as they may be able to disable inlining or other optimizations, if they were the cause of the large function. However, it's possible that won't always be an option, either because it's not simple to tweak those optimizations without downsides, or because the big function is the output of a code generator.
This PR also creates a "table of contents" for each function, which may be useful for other things soon.