backend: emit bitwise ops as native ops (test.check PRNG ~2.4x)
Profiling the test.check distribution/large-sample slowness (jolt-i5if): the hot path is the SplitMix PRNG, dominated by 64-bit mix arithmetic, and the bitwise ops (bit-and/or/xor/not, shifts) were NOT in the backend native-ops table — so (bit-xor a b) compiled to a var-deref through the variadic overlay (__bit-xor) instead of a direct call, the way +/-/* already emit. Map bit-and/or/xor/not to the Chez bitwise-and/ior/xor/not primitives (inlined to native code; a non-integer operand now errors like the JVM instead of being silently truncated) and the shifts to a direct helper call. bit-and-not stays on its overlay — its only Scheme impl is 2-arg, so a value-position arity-3 use would mis-emit. mix-64 arithmetic 2.7x faster, raw split+rand-long 2.4x, gen/vector ~1.4x. The remaining gap is the bignum-vs-native-long floor (~20x, substrate) plus the generator machinery (deftype/fn dispatch, separate). Corpus rows added for value position, bit-not, apply, and a full-64-bit unsigned shift.
This commit is contained in:
parent
b5ea06c5c2
commit
f17b68ccfe
4 changed files with 153 additions and 135 deletions
File diff suppressed because one or more lines are too long
|
|
@ -539,11 +539,11 @@
|
|||
(guard (e (#t #f))
|
||||
(def-var! "clojure.core" "to-array-2d" (letrec ((to-array-2d (lambda (coll) (let fnrec4639 ((coll coll)) (jolt-invoke (var-deref "clojure.core" "to-array") (jolt-map (var-deref "clojure.core" "to-array") coll)))))) to-array-2d)))
|
||||
(guard (e (#t #f))
|
||||
(def-var! "clojure.core" "unchecked-byte" (letrec ((unchecked-byte (lambda (x) (let fnrec4640 ((x x)) (jolt-invoke (var-deref "clojure.core" "bit-and") (jolt-invoke (var-deref "clojure.core" "int") x) 255))))) unchecked-byte)))
|
||||
(def-var! "clojure.core" "unchecked-byte" (letrec ((unchecked-byte (lambda (x) (let fnrec4640 ((x x)) (bitwise-and (jolt-invoke (var-deref "clojure.core" "int") x) 255))))) unchecked-byte)))
|
||||
(guard (e (#t #f))
|
||||
(def-var! "clojure.core" "unchecked-short" (letrec ((unchecked-short (lambda (x) (let fnrec4641 ((x x)) (jolt-invoke (var-deref "clojure.core" "bit-and") (jolt-invoke (var-deref "clojure.core" "int") x) 65535))))) unchecked-short)))
|
||||
(def-var! "clojure.core" "unchecked-short" (letrec ((unchecked-short (lambda (x) (let fnrec4641 ((x x)) (bitwise-and (jolt-invoke (var-deref "clojure.core" "int") x) 65535))))) unchecked-short)))
|
||||
(guard (e (#t #f))
|
||||
(def-var! "clojure.core" "unchecked-char" (letrec ((unchecked-char (lambda (x) (let fnrec4642 ((x x)) (jolt-invoke (var-deref "clojure.core" "char") (jolt-invoke (var-deref "clojure.core" "bit-and") (jolt-invoke (var-deref "clojure.core" "int") x) 65535)))))) unchecked-char)))
|
||||
(def-var! "clojure.core" "unchecked-char" (letrec ((unchecked-char (lambda (x) (let fnrec4642 ((x x)) (jolt-invoke (var-deref "clojure.core" "char") (bitwise-and (jolt-invoke (var-deref "clojure.core" "int") x) 65535)))))) unchecked-char)))
|
||||
(guard (e (#t #f))
|
||||
(def-var! "clojure.core" "unchecked-float" (letrec ((unchecked-float (lambda (x) (let fnrec4643 ((x x)) (jolt-invoke (var-deref "clojure.core" "double") x))))) unchecked-float)))
|
||||
(guard (e (#t #f))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue