Merged
Conversation
Functions will be generated in topological order.
Contributor
Author
|
Sorting was introduced here |
mshinwell
approved these changes
Feb 14, 2024
This was referenced Mar 7, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Temporarily disable sorting of function symbols by debug info. Emit function symbols in topological order.
Currently, the layout of function symbols is determined by their debug info, so that functions in the final assembly file appear in the same order as in the source file. This is convenient for debugging and stable layout. However, it can makes some backend passes overly conservative. Currently, this affects only
checkmachandpollingthat rely on "future" function names. For example,zero_alloccheck fails on a common code patternraise_s [%message ...].results in the following code after ppx :
and
raise_invalid_indexis emitted beforeppx_sexp_messageeven though they are not mutually recursive.A proper fix is more involved. The backend translates functions in layout order, fully translating each function from
Cmmall the way toassemblybefore moving on to the next function. We can change the backend to translate the functions in topological order and then emit them in source order. This means holding on toMach.fundecllonger and careful handling any mutable state. Separately, an improvenent to zero_alloc analysis to handle mutually recursive functions will also fix this.