summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2018-07-09 20:36:03 -0700
committerKaz Kylheku <kaz@kylheku.com>2018-07-09 20:36:03 -0700
commit4ff562efd5888c7699ec66927a570570800fede3 (patch)
tree50e54b5463ff45700883f41e946f7d9a861f02d4
parent80a2e703a3b288d85ebc4d6fba808e7e0f99c60b (diff)
downloadtxr-4ff562efd5888c7699ec66927a570570800fede3.tar.gz
txr-4ff562efd5888c7699ec66927a570570800fede3.tar.bz2
txr-4ff562efd5888c7699ec66927a570570800fede3.zip
compiler: don't hardcode eq in if optimization.
* share/txr/stdlib/compiler.tl (copmiler comp-ift): In the case when both values being compared are constant expressions, evaluate the comparison statically using the function, rather than a hard coded eq. Right now, the only funtion handled is in fact eq.
-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 d1f5c016..6d50296d 100644
--- a/share/txr/stdlib/compiler.tl
+++ b/share/txr/stdlib/compiler.tl
@@ -497,7 +497,7 @@
(set fun [%test-inv% fun])
(swap then else))
(if (and (constantp left) (constantp right))
- me.(compile oreg env (if (eq (eval left) (eval right)) then else))
+ me.(compile oreg env (if (call fun (eval left) (eval right)) then else))
(let* ((le-oreg me.(alloc-treg))
(ri-oreg me.(alloc-treg))
(lelse (gensym "l"))