summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2020-05-02 22:25:05 -0700
committerKaz Kylheku <kaz@kylheku.com>2020-05-02 22:25:05 -0700
commitc536fa0d3c1d25260522a0f69a46b1dade973ffc (patch)
tree4f3bc3ab918437136e445516ac18d34091f89e06
parent96948355a291c4bba4a148a8bfe3cde9389e75d9 (diff)
downloadtxr-c536fa0d3c1d25260522a0f69a46b1dade973ffc.tar.gz
txr-c536fa0d3c1d25260522a0f69a46b1dade973ffc.tar.bz2
txr-c536fa0d3c1d25260522a0f69a46b1dade973ffc.zip
compiler: check constantp in load-time.
* share/txr/stdlib/compiler.tl (compiler comp-load-time-lit): Don't hoist constant expressions into load-time, since they already get hoisted into a D register. Otherwise we just end up generating load-time code that moves from one D register to another.
-rw-r--r--share/txr/stdlib/compiler.tl2
1 files changed, 1 insertions, 1 deletions
diff --git a/share/txr/stdlib/compiler.tl b/share/txr/stdlib/compiler.tl
index f1c4ca09..9b0c0334 100644
--- a/share/txr/stdlib/compiler.tl
+++ b/share/txr/stdlib/compiler.tl
@@ -1244,7 +1244,7 @@
(mac-param-bind form (op loaded-p exp) form
(cond
(loaded-p me.(compile oreg env ^(quote ,exp)))
- (*load-time* me.(compile oreg env exp))
+ ((or *load-time* (constantp exp)) me.(compile oreg env exp))
(t (compile-in-toplevel me
(let* ((*load-time* t)
(dreg me.(alloc-dreg))