summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2018-03-23 07:52:13 -0700
committerKaz Kylheku <kaz@kylheku.com>2018-03-23 07:52:13 -0700
commit72f2e9594bd2fcc709fc3822face6dbe42a18f0b (patch)
tree9cd4c90cb630fb47f6dde18c7ce3c021b57bf0ad
parent5b98c5370370a84001eb701f59062297bd929f10 (diff)
downloadtxr-72f2e9594bd2fcc709fc3822face6dbe42a18f0b.tar.gz
txr-72f2e9594bd2fcc709fc3822face6dbe42a18f0b.tar.bz2
txr-72f2e9594bd2fcc709fc3822face6dbe42a18f0b.zip
compiler: constant-optimize prog1
* share/txr/stdlib/compiler.tl (compiler comp-prog1): prog1 already uses progn. When using progn, though, it should append the nil form to the tail, otherwise progn will spare the last from from being eliminated, leaving an unused constant in the data table.
-rw-r--r--share/txr/stdlib/compiler.tl3
1 files changed, 2 insertions, 1 deletions
diff --git a/share/txr/stdlib/compiler.tl b/share/txr/stdlib/compiler.tl
index 573d4e37..0a473a74 100644
--- a/share/txr/stdlib/compiler.tl
+++ b/share/txr/stdlib/compiler.tl
@@ -568,7 +568,8 @@
(tree-case form
((prog1 fi . re) (let* ((igreg me.(alloc-treg))
(fi-frag me.(compile oreg env fi))
- (re-frag me.(comp-progn igreg env re)))
+ (re-frag me.(comp-progn igreg env
+ (append re '(nil)))))
me.(free-treg igreg)
(new (frag fi-frag.oreg
(append fi-frag.code re-frag.code)