Disable constant-folding machine-dependent primitives in LIARC.
authorTaylor R Campbell <campbell@mumble.net>
Thu, 10 Jan 2019 04:01:57 +0000 (04:01 +0000)
committerTaylor R Campbell <campbell@mumble.net>
Thu, 10 Jan 2019 04:06:23 +0000 (04:06 +0000)
These are not valid across word size changes, but LIARC does not
expose compiler:cross-compiling?.

src/compiler/base/utils.scm

index 13c54ed4a145f81343744c51da5ef5d6643c5381..d580de2d8a7091f163ecaad99f3e6507a67b2e28 100644 (file)
@@ -541,7 +541,11 @@ USA.
 
 (define (constant-foldable-primitive? operator)
   (and (memq operator function-primitives)
-       (not (and compiler:cross-compiling?
+       (not (and (or compiler:cross-compiling?
+                    ;; C back end never sets COMPILER:CROSS-COMPILING?
+                    ;; but it has a nonconstant SCHEME-OBJECT-WIDTH
+                    ;; which serves as a proxy.
+                    (not (number? scheme-object-width)))
                 (memq operator machine-dependent-primitives)))))
 
 (define-integrable (side-effect-free-primitive? operator)