Commit Graph

1 Commits

Author SHA1 Message Date
58f019bc14 JIT: lib/jit.sx — SX-level convenience layer
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 41s
Three primitives + a wrapper, all portable across hosts:

  with-jit-threshold N body...  — temporarily set threshold, restore on exit
  with-jit-budget    N body...  — temporarily set LRU budget
  with-fresh-jit       body...  — clear cache before & after body

  jit-report                    — human-readable stats string for logging
  jit-disable!  / jit-enable!   — convenience around set-budget! 0

The host (OCaml here, will be JS/Python eventually) only needs to provide
the underlying primitives (jit-stats, jit-set-threshold!, jit-set-budget!,
jit-reset-cache!, jit-reset-counters!). The ergonomics live in shared SX.

Used together with Phase 1 (tiered compilation) and Phase 2 (LRU eviction)
to give application developers fine-grained control over the JIT cache:
isolated test runs use with-fresh-jit, hot benchmark sections use
with-jit-threshold 1, memory-constrained pages use jit-set-budget! to
cap the cache.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-11 22:26:45 +00:00