Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
bytecodealliance
GitHub Repository: bytecodealliance/wasmtime
Path: blob/main/crates/environ/src/component/compiler.rs
3076 views
1
use crate::component::{ComponentTranslation, ComponentTypesBuilder, UnsafeIntrinsic};
2
use crate::error::Result;
3
use crate::{Abi, CompiledFunctionBody, FuncKey, Tunables};
4
5
/// Compilation support necessary for components.
6
pub 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
key: FuncKey,
18
abi: Abi,
19
tunables: &Tunables,
20
symbol: &str,
21
) -> Result<CompiledFunctionBody>;
22
23
/// Compile the given Wasmtime intrinsic.
24
fn compile_intrinsic(
25
&self,
26
tunables: &Tunables,
27
component: &ComponentTranslation,
28
types: &ComponentTypesBuilder,
29
intrinsic: UnsafeIntrinsic,
30
abi: Abi,
31
symbol: &str,
32
) -> Result<CompiledFunctionBody>;
33
}
34
35