Stack switching: stack_chain field in VMContext #10265
Merged
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 is part of a series that adds support for the Wasm stack switching proposal. The explainer document for the proposal is here. There's a tracking issue for the overall progress: #10248
This particular PR does one small change: It adds a single pointer-sized field, called
stack_chain
to the fixed-width part ofVMContext
.Note that this PR only adds the field in the layout of the
VMContext
, but does not actually read or write any data in that field. The reason for doing this change in a separate PR is simply that the change to the layout of theVMContext
requires updates to 700 disas tests.In subsequent PRs, the field is used as follows: In the future, the
StoreOpaque
will contain astack_chain
field as well, which indicates the currently running continuation, and logically represents a linked list continuations.The
stack_chain
field in theVMContext
added in this PR will merely be a pointer to that stack chain in theStoreOpaque
. This is due to the fact that the stack chain is shared by all instances running inside a store, and we need access to the stack chain in theStoreOpaque
from Cranelift-generated code. This is similar to how theVMRuntimeLimits
are accessed.