Add trampoline compilation support for lowered imports (#4206)

* Add trampoline compilation support for lowered imports

This commit adds support to the component model implementation for
compiling trampolines suitable for calling host imports. Currently this
is purely just the compilation side of things, modifying the
wasmtime-cranelift crate and additionally filling out a new
`VMComponentOffsets` type (similar to `VMOffsets`). The actual creation
of a `VMComponentContext` is still not performed and will be a
subsequent PR.

Internally though some tests are actually possible with this where we at
least assert that compilation of a component and creation of everything
in-memory doesn't panic or trip any assertions, so some tests are added
here for that as well.

* Fix some test errors
This commit is contained in:
Alex Crichton
2022-06-03 10:01:42 -05:00
committed by GitHub
parent b49c5c878e
commit 3ed6fae7b3
17 changed files with 748 additions and 58 deletions

View File

@@ -232,6 +232,13 @@ pub trait Compiler: Send + Sync {
/// Same as [`Compiler::flags`], but ISA-specific (a cranelift-ism)
fn isa_flags(&self) -> BTreeMap<String, FlagValue>;
/// Returns a suitable compiler usable for component-related compliations.
///
/// Note that the `ComponentCompiler` trait can also be implemented for
/// `Self` in which case this function would simply return `self`.
#[cfg(feature = "component-model")]
fn component_compiler(&self) -> &dyn crate::component::ComponentCompiler;
}
/// Value of a configured setting for a [`Compiler`]