Skip to content

JIT backbone specification

The JIT is a thin development-time execution engine for fast feedback. AOT is the primary production path. Both use the same frontend, CLIF lowering, and runtime ABI boundary.

  • cranelift_jit::JITModule
  • cranelift_module::Module trait
  • cranelift_frontend::FunctionBuilder
  1. Build target ISA via cranelift_native::builder().
  2. Create JITModule with a JITBuilder.
  3. Declare function signatures and import runtime ABI symbols.
  4. Lower HIR into CLIF and call define_function.
  5. Call finalize_definitions().
  6. Retrieve function pointers with get_finalized_function.
  • The frontend emits CLIF once.
  • The module abstraction is shared with AOT.
  • JIT must not implement platform syscall policy or backend-specific execution behavior.
  • JIT imports runtime builtins through the shared ABI manifest used by AOT.
  • For AOT, replace JITModule with ObjectModule.
  • Fast host-platform compilation and execution for development feedback.
  • Runtime ABI symbol binding through shared runtime surface.
  • Reuse of lowering semantics identical to AOT.
  • Production artifact packaging and linker orchestration.
  • Platform ownership for syscall behavior.
  • Runtime ABI shape ownership.
  • All finalized function pointers remain valid until free_memory().
  • Do not hold or call pointers after memory is freed.
  • Allow optional CLIF emission to files for testing.
  • Use cranelift_reader to parse CLIF for golden tests.
  • Keep JIT validation focused on thin-backend behavior over shared lowering/runtime boundaries.