pub trait NativeTier: Send + Sync {
// Required method
fn compile_function(
&self,
code: &[Op],
entry_pc: usize,
constants: &[Constant],
enums: &[EnumTypeDef],
param_count: u16,
register_count: u16,
self_fi: u16,
param_kinds: &[Option<ParamKind>],
cow_exempt_regs: &[u16],
ret_kind: Option<SlotKind>,
ctx: &NativeCtx,
callees: &[CalleeSig],
) -> Option<Box<dyn NativeFn>>;
// Provided methods
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>> { ... }
fn engine_name(&self) -> &'static str { ... }
fn compile_summary(&self) -> String { ... }
fn decline_summary(&self) -> String { ... }
fn optimization_summary(&self) -> String { ... }
fn execution_summary(&self) -> String { ... }
}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],
enums: &[EnumTypeDef],
param_count: u16,
register_count: u16,
self_fi: u16,
param_kinds: &[Option<ParamKind>],
cow_exempt_regs: &[u16],
ret_kind: Option<SlotKind>,
ctx: &NativeCtx,
callees: &[CalleeSig],
) -> Option<Box<dyn NativeFn>>
fn compile_function( &self, code: &[Op], entry_pc: usize, constants: &[Constant], enums: &[EnumTypeDef], param_count: u16, register_count: u16, self_fi: u16, param_kinds: &[Option<ParamKind>], cow_exempt_regs: &[u16], 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.
enums is the program’s declared enum types, the payload kinds an Inspect arm binds.
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).
cow_exempt_regs is the function’s CompiledFunction::cow_exempt_regs — the ONLY registers
the VM writes a shared list through in place. Every other shared list is copied on its first
write, so a backend that stores into a list in place must prove the target is unshared or in
this set, or leave the function on bytecode.
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.
Sourcefn engine_name(&self) -> &'static str
fn engine_name(&self) -> &'static str
The name this tier reports under LOGOS_ENGINE_TRACE.
Sourcefn compile_summary(&self) -> String
fn compile_summary(&self) -> String
Native compilation coverage accumulated by this tier.
Sourcefn decline_summary(&self) -> String
fn decline_summary(&self) -> String
Stable reasons why attempted native compilations declined.
Sourcefn optimization_summary(&self) -> String
fn optimization_summary(&self) -> String
Native-only optimizations that actually fired.
Sourcefn execution_summary(&self) -> String
fn execution_summary(&self) -> String
Actual native entries, completions and deoptimizations.