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. |
||
|---|---|---|
| .. | ||
| image.ss | ||
| prelude.ss | ||
| README.md | ||
Chez bootstrap seed
These two files are the bootstrap compiler for jolt — the seed that makes the build self-hosting:
prelude.ss— theclojure.coreprelude (all tiers + clojure.string/walk/ template/edn/set/pprint) as Schemedef-var!forms.image.ss— the compiler image (jolt.ir+jolt.analyzer+jolt.backend-scheme) as Schemedef-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.
make selfhost (host/chez/selfcheck.sh) runs host/chez/bootstrap.ss and diffs
the rebuilt artifacts against the checked-in seed.
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 make selfhost
fails. Re-mint it by running host/chez/bootstrap.ss and writing the freshly
rebuilt prelude/image back to host/chez/seed/prelude.ss /
host/chez/seed/image.ss, then commit the refreshed files.