Skip to content

jit: in-process ORC LLJIT is the default REPL backend (perf plan Phase 2) - #341

Merged
Ch4s3 merged 6 commits into
mainfrom
claude/jit-repl-interpreted-perf-68373c
Aug 25, 2026
Merged

jit: in-process ORC LLJIT is the default REPL backend (perf plan Phase 2)#341
Ch4s3 merged 6 commits into
mainfrom
claude/jit-repl-interpreted-perf-68373c

Conversation

@Ch4s3

@Ch4s3 Ch4s3 commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Phase 2 of docs/superpowers/plans/2026-08-23-interpreter-and-repl-jit-performance.md (sequencing Gate G2, Lane P). Per-line REPL compile latency drops from ~210-290 ms (clang subprocess + dlopen) to <1 ms.

Six commits, in dependency order:

  • Jit_orc.available — no-raise, cached libLLVM probe
  • root-cause fix for the ORC session SIGSEGV: REPL slot-loader fns get internal linkage (external duplicates collided in the shared JITDylib), and march_orc_add_ir no longer double-frees the ThreadSafeModule on the error path (LLVM's add consumes it unconditionally — verified against LLJIT.h)
  • default flip: unset → ORC iff libLLVM present; MARCH_JIT_BACKEND=clang restores the old backend; unrecognized values fall back to clang as before; resolution is lazy so --compile never dlopens libLLVM
  • best-effort LLJIT pre-warm at REPL startup (first-fragment cost ~80 ms → ~1 ms; a broken libLLVM degrades per-fragment instead of killing startup); O1 IR pipeline was measured and dropped (no effect — fragment IR is already clean SSA)
  • per-session LLJIT owned by Repl_jit.t (a process with many REPL sessions — test suites, embedders — no longer collides in one JITDylib)
  • session-level $clo_wrap dedupe: second fragment declares instead of redefining, with wrap records committed only after the fragment actually compiles

Parity: every REPL/compiler parity test runs on BOTH backends (16 cases). Suites at head: compiler 932 / eval 272 / codegen 589 / stdlib 877 / stdlib_march 61 / jit 4 / snapshots 33 — all green (two transient rows in one run were external SIGKILLs from a sibling session's process sweep, re-verified green in isolation). AOT byte-identical by IR-oracle on a program that exercises the changed emitter paths.

Ch4s3 added 6 commits August 24, 2026 17:16
…es instead of redefining (ORC JITDylib rejects duplicates)
…dupe

The redefinition path's filtered prev_slots + emit-name renaming merged with
this branch's session_wraps threading; redefinition emits carry both. Validated:
repl_jit_cross_line 12/12, repl_jit_regression 15/15, test_jit 7/7 (incl. the
new redefinition trio on both backends through the merged run_decl), parity 16/16.
…urface

Kept both harnesses in test_jit.ml (check_session + redefinition trio) under
one suite; dune rule keeps MARCH_BIN + both source trees. Validated:
cross_line 12/12, regression 15/15, test_jit 13/13, parity 16/16.
@Ch4s3
Ch4s3 merged commit 368181a into main Aug 25, 2026
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant