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 thewasmtime
crate.
Previouslywasmtime-jit
had a genericResolver
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 thewasmtime
crate
itself. Instantiation will soon involve recursive instantiation and
management of alias definitions as well. Having everything in one
location, especially with access toStore
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 ofInstance::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 previousresolve_imports
phase can be deleted since a lot of it
is handled by surrounding pieces ofwasmtime
as well.
sunfishcode submitted PR Review.
sunfishcode submitted PR Review.
sunfishcode created PR Review Comment:
A subtle consequence of switching from
BoxedSlice
/PrimaryMap
/etc. to plain&[]
is thatBoxedSlice
/PrimaryMap
enforce the invariant that they only be indexed withFuncIndex
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?
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 thewasmtime
crate.
Previouslywasmtime-jit
had a genericResolver
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 thewasmtime
crate
itself. Instantiation will soon involve recursive instantiation and
management of alias definitions as well. Having everything in one
location, especially with access toStore
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 ofInstance::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 previousresolve_imports
phase can be deleted since a lot of it
is handled by surrounding pieces ofwasmtime
as well.
alexcrichton merged PR #2102.
Last updated: Dec 23 2024 at 12:05 UTC