Update support for the module linking proposal

This commit updates the various tooling used by wasmtime which has new
updates to the module linking proposal. This is done primarily to sync
with WebAssembly/module-linking#26. The main change implemented here is
that wasmtime now supports creating instances from a set of values, nott
just from instantiating a module. Additionally subtyping handling of
modules with respect to imports is now properly handled by desugaring
two-level imports to imports of instances.

A number of small refactorings are included here as well, but most of
them are in accordance with the changes to `wasmparser` and the updated
binary format for module linking.
This commit is contained in:
Alex Crichton
2021-01-12 10:44:11 -08:00
parent 705af0ac41
commit 703762c49e
45 changed files with 1041 additions and 747 deletions

View File

@@ -1,8 +1,4 @@
use crate::vmcontext::{VMFunctionImport, VMGlobalImport, VMMemoryImport, VMTableImport};
use crate::InstanceHandle;
use std::any::Any;
use wasmtime_environ::entity::PrimaryMap;
use wasmtime_environ::wasm::{InstanceIndex, ModuleIndex};
/// Resolved import pointers.
///
@@ -28,15 +24,4 @@ pub struct Imports<'a> {
/// Resolved addresses for imported globals.
pub globals: &'a [VMGlobalImport],
/// Resolved imported instances.
pub instances: PrimaryMap<InstanceIndex, InstanceHandle>,
/// Resolved imported modules.
///
/// Note that `Box<Any>` here is chosen to allow the embedder of this crate
/// to pick an appropriate representation of what module type should be. For
/// example for the `wasmtime` crate it's `wasmtime::Module` but that's not
/// defined way down here in this low crate.
pub modules: PrimaryMap<ModuleIndex, Box<dyn Any>>,
}