From 983d325544b6c587beea0206ac46d6d12dcdb1ff Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Sat, 2 May 2020 22:25:05 -0700 Subject: 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. --- share/txr/stdlib/compiler.tl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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)) -- cgit v1.2.3