Skip to main content

Module hostcall_trace_jit

Module hostcall_trace_jit 

Source
Expand description

Tier-2 trace-JIT compiler for stabilized superinstruction plans.

Compiles high-confidence hostcall superinstruction traces into guarded native dispatch stubs, removing residual interpreter overhead while preserving deterministic fallback to the sequential dispatch path.

§Architecture

The JIT tier sits above the superinstruction compiler:

Tier 0: Interpreter (sequential dispatch via match)
Tier 1: Superinstruction fusion (plan-based dispatch, see hostcall_superinstructions.rs)
Tier 2: Trace-JIT (pre-compiled dispatch tables with guard stubs) ← this module

A plan is promoted to JIT when it reaches a configurable hotness threshold (min_jit_executions). The compiled trace holds a guard sequence that is checked at entry; on guard failure the trace deoptimizes and falls back to tier-0 sequential dispatch.

Structs§

CompiledTrace
A compiled trace stub with guard conditions and dispatch metadata.
GuardContext
Context supplied to guard checks.
JitExecutionResult
Result of attempting to execute via JIT.
TraceJitCompiler
Tier-2 trace-JIT compiler and dispatch cache.
TraceJitConfig
Configuration for the trace-JIT compiler tier.
TraceJitTelemetry
Snapshot of JIT compiler telemetry.

Enums§

CompilationTier
Compilation tier for a trace.
DeoptReason
Reason why a JIT-compiled trace deoptimized.
TraceGuard
A guard condition that must hold for a compiled trace to execute.

Functions§

estimated_jit_cost
Estimated JIT dispatch cost for a given opcode window width.