wasmtime_environ/component/compiler.rs
1use crate::component::{AllCallFunc, ComponentTranslation, ComponentTypesBuilder, TrampolineIndex};
2use crate::{CompiledFunctionBody, Tunables};
3use anyhow::Result;
4
5/// Compilation support necessary for components.
6pub trait ComponentCompiler: Send + Sync {
7 /// Compiles the pieces necessary to create a `VMFuncRef` for the
8 /// `trampoline` specified.
9 ///
10 /// Each trampoline is a member of the `Trampoline` enumeration and has a
11 /// unique purpose and is translated differently. See the implementation of
12 /// this trait for Cranelift for more information.
13 fn compile_trampoline(
14 &self,
15 component: &ComponentTranslation,
16 types: &ComponentTypesBuilder,
17 trampoline: TrampolineIndex,
18 tunables: &Tunables,
19 ) -> Result<AllCallFunc<CompiledFunctionBody>>;
20}