Stream: git-wasmtime

Topic: wasmtime / PR #3972 Refactor away the `Instantiator` type...


view this post on Zulip Wasmtime GitHub notifications bot (Mar 30 2022 at 18:59):

alexcrichton opened PR #3972 from refactor-instantiator to main:

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.

<!--

Please ensure that the following steps are all taken care of before submitting
the PR.

Please ensure all communication adheres to the code of conduct.
-->

view this post on Zulip Wasmtime GitHub notifications bot (Mar 30 2022 at 19:13):

alexcrichton updated PR #3972 from refactor-instantiator to main.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 04 2022 at 14:49):

alexcrichton updated PR #3972 from refactor-instantiator to main.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 04 2022 at 17:57):

peterhuene submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 04 2022 at 17:57):

peterhuene submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 04 2022 at 17:57):

peterhuene created PR review comment:

Nit (for readability):

            let exports = vec![None; compiled_module.module().exports.len()];

view this post on Zulip Wasmtime GitHub notifications bot (Apr 04 2022 at 17:57):

peterhuene created PR review comment:

            "must use async instantiation when async support is enabled",

view this post on Zulip Wasmtime GitHub notifications bot (Apr 04 2022 at 17:57):

peterhuene created PR review comment:

            "must use sync instantiation when async support is not enabled",

view this post on Zulip Wasmtime GitHub notifications bot (Apr 05 2022 at 14:50):

alexcrichton updated PR #3972 from refactor-instantiator to main.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 05 2022 at 15:35):

alexcrichton merged PR #3972.


Last updated: Nov 22 2024 at 16:03 UTC