Merged
Conversation
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.
This pull request refactors and optimizes the binding and dominator analysis code in the compiler. The main themes are improved memory efficiency for symbol binding, more robust and scalable dominator computation, and enhanced API flexibility for binding table initialization. The changes include splitting local symbol storage for single/multi-name declarations, adding size hints for binding tables, memoizing captured symbols, and updating dominator computation to use slices and handle edge cases more safely.
Binding Table and Symbol Storage Improvements:
BindingTableintolocalSymbolSingle(for single-name locals) andlocalSymbolsMulti(for multi-name locals), reducing memory allocations and simplifying access. Added new methods for setting, querying, and retrieving local symbols. [1] [2]NewBindingTableWithHint) and binder creation (NewBinderWithDeclHint), allowing more efficient map allocation for large functions. [1] [2]API and Internal Consistency Enhancements:
localSymbolsmap with the new split maps throughout binder logic, updating all relevant methods and usages. [1] [2] [3] [4] [5]Captured Symbol Memoization:
BindingTable, improving performance for repeated queries. [1] [2] [3]Dominator Analysis Refactoring:
sortwithslices.SortFuncfor deterministic sorting of dominator tree children, and introduced new types for dense dominator info. [1] [2] [3]These changes collectively make the binding and analysis phases more efficient, scalable, and maintainable (1200% perf imporovement).