feat: success checker on by default in direct-link builds, free (jolt audit)
Checking inherently needs an inference pass (~2.6x compile as a standalone pass). But direct-link builds ALREADY run one inference pass for specialization (run-passes' infer-top), so checking can ride along: set a check-mode flag, turn checking? on during that existing pass, and collect the diagnostics after — ~2% overhead measured on the ray tracer, vs 2.6x for the separate pass. So the checker now defaults to `warn` in direct-link builds (where it's nearly free) and stays OFF in plain REPL/dev builds (no inference to ride, no forced cost — opt in with JOLT_TYPE_CHECK there). JOLT_TYPE_CHECK still overrides in both directions (off to disable, error to escalate). It checks the POST-optimization IR, which matches what the optimized program actually evaluates — scalar-replace only drops provably-pure code, an accepted opt-mode divergence, so no real error is hidden. The loaders enable position tracking whenever checking will run (env-selected or direct-link). type-check! (the standalone pass) stays for plain builds; both paths share report-diags!. cli-test pins: plain build silent, direct-link warns by default, JOLT_TYPE_CHECK=off disables. Gate green, suite 4718, runtime bench even.
This commit is contained in:
parent
69af83da89
commit
088232b778
6 changed files with 111 additions and 35 deletions
|
|
@ -118,6 +118,31 @@
|
|||
r)
|
||||
(has "could not find method"))
|
||||
|
||||
# --- success checker default-on in direct-link, off in plain builds ----------
|
||||
# A provably-wrong defn (never called, so no runtime error): the checker is the
|
||||
# only thing that can flag it. Plain build = silent (no dev regression);
|
||||
# direct-link build = warns by default (free piggyback on inference).
|
||||
(def tcw (string (or (os/getenv "TMPDIR") "/tmp") "/jolt-tcwarn-" (os/time) ".clj"))
|
||||
(spit tcw "(ns tcw)\n\n(defn unused [s]\n (inc \"definitely-not-a-number\"))\n")
|
||||
(check "plain build does not run the checker (no regression)"
|
||||
(run-err tcw)
|
||||
(fn [s] (nil? (string/find "type error" s))))
|
||||
(check "direct-link build warns by default (free checking)"
|
||||
(do (os/setenv "JOLT_DIRECT_LINK" "1")
|
||||
(def r (run-err tcw))
|
||||
(os/setenv "JOLT_DIRECT_LINK" nil)
|
||||
r)
|
||||
(fn [s] (and (string/find "type error" s)
|
||||
(string/find "requires a number" s))))
|
||||
(check "JOLT_TYPE_CHECK=off disables it even in direct-link"
|
||||
(do (os/setenv "JOLT_DIRECT_LINK" "1")
|
||||
(os/setenv "JOLT_TYPE_CHECK" "off")
|
||||
(def r (run-err tcw))
|
||||
(os/setenv "JOLT_DIRECT_LINK" nil)
|
||||
(os/setenv "JOLT_TYPE_CHECK" nil)
|
||||
r)
|
||||
(fn [s] (nil? (string/find "type error" s))))
|
||||
|
||||
(if (> fails 0)
|
||||
(error (string "cli-test: " fails " failing check(s)"))
|
||||
(print "\nAll CLI tests passed!"))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue