Repository navigation
Conversation
An external compilation tier may wish to place slots in objects in certain ways to improve commonality or predictability of these slots, especially when they are derived from static analysis. This PR adds the necessary hooks to: - Permit creation of shapes that "permute" slots: assign slots in a different order than the walk up the shape tree. Places in the runtime that assume shape-walk order is the same as property order are modified. - Specify the shape to use when a property is added, overriding the default lookup or lazy shape creation. To support "permuted shapes", we add a new flag, `PermutedSlots`, and we track the shape *span* (max slot + 1) separately from the index of the bottommost shape. Both GC scans and new property additions in generic (not-hooked) paths need this span to choose the next slot to use. With NightMonkey's use of these hooks, all jit-tests (including tests that iterate over properties in added order) continue to pass; the order of shapes up the shape tree still represents the semantically-visible order in which properties were added. It is just the order of assigned slots that can differ. All changes are ifdef'd under JS_EXTERNAL_COMPILER_HOOKS; without it hasPermutedSlots() is false and the engine is unchanged.
An external tier might wish to specialize on a constant value for a global. Previously, there was no way for the external compiler to subscribe to / have access to a fuse associated with a global's value. This PR adds the necessary hook.
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 PR adds hooks to allow reordering object slots in order to allow an AOT compiler tier (e.g. NightMonkey) to more effectively predict object slots, staying on the fastpath more often.
Also includes two other small changes needed for NightMonkey (exposing a few more details on invariant fuses and permitting compiled code to access the external-compiler context pointer).