Skip to main content

Crate rune_compile

Crate rune_compile 

Source
Expand description

rune compile back-end — background compilation and transparent hot-swap.

Architecture:

  • CompileQueue: background thread pool for compilation jobs
  • ArtifactCache: source-hash → compiled artifact mapping
  • TierRouter: per-call-site tier (interpret | compile | compiled)
  • hot-swap: when compile finishes, next call uses compiled path

The interpreter is always the fallback. Compilation is opportunistic. Instant start is always preserved — compilation never blocks execution.

Structs§

ArtifactCache
The artifact cache — maps source hash to compiled artifact.
CallCounter
Call counter per formula hash — tracks hot paths.
CompiledArtifact
A compiled artifact — the result of optimizing a Nox formula. In M6, this is the same Noun (no actual optimization yet). In future milestones: TIR-optimized .nox bytecode.
TierRouter
TierRouter — makes the call-tier decision.
TierStats
Stats snapshot returned by TierRouter::stats.

Enums§

Tier
Per-callsite execution tier.

Functions§

compile_formula
Compile a formula. In M6 this is the trident path stub. Returns an artifact immediately (background thread in M8+).
formula_hash
A simple formula hash — placeholder until hemera lands in M2.
try_trident_compile
Attempt to compile a pure rune formula through trident. Returns Some(artifact) if compilation succeeded, None if formula contains dynamic forms (hint/host/eval) that trident cannot accept.