pub trait NativeTier: Send + Sync {
// Required method
fn compile_function(
&self,
code: &[Op],
entry_pc: usize,
constants: &[Constant],
param_count: u16,
register_count: u16,
self_fi: u16,
param_kinds: &[Option<ParamKind>],
ret_kind: Option<SlotKind>,
ctx: &NativeCtx,
callees: &[CalleeSig],
) -> Option<Box<dyn NativeFn>>;
// Provided method
fn compile_region(
&self,
code: &[Op],
head_pc: usize,
exit_pc: usize,
constants: &[Constant],
register_count: u16,
named: &[bool],
observed: &[ObservedKind],
ctx: &NativeCtx,
callees: &[CalleeSig],
) -> Option<Box<dyn RegionFn>> { ... }
}Expand description
A backend that can try to compile one VM function to native code.
Required Methods§
Sourcefn compile_function(
&self,
code: &[Op],
entry_pc: usize,
constants: &[Constant],
param_count: u16,
register_count: u16,
self_fi: u16,
param_kinds: &[Option<ParamKind>],
ret_kind: Option<SlotKind>,
ctx: &NativeCtx,
callees: &[CalleeSig],
) -> Option<Box<dyn NativeFn>>
fn compile_function( &self, code: &[Op], entry_pc: usize, constants: &[Constant], param_count: u16, register_count: u16, self_fi: u16, param_kinds: &[Option<ParamKind>], ret_kind: Option<SlotKind>, ctx: &NativeCtx, callees: &[CalleeSig], ) -> Option<Box<dyn NativeFn>>
Attempt to compile the function whose bytecode is code
(code[0] is the instruction at entry_pc; jump targets inside are
ABSOLUTE program pcs and need rebasing by entry_pc). Return None to
leave the function on the bytecode path forever.
callees carries every program function’s declared signature,
indexed by FuncIdx — calls to OTHER functions compile to table
dispatch when the callee’s signature is all-scalar (an unpublished
callee deopts at the call until it tiers up on its own).
Provided Methods§
Sourcefn compile_region(
&self,
code: &[Op],
head_pc: usize,
exit_pc: usize,
constants: &[Constant],
register_count: u16,
named: &[bool],
observed: &[ObservedKind],
ctx: &NativeCtx,
callees: &[CalleeSig],
) -> Option<Box<dyn RegionFn>>
fn compile_region( &self, code: &[Op], head_pc: usize, exit_pc: usize, constants: &[Constant], register_count: u16, named: &[bool], observed: &[ObservedKind], ctx: &NativeCtx, callees: &[CalleeSig], ) -> Option<Box<dyn RegionFn>>
Attempt to compile a loop region. code[0] is the op at head_pc
(the back-edge target); the slice ends at the back-edge jump
(inclusive). Every jump out of the region must target exit_pc.
named[r] marks frame registers carrying a user-visible name — the
only slots whose post-region values are observable (scratches are
dead at statement boundaries by the compiler’s allocation
discipline). observed[r] is the register’s runtime kind at this hot
crossing — the speculation seed, re-checked by the guard set on every
entry. Default: regions stay on bytecode.