Refactor away the Instantiator type in Wasmtime#3972
Merged
alexcrichton merged 2 commits intoApr 5, 2022
Conversation
Subscribe to Label Actioncc @peterhuene DetailsThis issue or pull request has been labeled: "wasmtime:api", "wasmtime:docs"Thus the following users have been cc'd because of the following labels:
To subscribe or unsubscribe from this label, edit the |
This internal type in Wasmtime was primarily used for the module linking proposal to handle instantiation of many instances and refactor out the sync and async parts to minimize duplication. With the removal of the module linking proposal, however, this type isn't really necessary any longer. In working to implement the component model proposal I was looking already to refactor this and I figured it'd be good to land that ahead of time on `main` separate of other refactorings. This commit removes the `Instantiator` type in the `instance` module. The type was already private to Wasmtime so this shouldn't have any impact on consumers. This allows simplifying various code paths to avoid another abstraction. The meat of instantiation is moved to `Instance::new_raw` which should be reusable for the component model as well. One bug is actually fixed in this commit as well where `Linker::instantiate` and `InstancePre::instantiate` failed to check that async support was disabled on a store. This means that they could have led to a panic if used with an async store and a start function called an async import (or an async resource limiter yielded). A few tests were updated with this.
2700975 to
c146574
Compare
peterhuene
approved these changes
Apr 4, 2022
Member
peterhuene
left a comment
There was a problem hiding this comment.
Just some nits. Looks good!
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 internal type in Wasmtime was primarily used for the module linking
proposal to handle instantiation of many instances and refactor out the
sync and async parts to minimize duplication. With the removal of the
module linking proposal, however, this type isn't really necessary any
longer. In working to implement the component model proposal I was
looking already to refactor this and I figured it'd be good to land that
ahead of time on
mainseparate of other refactorings.This commit removes the
Instantiatortype in theinstancemodule.The type was already private to Wasmtime so this shouldn't have any
impact on consumers. This allows simplifying various code paths to avoid
another abstraction. The meat of instantiation is moved to
Instance::new_rawwhich should be reusable for the component model aswell.
One bug is actually fixed in this commit as well where
Linker::instantiateandInstancePre::instantiatefailed to checkthat async support was disabled on a store. This means that they could
have led to a panic if used with an async store and a start function
called an async import (or an async resource limiter yielded). A few
tests were updated with this.