Stream: git-wasmtime

Topic: wasmtime / PR #2102 wasmtime: Refactor how imports are re...


view this post on Zulip Wasmtime GitHub notifications bot (Aug 05 2020 at 21:46):

alexcrichton opened PR #2102 from refactor-import-resolution to main:

This commit removes all import resolution handling from the
wasmtime-jit crate, instead moving the logic to the wasmtime crate.
Previously wasmtime-jit had a generic Resolver trait and would do
all the import type matching itself, but with the upcoming
module-linking implementation this is going to get much trickier.

The goal of this commit is to centralize all meaty "preparation" logic
for instantiation into one location, probably the wasmtime crate
itself. Instantiation will soon involve recursive instantiation and
management of alias definitions as well. Having everything in one
location, especially with access to Store so we can persist
instances for safety, will be quite convenient.

Additionally the Resolver trait isn't really necessary any more since
imports are, at the lowest level, provided as a list rather than a map
of some kind. More generic resolution functionality is provided via
Linker or user layers on top of Instance::new itself. This makes
matching up provided items to expected imports much easier as well.

Overall this is largely just moving code around, but most of the code
in the previous resolve_imports phase can be deleted since a lot of it
is handled by surrounding pieces of wasmtime as well.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 07 2020 at 20:34):

sunfishcode submitted PR Review.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 07 2020 at 20:34):

sunfishcode submitted PR Review.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 07 2020 at 20:34):

sunfishcode created PR Review Comment:

A subtle consequence of switching from BoxedSlice/PrimaryMap/etc. to plain &[] is that BoxedSlice/PrimaryMap enforce the invariant that they only be indexed with FuncIndex indices. It looks like we don't directly index into the slices here, so that seems ok, but could you add comments here mentioning what the index space for these slices is?

view this post on Zulip Wasmtime GitHub notifications bot (Aug 07 2020 at 20:41):

alexcrichton updated PR #2102 from refactor-import-resolution to main:

This commit removes all import resolution handling from the
wasmtime-jit crate, instead moving the logic to the wasmtime crate.
Previously wasmtime-jit had a generic Resolver trait and would do
all the import type matching itself, but with the upcoming
module-linking implementation this is going to get much trickier.

The goal of this commit is to centralize all meaty "preparation" logic
for instantiation into one location, probably the wasmtime crate
itself. Instantiation will soon involve recursive instantiation and
management of alias definitions as well. Having everything in one
location, especially with access to Store so we can persist
instances for safety, will be quite convenient.

Additionally the Resolver trait isn't really necessary any more since
imports are, at the lowest level, provided as a list rather than a map
of some kind. More generic resolution functionality is provided via
Linker or user layers on top of Instance::new itself. This makes
matching up provided items to expected imports much easier as well.

Overall this is largely just moving code around, but most of the code
in the previous resolve_imports phase can be deleted since a lot of it
is handled by surrounding pieces of wasmtime as well.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 07 2020 at 21:38):

alexcrichton merged PR #2102.


Last updated: Nov 22 2024 at 17:03 UTC