Group the JVM interop shims under host/chez/java/
The host/chez directory mixed jolt's own runtime (value model, seq, reader, vars, ns, multimethods) with the shims that emulate the JVM: java.* / javax.* classes, clojure.lang interfaces, and the host-class registry they hang off. Move that JVM-emulation layer into host/chez/java/ so it reads as a distinct unit instead of being interleaved with the platform runtime. Moved (content unchanged): host-static, host-static-methods, host-static-classes, host-class, dot-forms, records-interop, byte-buffer, io, io-streams, inst-time, java-time, bigdec, natives-queue, natives-str, natives-array, math, concurrency, async, ffi. The load paths in rt.ss/cli.ss and the build.ss runtime manifest are updated to point at java/; the build inliner follows the (load ...) strings, so the AOT path needs no other change. All runtime shims, no seed source touched (the three .clj edits are doc comments), so no re-mint. Gate green: make test (selfhost fixpoint, certify 0-new, sci 211, infer), shakesmoke (4 apps byte-identical).
This commit is contained in:
parent
5b77efa499
commit
ec9fde9e7e
26 changed files with 24 additions and 24 deletions
|
|
@ -111,7 +111,7 @@
|
||||||
'compile-eval
|
'compile-eval
|
||||||
"(load \"host/chez/png.ss\")"
|
"(load \"host/chez/png.ss\")"
|
||||||
"(load \"host/chez/loader.ss\")"
|
"(load \"host/chez/loader.ss\")"
|
||||||
"(load \"host/chez/ffi.ss\")"
|
"(load \"host/chez/java/ffi.ss\")"
|
||||||
"(set-source-roots! (list \"jolt-core\" \"stdlib\"))"))
|
"(set-source-roots! (list \"jolt-core\" \"stdlib\"))"))
|
||||||
|
|
||||||
(define bld-tagged-loads
|
(define bld-tagged-loads
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@
|
||||||
;; jolt.ffi host primitives (memory / library loading) load AFTER the loader's
|
;; jolt.ffi host primitives (memory / library loading) load AFTER the loader's
|
||||||
;; baked-ns snapshot, so a library's (require '[jolt.ffi]) still loads jolt.ffi's
|
;; baked-ns snapshot, so a library's (require '[jolt.ffi]) still loads jolt.ffi's
|
||||||
;; Clojure side (the foreign-fn / defcfn macros, stdlib/jolt/ffi.clj).
|
;; Clojure side (the foreign-fn / defcfn macros, stdlib/jolt/ffi.clj).
|
||||||
(load "host/chez/ffi.ss") ; jolt.ffi (FFI: a library binds native code)
|
(load "host/chez/java/ffi.ss") ; jolt.ffi (FFI: a library binds native code)
|
||||||
|
|
||||||
;; jolt.main + jolt.deps live under jolt-core; keep them (and stdlib) on the
|
;; jolt.main + jolt.deps live under jolt-core; keep them (and stdlib) on the
|
||||||
;; roots so the CLI's own namespaces — and any jolt.* an app pulls in — resolve.
|
;; roots so the CLI's own namespaces — and any jolt.* an app pulls in — resolve.
|
||||||
|
|
|
||||||
|
|
@ -259,7 +259,7 @@
|
||||||
;; the dispatchers/printers it wraps (collections/seq/values/converters/printing/
|
;; the dispatchers/printers it wraps (collections/seq/values/converters/printing/
|
||||||
;; transients).
|
;; transients).
|
||||||
(load "host/chez/records.ss")
|
(load "host/chez/records.ss")
|
||||||
(load "host/chez/records-interop.ss") ; exception hierarchy + instance-check taxonomy
|
(load "host/chez/java/records-interop.ss") ; exception hierarchy + instance-check taxonomy
|
||||||
|
|
||||||
;; metadata: meta / with-meta over an identity-keyed
|
;; metadata: meta / with-meta over an identity-keyed
|
||||||
;; side-table. After records.ss (jrec) + the collection ctors it copies.
|
;; side-table. After records.ss (jrec) + the collection ctors it copies.
|
||||||
|
|
@ -268,7 +268,7 @@
|
||||||
;; host class tokens: bare class names (String/Keyword/File...) ->
|
;; host class tokens: bare class names (String/Keyword/File...) ->
|
||||||
;; canonical JVM class-name strings + (class x). After natives-meta.ss (jolt-type)
|
;; canonical JVM class-name strings + (class x). After natives-meta.ss (jolt-type)
|
||||||
;; and the printer (jolt-str-render-one).
|
;; and the printer (jolt-str-render-one).
|
||||||
(load "host/chez/host-class.ss")
|
(load "host/chez/java/host-class.ss")
|
||||||
|
|
||||||
;; dynamic vars: *clojure-version* / *unchecked-math* constants the host
|
;; dynamic vars: *clojure-version* / *unchecked-math* constants the host
|
||||||
;; binds natively. After collections.ss (jolt-hash-map) + def-var!.
|
;; binds natively. After collections.ss (jolt-hash-map) + def-var!.
|
||||||
|
|
@ -324,39 +324,39 @@
|
||||||
;; portable String/CharSequence surface record-method-dispatch falls through to on
|
;; portable String/CharSequence surface record-method-dispatch falls through to on
|
||||||
;; a string target. After regex.ss (jolt-re-pattern/regex-t-irx) + records.ss
|
;; a string target. After regex.ss (jolt-re-pattern/regex-t-irx) + records.ss
|
||||||
;; (which references jolt-string-method).
|
;; (which references jolt-string-method).
|
||||||
(load "host/chez/natives-str.ss")
|
(load "host/chez/java/natives-str.ss")
|
||||||
|
|
||||||
;; host class statics + constructors: host-static-ref/
|
;; host class statics + constructors: host-static-ref/
|
||||||
;; host-static-call/host-new + the jhost method registry. Loads LAST — it extends
|
;; host-static-call/host-new + the jhost method registry. Loads LAST — it extends
|
||||||
;; record-method-dispatch (records.ss) and reuses natives-str helpers (str-trim,
|
;; record-method-dispatch (records.ss) and reuses natives-str helpers (str-trim,
|
||||||
;; ascii-string-down, re-split, str-split-drop-trailing) + the regex-t accessors.
|
;; ascii-string-down, re-split, str-split-drop-trailing) + the regex-t accessors.
|
||||||
(load "host/chez/host-static.ss") ; registries + jhost + coercion helpers
|
(load "host/chez/java/host-static.ss") ; registries + jhost + coercion helpers
|
||||||
(load "host/chez/host-static-methods.ss") ; Class/member static methods + fields
|
(load "host/chez/java/host-static-methods.ss") ; Class/member static methods + fields
|
||||||
(load "host/chez/host-static-classes.ss") ; instantiable host object classes
|
(load "host/chez/java/host-static-classes.ss") ; instantiable host object classes
|
||||||
(load "host/chez/byte-buffer.ss") ; java.nio.ByteBuffer over a byte-array
|
(load "host/chez/java/byte-buffer.ss") ; java.nio.ByteBuffer over a byte-array
|
||||||
|
|
||||||
;; generic dot-form dispatch: field access + map/vector member access
|
;; generic dot-form dispatch: field access + map/vector member access
|
||||||
;; for the `.` / `.-field` desugar. Loads after host-static.ss so it wraps every
|
;; for the `.` / `.-field` desugar. Loads after host-static.ss so it wraps every
|
||||||
;; record-method-dispatch arm (jhost/number/regex/jrec/string) and falls through.
|
;; record-method-dispatch arm (jhost/number/regex/jrec/string) and falls through.
|
||||||
(load "host/chez/dot-forms.ss")
|
(load "host/chez/java/dot-forms.ss")
|
||||||
|
|
||||||
;; java.io.File + host file I/O: path-backed jfile record, slurp/spit/
|
;; java.io.File + host file I/O: path-backed jfile record, slurp/spit/
|
||||||
;; flush, file-seq dir primitives, clojure.java.io/file. Loads LAST so its jfile
|
;; flush, file-seq dir primitives, clojure.java.io/file. Loads LAST so its jfile
|
||||||
;; arm wraps the fully-built record-method-dispatch and the str/type/instance-check
|
;; arm wraps the fully-built record-method-dispatch and the str/type/instance-check
|
||||||
;; extensions sit over every prior shim.
|
;; extensions sit over every prior shim.
|
||||||
(load "host/chez/io.ss")
|
(load "host/chez/java/io.ss")
|
||||||
|
|
||||||
;; #inst values + java.time formatting: jinst (RFC3339 ms) +
|
;; #inst values + java.time formatting: jinst (RFC3339 ms) +
|
||||||
;; DateTimeFormatter/Instant/ZoneId/LocalDateTime/FormatStyle/Locale/Date. Loads
|
;; DateTimeFormatter/Instant/ZoneId/LocalDateTime/FormatStyle/Locale/Date. Loads
|
||||||
;; LAST — it extends record-method-dispatch / jolt-get / jolt= / jolt-hash /
|
;; LAST — it extends record-method-dispatch / jolt-get / jolt= / jolt-hash /
|
||||||
;; jolt-pr-str / jolt-type / instance-check and uses host-static.ss's registries.
|
;; jolt-pr-str / jolt-type / instance-check and uses host-static.ss's registries.
|
||||||
(load "host/chez/inst-time.ss")
|
(load "host/chez/java/inst-time.ss")
|
||||||
|
|
||||||
;; java.time value types: LocalDate / LocalTime / LocalDateTime / Instant as
|
;; java.time value types: LocalDate / LocalTime / LocalDateTime / Instant as
|
||||||
;; tz-free jhost values (epoch-day / nano-of-day / epoch-ms). Loads after
|
;; tz-free jhost values (epoch-day / nano-of-day / epoch-ms). Loads after
|
||||||
;; inst-time.ss — it reuses its civil<->days helpers, the jhost registries, and
|
;; inst-time.ss — it reuses its civil<->days helpers, the jhost registries, and
|
||||||
;; re-registers a few LocalDateTime/Instant statics to use the richer reps.
|
;; re-registers a few LocalDateTime/Instant statics to use the richer reps.
|
||||||
(load "host/chez/java-time.ss")
|
(load "host/chez/java/java-time.ss")
|
||||||
|
|
||||||
;; Chez-side data reader: read-string / __parse-next /
|
;; Chez-side data reader: read-string / __parse-next /
|
||||||
;; __read-tagged. Loads after inst-time.ss — __read-tagged reuses its #uuid/#inst
|
;; __read-tagged. Loads after inst-time.ss — __read-tagged reuses its #uuid/#inst
|
||||||
|
|
@ -365,7 +365,7 @@
|
||||||
|
|
||||||
;; clojure.math: native flonum-math shims def-var!'d into the
|
;; clojure.math: native flonum-math shims def-var!'d into the
|
||||||
;; clojure.math ns. Self-contained (only def-var! + Chez math), order-independent.
|
;; clojure.math ns. Self-contained (only def-var! + Chez math), order-independent.
|
||||||
(load "host/chez/math.ss")
|
(load "host/chez/java/math.ss")
|
||||||
|
|
||||||
;; reader/macro runtime support: #?() feature set, reader-conditional + re-matcher
|
;; reader/macro runtime support: #?() feature set, reader-conditional + re-matcher
|
||||||
;; tagged-map ctors, macroexpand. After ns.ss; macroexpand call-time-refs the macro
|
;; tagged-map ctors, macroexpand. After ns.ss; macroexpand call-time-refs the macro
|
||||||
|
|
@ -375,17 +375,17 @@
|
||||||
;; Java-style arrays: object/typed array constructors + a jolt-array
|
;; Java-style arrays: object/typed array constructors + a jolt-array
|
||||||
;; backing; extends count/nth/seq/get/ref-put! so the overlay aget/aset/alength see
|
;; backing; extends count/nth/seq/get/ref-put! so the overlay aget/aset/alength see
|
||||||
;; it. After the dispatchers it chains.
|
;; it. After the dispatchers it chains.
|
||||||
(load "host/chez/natives-array.ss")
|
(load "host/chez/java/natives-array.ss")
|
||||||
|
|
||||||
;; java.io byte/char streams (FileInputStream/…/ByteArrayOutputStream/Buffered*)
|
;; java.io byte/char streams (FileInputStream/…/ByteArrayOutputStream/Buffered*)
|
||||||
;; over Chez ports. After io.ss (extends its slurp/__close/reader-jhost?) and
|
;; over Chez ports. After io.ss (extends its slurp/__close/reader-jhost?) and
|
||||||
;; natives-array.ss (the byte-array <-> bytevector bridge).
|
;; natives-array.ss (the byte-array <-> bytevector bridge).
|
||||||
(load "host/chez/io-streams.ss")
|
(load "host/chez/java/io-streams.ss")
|
||||||
|
|
||||||
;; clojure.lang.PersistentQueue: a functional queue + EMPTY static.
|
;; clojure.lang.PersistentQueue: a functional queue + EMPTY static.
|
||||||
;; Chains seq/count/empty?/peek/pop/conj/sequential?/class/instance?/printer, so
|
;; Chains seq/count/empty?/peek/pop/conj/sequential?/class/instance?/printer, so
|
||||||
;; load after natives-array (the dispatchers it extends).
|
;; load after natives-array (the dispatchers it extends).
|
||||||
(load "host/chez/natives-queue.ss")
|
(load "host/chez/java/natives-queue.ss")
|
||||||
|
|
||||||
;; syntax-quote form builders: __sqcat/__sqvec/__sqmap/__sqset/
|
;; syntax-quote form builders: __sqcat/__sqvec/__sqmap/__sqset/
|
||||||
;; __sq1, def-var!'d into clojure.core. A cross-compiled macro expander (analyzer
|
;; __sq1, def-var!'d into clojure.core. A cross-compiled macro expander (analyzer
|
||||||
|
|
@ -397,14 +397,14 @@
|
||||||
;; (JVM) semantics. Loaded LAST — chains the fully-built jolt-deref and conveys the
|
;; (JVM) semantics. Loaded LAST — chains the fully-built jolt-deref and conveys the
|
||||||
;; thread-local binding stack (dyn-binding.ss) into workers. pmap/pcalls/pvalues
|
;; thread-local binding stack (dyn-binding.ss) into workers. pmap/pcalls/pvalues
|
||||||
;; (overlay, over `future`) light up once future-call exists here.
|
;; (overlay, over `future`) light up once future-call exists here.
|
||||||
(load "host/chez/concurrency.ss")
|
(load "host/chez/java/concurrency.ss")
|
||||||
|
|
||||||
;; clojure.core.async: real-thread blocking channels + go/go-loop/
|
;; clojure.core.async: real-thread blocking channels + go/go-loop/
|
||||||
;; thread macros, def-var!'d into clojure.core.async. After concurrency.ss (reuses
|
;; thread macros, def-var!'d into clojure.core.async. After concurrency.ss (reuses
|
||||||
;; ms->duration) and the collection/seq layer.
|
;; ms->duration) and the collection/seq layer.
|
||||||
(load "host/chez/async.ss")
|
(load "host/chez/java/async.ss")
|
||||||
|
|
||||||
;; BigDecimal: the jbigdec value type + bigdec/decimal?/class/equality/
|
;; BigDecimal: the jbigdec value type + bigdec/decimal?/class/equality/
|
||||||
;; printing. Loads LAST so its set!-wraps of jolt-class/jolt=2/the printers sit
|
;; printing. Loads LAST so its set!-wraps of jolt-class/jolt=2/the printers sit
|
||||||
;; outermost over every earlier extension.
|
;; outermost over every earlier extension.
|
||||||
(load "host/chez/bigdec.ss")
|
(load "host/chez/java/bigdec.ss")
|
||||||
|
|
|
||||||
|
|
@ -340,7 +340,7 @@
|
||||||
|
|
||||||
(defn clojure-version [] "1.11.0-jolt")
|
(defn clojure-version [] "1.11.0-jolt")
|
||||||
|
|
||||||
;; bigdec is a host fn (host/chez/bigdec.ss) — a real BigDecimal value type.
|
;; bigdec is a host fn (host/chez/java/bigdec.ss) — a real BigDecimal value type.
|
||||||
(defn numerator [x] (throw (ex-info "numerator requires a ratio (Jolt has no ratios)" {})))
|
(defn numerator [x] (throw (ex-info "numerator requires a ratio (Jolt has no ratios)" {})))
|
||||||
(defn denominator [x] (throw (ex-info "denominator requires a ratio (Jolt has no ratios)" {})))
|
(defn denominator [x] (throw (ex-info "denominator requires a ratio (Jolt has no ratios)" {})))
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -685,7 +685,7 @@
|
||||||
;; jolt-regex value over the vendored irregex.
|
;; jolt-regex value over the vendored irregex.
|
||||||
(form-regex? form) {:op :regex :source (form-regex-source form)}
|
(form-regex? form) {:op :regex :source (form-regex-source form)}
|
||||||
;; #inst / #uuid literals -> :inst / :uuid IR leaves. The Chez back
|
;; #inst / #uuid literals -> :inst / :uuid IR leaves. The Chez back
|
||||||
;; end emits a runtime inst/uuid value (host/chez/inst-time.ss).
|
;; end emits a runtime inst/uuid value (host/chez/java/inst-time.ss).
|
||||||
(form-inst? form) {:op :inst :source (form-inst-source form)}
|
(form-inst? form) {:op :inst :source (form-inst-source form)}
|
||||||
(form-uuid? form) {:op :uuid :source (form-uuid-source form)}
|
(form-uuid? form) {:op :uuid :source (form-uuid-source form)}
|
||||||
;; bigdecimal literal (1.5M) -> a :bigdec leaf; the back end emits a runtime
|
;; bigdecimal literal (1.5M) -> a :bigdec leaf; the back end emits a runtime
|
||||||
|
|
|
||||||
|
|
@ -350,7 +350,7 @@
|
||||||
(ffi-type->chez (:rettype node)) ")"))
|
(ffi-type->chez (:rettype node)) ")"))
|
||||||
|
|
||||||
;; jolt.ffi/__ccallable -> a Chez foreign-callable wrapping the emitted jolt fn,
|
;; jolt.ffi/__ccallable -> a Chez foreign-callable wrapping the emitted jolt fn,
|
||||||
;; locked + registered (jolt-ffi-register-callable!, host/chez/ffi.ss) so the
|
;; locked + registered (jolt-ffi-register-callable!, host/chez/java/ffi.ss) so the
|
||||||
;; collector neither moves nor reclaims it while C may still call through it. The
|
;; collector neither moves nor reclaims it while C may still call through it. The
|
||||||
;; expression evaluates to the entry-point address — a jolt pointer the caller
|
;; expression evaluates to the entry-point address — a jolt pointer the caller
|
||||||
;; hands to C. :collect-safe emits the convention that reactivates the thread on
|
;; hands to C. :collect-safe emits the convention that reactivates the thread on
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
(load "host/chez/host-contract.ss")
|
(load "host/chez/host-contract.ss")
|
||||||
(load "host/chez/seed/image.ss")
|
(load "host/chez/seed/image.ss")
|
||||||
(load "host/chez/compile-eval.ss")
|
(load "host/chez/compile-eval.ss")
|
||||||
(load "host/chez/ffi.ss")
|
(load "host/chez/java/ffi.ss")
|
||||||
|
|
||||||
(define total 0) (define fails 0)
|
(define total 0) (define fails 0)
|
||||||
(define (ok name pred) (set! total (+ total 1)) (unless pred (set! fails (+ fails 1)) (printf "FAIL: ~a\n" name)))
|
(define (ok name pred) (set! total (+ total 1)) (unless pred (set! fails (+ fails 1)) (printf "FAIL: ~a\n" name)))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue