alexcrichton opened PR #2102 from refactor-import-resolution to main:
This commit removes all import resolution handling from the
wasmtime-jitcrate, instead moving the logic to thewasmtimecrate.
Previouslywasmtime-jithad a genericResolvertrait 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 thewasmtimecrate
itself. Instantiation will soon involve recursive instantiation and
management of alias definitions as well. Having everything in one
location, especially with access toStoreso we can persist
instances for safety, will be quite convenient.Additionally the
Resolvertrait 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
Linkeror user layers on top ofInstance::newitself. 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_importsphase can be deleted since a lot of it
is handled by surrounding pieces ofwasmtimeas 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/PrimaryMapenforce the invariant that they only be indexed withFuncIndexindices. 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-jitcrate, instead moving the logic to thewasmtimecrate.
Previouslywasmtime-jithad a genericResolvertrait 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 thewasmtimecrate
itself. Instantiation will soon involve recursive instantiation and
management of alias definitions as well. Having everything in one
location, especially with access toStoreso we can persist
instances for safety, will be quite convenient.Additionally the
Resolvertrait 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
Linkeror user layers on top ofInstance::newitself. 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_importsphase can be deleted since a lot of it
is handled by surrounding pieces ofwasmtimeas well.
alexcrichton merged PR #2102.
Last updated: Dec 06 2025 at 06:05 UTC