Skip to content

Commit

Permalink
Refactor away the Instantiator type in Wasmtime
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
alexcrichton committed Apr 4, 2022
1 parent e6f110d commit c146574
Show file tree
Hide file tree
Showing 4 changed files with 287 additions and 302 deletions.
6 changes: 6 additions & 0 deletions RELEASES.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ Unreleased.
* Support for epoch-based interruption has been added to the C API.
[#3925](https://github.com/bytecodealliance/wasmtime/pull/3925)

### Fixed

* Using `InstancePre::instantiate` or `Linker::instantiate` will now panic as
intended when used with an async-configured `Store`.
[#TODO](https://github.com/bytecodealliance/wasmtime/pull/TODO)

### Removed

* Support for `Config::interruptable` and `InterruptHandle` has been removed
Expand Down
Loading

0 comments on commit c146574

Please sign in to comment.