diff --git a/jolt-core/jolt/backend_scheme.clj b/jolt-core/jolt/backend_scheme.clj index 188e169..4f5067c 100644 --- a/jolt-core/jolt/backend_scheme.clj +++ b/jolt-core/jolt/backend_scheme.clj @@ -80,6 +80,10 @@ ;; :num-kind :double|:long when every operand is that kind; these are the Chez ;; flonum/fixnum ops it lowers to — no generic dispatch, fixnums unboxed. fl?/fx? ;; comparisons carry the question mark; fl+/fx+ don't. +;; +;; CONTRACT: every op name jolt.passes.numeric/dbl-spec (resp. lng-spec) tags must +;; have an entry here, or emit-numeric splices a nil op string into the output. Keep +;; these tables and those specializers in sync. (def ^:private dbl-ops {"+" "fl+" "-" "fl-" "*" "fl*" "/" "fl/" "min" "flmin" "max" "flmax" "<" "fl" "fl>?" "<=" "fl<=?" ">=" "fl>=?" "=" "fl=?" "==" "fl=?"}) diff --git a/jolt-core/jolt/passes/numeric.clj b/jolt-core/jolt/passes/numeric.clj index 9f6e732..0bd9033 100644 --- a/jolt-core/jolt/passes/numeric.clj +++ b/jolt-core/jolt/passes/numeric.clj @@ -28,6 +28,8 @@ ;; result kind of a double-specialized op at this name/arity, or nil if N/A. ;; arithmetic -> :double; comparison -> :bool (operands specialized, result not numeric). +;; Every op name dbl-spec / lng-spec returns non-nil for must have a Chez op in +;; jolt.backend-scheme/dbl-ops resp. lng-ops, or emit-numeric splices a nil op. (defn- dbl-spec [nm n] (cond (and (>= n 1) (contains? #{"+" "-" "*" "/" "min" "max"} nm)) :double