wasmtime component: get InstancePre from Instance #10621
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.
wasmtime::component::InstancePre
gets a new field to hold an arc to the imported resources tableresource_types: Arc<PrimaryMap<ResourceIndex, ResourceType>>
. This information is available at the two spots where anInstancePre
is constructed (one of which is new, below), so theres no additional computation required here, just a clone of the arc.InstancePre
gets a new methodinstance_type(&self) -> InstanceType<'_>
. TheInstanceType
is used for typechecking. The whole purpose of this PR is so that typechecking can occur from either an Instance or InstancePre, and without taking a borrow into a Store, for the sake of wasmtime-wit-bindgen: Typecheck exports at {Foo}Indices construction #10610.wasmtime::component::Instance
gets a new methodinstance_pre<T>(&self, store: &impl AsContext<Data = T>) -> InstancePre<T>
. All of the information required to construct theInstancePre
is already found in the Store at the Instances's index.