Working notes: 2026-11-15, afternoon: hazel-jit, after Friday's meeting
Claude, 17:03 MST on 11-15; one session throughout. Picks up from this morning's note.
In short
Matthew summarized Friday's hour with Cyrus (the 11-13 note), and its hazel-jit items became ^ticket(756) to ^ticket(763). By evening each has a branch of its own off trial/694-view-jit with CI green, a written finding, or a question for Matthew.
- A sweep runs all 316 of the evaluator's test programs through hazel-jit too. The 237 that compile agree with the interpreter, except 30 ill-typed ones, which are now left to the interpreter, and CI fails on any new difference.
- Int and Nat are exact, and division by zero stops as the interpreter does.
- Compiled code has a step limit, and what hazel-jit leaves to the interpreter is written down.
- Seventeen builtins and partial application were added.
- Along the way the agreement tests found a crash in Hazel's own interpreter, modulo by zero, now PR #2825.
- The Tarot deals 3.7 times faster with its functions' types declared, which led to
^ticket(762). hazeljs 0.0.7 carries the tuple fix (^ticket(736)) and waits on Matthew's security key to publish.
Matthew, this afternoon
For Friday -- I met with Cyrus and talked about next steps for hazel-jit work.
we want semantic consistency with Hazel the interpreter, and to ensure that with CI, and our design decisions.
another major concern from Cyrus, from meeting on 11-13: We need a way to limit compiled hazel functions that diverge --- we need a step limit.
let's put a pin in this -- I need my security key and don't have it handy ATM
Yes, open it
What was done
^ticket(756), consistency with the interpreter, in CI. Every program of the evaluator's own tests (316) also goes through hazel-jit when it compiles: 237 compiled, 207 agreed, none differ, none threw. The other 30 are ill-typed programs, where the interpreter stops at a failed run-time type check. Those are listed, and any other parting fails its test (trial/756-sweep, green).^ticket(757), Int and Nat exact. Measured first. PlainBigIntcosts 1.5 to 11 times plain numbers; the hybrid used here (a number while it is a safe integer, aBigIntpast that) costs 0.7 to 3.7 times. On the Witch, the compiled run per event went from 4-8 ms to 6-9 ms (trial/757-bigint, green).^ticket(759), invalid operations. Division by zero, a negative power and a badint_of_stringstop the compiled run, and the interpreter makes the stuck term. The harness counts that as agreeing (trial/759-divide-by-zero, green).^ticket(760), what hazel-jit leaves to the interpreter, written into its source: holes, the stepper's filters, and anything a stepper shows (a livelit in a probe drawer's stepper was drawn from JS; no longer); and now programs with type errors. The jit check on all six slides kept every compiled run (trial/760-stepper, green).^ticket(761), the limits, by the sweep's counts. Seventeen builtins, among them the string ones, the compare family andinvert_ord(green). Partial application,f(a, _), is in CI.^ticket(762), why an undeclared result type costs 5 to 7 times. It is not unknown types: the statics infer a recursive function's type in passes. It is where the run-time type checks (ascriptions) sit: on each case arm's result, against once around the body.^ticket(763), a step limit. Each compiled function counts its call and reads the clock every 16384 calls. On the main thread a run has 50 ms or 50 million calls, then falls back to the interpreter. On the Witch: 7-10 ms per event, against 4-8 (trial/763-step-limit, green).^ticket(764), a crash in the interpreter, found by^ticket(759)'s tests:int_mod,sint_mod,nat_modandfloat_modby zero raisedInvalidBuiltin("mod")(on dev since at least 2025-07-02). The fix names each builtin itself and makes a builtin's error final, as an operator's is. PR #2825 to dev is open, green, and awaiting review.^ticket(730), the Tarot, hazeljs-oracles 0.0.7: every function's whole type declared, about 3.7 times faster (a Celtic Cross 173 ms to 46 in Node).^ticket(736), hazeljs 0.0.7: a JS value goes in by the function's declared type, so an array is a tuple where a tuple is wanted. Merged on hazelgrove/hazeljs main, its checks green; npm publish waits on Matthew's security key.- The work notes gallery: the 11-11 to 11-14 gaps filled, and Friday's meeting with Cyrus recorded.
Where things are
- Branches, on hazelgrove/hazel, not merged:
trial/756-sweep, withtrial/757-biginton it andtrial/759-divide-by-zeroon that;trial/760-stepper,trial/761-builtinsandtrial/763-step-limit, each offtrial/694-view-jit;fix/764-mod-by-zero, as PR #2825.
~/hazel-694-jit(its uncommitteddocs/hazel-architecture-july-2024.tldris not this session's) and~/hazel-764. - Waiting on Matthew:
^ticket(758), SInt's width (the browser's interpreter wraps at 32 bits today; recommended: 32 bits everywhere, overflow an error);^ticket(736)'s npm publish.
Next
- Merge the green trial branches into
trial/694-view-jit, reconciling the harness (^ticket(756),^ticket(757),^ticket(759)). ^ticket(761): mutual recursion, then the rest of the list.^ticket(762): count the ascriptions a call runs, typed and untyped.^ticket(763): a cheaper counter (only at calls that can recur).