Path: blob/main/crates/environ/src/component/compiler.rs
3076 views
use crate::component::{ComponentTranslation, ComponentTypesBuilder, UnsafeIntrinsic};1use crate::error::Result;2use crate::{Abi, CompiledFunctionBody, FuncKey, Tunables};34/// Compilation support necessary for components.5pub trait ComponentCompiler: Send + Sync {6/// Compiles the pieces necessary to create a `VMFuncRef` for the7/// `trampoline` specified.8///9/// Each trampoline is a member of the `Trampoline` enumeration and has a10/// unique purpose and is translated differently. See the implementation of11/// this trait for Cranelift for more information.12fn compile_trampoline(13&self,14component: &ComponentTranslation,15types: &ComponentTypesBuilder,16key: FuncKey,17abi: Abi,18tunables: &Tunables,19symbol: &str,20) -> Result<CompiledFunctionBody>;2122/// Compile the given Wasmtime intrinsic.23fn compile_intrinsic(24&self,25tunables: &Tunables,26component: &ComponentTranslation,27types: &ComponentTypesBuilder,28intrinsic: UnsafeIntrinsic,29abi: Abi,30symbol: &str,31) -> Result<CompiledFunctionBody>;32}333435