A ^double/^long param hint (or a float literal) now drives Chez flonum/fixnum ops instead of generic arithmetic — JVM-style primitive hints, available in every build and at -e (not gated on direct-linking or whole-program inference). New pass jolt.passes.numeric: a local forward type-flow seeded from ^double/^long fn-param hints (analyzer attaches :nhints per arity) and float literals, propagated through let inits / arithmetic / if / do. It tags an arithmetic invoke :num-kind :double|:long when every operand is that kind (an integer literal is a wildcard, coerced to a flonum in a double op). The back end lowers a tagged node to fl+/fl-/fl*/fl//fl<?/... or fx+/fx*/fx1+/fxquotient/... (unchecked-add etc. join the fixnum path; == too). Runs last in run-passes, both branches. Soundness: :long is seeded ONLY from an explicit ^long hint, never a bare integer literal, so un-hinted integer code keeps jolt's arbitrary-precision numbers — no fixnum-overflow surprise, no corpus divergence. :double comes from ^double hints and float literals (flonum arithmetic is always flonum, matching the generic result). A ^long hint is a promise the value is a fixnum: fx+ raises on overflow, like a JVM fixed-width long. Numeric-hinted params coerce at fn entry (exact->inexact / jolt->fx), the way the JVM coerces a primitive parameter — so the body's fl*/fx* ops can rely on the type even when a caller passes an exact int (e.g. Chez's (* 0 1.0) => exact 0). Round 1 specializes hinted straight-line / fn-body arithmetic. fl-ops are ~4x generic in a tight Chez loop, but realizing that on loop-carried accumulators needs loop-var typing — round 2. Sound foundation, gated by test/chez/numeric-test.ss. |
||
|---|---|---|
| .. | ||
| build-app | ||
| bench-chez.ss | ||
| corpus.edn | ||
| directlink-test.ss | ||
| ffi-binding-test.ss | ||
| numeric-test.ss | ||
| README.md | ||
| transient-test.ss | ||
| unit.edn | ||
| values-test.ss | ||
Chez test harness
The correctness gate for jolt. Pure Chez (+ Clojure for the JVM oracle).
Correctness is judged against the JVM-sourced conformance spec; the spec itself
lives in test/conformance/ (see its SPEC.md). Run the whole gate with make test from the repo root.
The spec corpus
corpus.edn is the contract: ~2920 rows {:suite :label :expected :actual}, with
:expected sourced from reference JVM Clojure by test/conformance/regen-corpus.clj.
It is frozen (the canonical source) — add or change cases here, then re-source the
answers with regen-corpus.clj and re-certify with test/conformance/certify.clj.
The gate runners (host/chez/)
-
run-corpus.ss— runs every corpus case through the spine (read → analyze → IR → emit → eval, all on Chez), comparing each result by value-equality against the JVM:expected. Aknown-failallowlist covers cases jolt can't match because Chez has no JVM host (Java classes, arrays,BigDecimal, opaque host-object printers, …); the gate fails only on a NEW divergence or if the pass count drops below the floor.chez --script host/chez/run-corpus.ss JOLT_CORPUS_LIMIT=200 … # every-Nth stride, fast iteration JOLT_CHEZ_ZJ_FLOOR=N … # override the floor (default 2678) -
run-unit.ss— host-specific unit cases (test/chez/unit.edn) that aren't in the JVM-portable corpus: dot-forms, java statics, io, reader, walk, vars/namespaces, refs. Each:expris evaluated in-process and its printed value compared to a baked:expected(:throwsasserts a raise). -
selfcheck.sh— self-host fixpoint:bootstrap.ssrebuild byte-equals the checked-in seed (host/chez/seed/). -
smoke.sh— realbin/joltc -eCLI smoke.
Other Chez tests
values-test.ss— the value model (nil/truthiness/collections).make values.bench-chez.ss— compute bench through the pipeline (opt-in; not in the gate).
All runners assume chez on PATH.