winch: Improve frame handling#9708
Merged
saulecabrera merged 1 commit intobytecodealliance:mainfrom Dec 4, 2024
Merged
Conversation
Subscribe to Label ActionDetailsThis issue or pull request has been labeled: "winch"Thus the following users have been cc'd because of the following labels:
To subscribe or unsubscribe from this label, edit the |
abrown
approved these changes
Dec 4, 2024
Member
abrown
left a comment
There was a problem hiding this comment.
Makes sense; sorry for missing this review earlier.
This commit addresses issues identified while working on issue bytecodealliance#8091. It improves the frame handling in Winch to prevent subtle bugs and enhance the robustness of the code generation process. Previously, there was no clear mechanism to verify when the frame was fully set up and safe to access the local slots allocated for register arguments, including the special slots used for the `VMContext`. As a result, it was possible to inadvertently read from uninitialized memory if calls were made before the frame was properly set up and sealed. This commit introduces two main changes with the objective to help reduce the risk of introducing bugs related to the above: * A `CodeGenPhase` trait, used via the type state pattern to clearly gate the operations allowed during each phase of the code generation process. * Improve the semantics of locals, by clearly separating the notion of Wasm locals and special locals used by the compiler. This specialization allows a more accurate representation of the semantics of Wasm locals and their index space.
e8c88df to
9d90033
Compare
Member
Author
|
Thanks for the review @abrown -- and no worries! |
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 commit addresses issues identified while working on issue #8091. It improves the frame handling in Winch to prevent subtle bugs and enhance the robustness of the code generation process.
Previously, there was no clear mechanism to verify when the frame was fully set up and safe to access the local slots allocated for register arguments, including the special slots used for the
VMContext. As a result, it was possible to inadvertently read from uninitialized memory if calls were made before the frame was properly set up and sealed.This commit introduces two main changes with the objective to help reduce the risk of introducing bugs related to the above:
A
CodeGenPhasetrait, used via the type state pattern to clearly gate the operations allowed during each phase of the code generation process.Improve the semantics of locals, by clearly separating the notion of Wasm locals and special locals used by the compiler. This specialization allows a more accurate representation of the semantics of Wasm locals and their index space.