jolt/host/chez/seed
Yogthos ec30c9e405 Chez concurrency pt.1: real OS-thread futures + blocking promises (shared heap)
future/future-call run the body on a native thread (fork-thread) over the SAME
heap — JVM semantics, not Janet's isolated-heap snapshot. deref blocks on a
mutex+condition latch; timed (deref f ms val) uses an absolute deadline.
promise is a real blocking promise (deref parks until deliver), replacing the
Janet non-blocking atom shim. future?/future-done?/future-cancelled?/future-cancel
/realized? are native (the overlay versions read Janet map keys); re-asserted in
post-prelude over the overlay. pmap/pcalls/pvalues (overlay, over future) light
up for free.

Thread-safety this forces:
- atoms get a per-atom mutex; swap!/swap-vals! are a JVM-style CAS loop (f runs
  outside the lock, so a watch/validator can deref the same atom); reset!/
  compare-and-set! are atomic.
- the dynamic binding stack becomes a Chez thread-parameter, so each future/thread
  has its own; Chez inherits it at fork, giving binding conveyance (the shim also
  installs an explicit snapshot).
- Thread/sleep really sleeps now (a worker sleeping doesn't block the parent).

Re-minted the seed: future-call now resolves at compile time, so pmap compiles to
a var-deref instead of the host-static-call fallback that crashed. image.ss
unchanged.

Corpus: the 2 snapshot cases now match the JVM (shared) not Janet (isolated) —
allowlisted on both Chez gates; the two racy future-cancel cases allowlisted;
"promise undelivered" (blocks on JVM/Chez, profile :bucket :timeout) skipped like
:throws. Zero-Janet corpus 2544 -> 2569, 0 new divergences, floor raised. Full
Janet gate + JVM cert green.

jolt-byjr
2026-06-20 13:11:31 -04:00
..
image.ss Fix 4 clojure.core bugs surfaced by JVM certification 2026-06-20 11:06:33 -04:00
prelude.ss Chez concurrency pt.1: real OS-thread futures + blocking promises (shared heap) 2026-06-20 13:11:31 -04:00
README.md Chez Phase 3 inc9a: self-contained Chez bootstrap (no Janet in the loop) 2026-06-20 06:46:05 -04:00

Chez bootstrap seed

These two files are the bootstrap compiler for jolt-on-Chez — the seed that makes the build self-hosting with no Janet in the loop:

  • prelude.ss — the clojure.core prelude (all tiers + clojure.string/walk/ template/edn/set/pprint) as Scheme def-var! forms.
  • image.ss — the compiler image (jolt.ir + jolt.analyzer + jolt.backend-scheme) as Scheme def-var! forms.

Both are generated, not hand-written. They are checked in because a fresh checkout must be able to build jolt-on-Chez using only Chez: host/chez/bootstrap.ss loads this seed, then rebuilds the prelude + image from the .clj/.ss sources via the on-Chez compiler (read → analyze → emit, all on Chez). The seed is a joint byte-fixpoint: rebuilding from an up-to-date seed reproduces it exactly (test/chez/bootstrap-test.janet verifies this).

Janet was used once, historically, to mint the very first seed (the Janet analyzer/ emitter cross-compiled the sources, then the on-Chez compiler iterated to the fixpoint — see test/chez/fixpoint-test.janet). After that, Janet is never needed to build or run jolt-on-Chez.

Re-minting

When the seed sources change (the core tiers, the compiler namespaces, the host contract, the reader, emit-image.ss), the seed drifts and bootstrap-test fails. Re-mint it:

(import host/chez/driver :as d)
(import host/chez/jolt-chez :as jc)
(def ctx (d/make-ctx))
(d/mint-chez-seed* (jc/ensure-prelude ctx)
                   (d/ensure-compiler-image ctx "/tmp/stage1.ss")
                   "host/chez/seed/prelude.ss"
                   "host/chez/seed/image.ss")

Then commit the refreshed prelude.ss / image.ss.