summaryrefslogtreecommitdiffstats
path: root/stdlib/optimize.tl
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2025-06-18 00:13:33 -0700
committerKaz Kylheku <kaz@kylheku.com>2025-06-18 00:13:33 -0700
commit54a76c674e18e079b4a4f4338f41e44bfd5ed3e3 (patch)
tree10498f76e33f907f8ee2d6dd3313302ba39dafc3 /stdlib/optimize.tl
parentb6479c689570ae3df42a45da6d96fc679a5925f3 (diff)
downloadtxr-54a76c674e18e079b4a4f4338f41e44bfd5ed3e3.tar.gz
txr-54a76c674e18e079b4a4f4338f41e44bfd5ed3e3.tar.bz2
txr-54a76c674e18e079b4a4f4338f41e44bfd5ed3e3.zip
compiler: bug: handling of block returns.
The handling of block returning instructions ret and abscsr is incorrect and causes miscompilations, such as infinite loops. * stdlib/optimize.tl (basic-blocks jump-ops): Remove ret and abscsr. These instructions will no longer terminate basic blocks. (basic-blocks link-graph): Remove the instructions from the pattern match here; they won't occur any more as the last instruction of a block. Note that they were being handled together as a jend: effectively as a signal indicating the brick wall end of control flow with no next basic block. This is what caused the problems.
Diffstat (limited to 'stdlib/optimize.tl')
-rw-r--r--stdlib/optimize.tl4
1 files changed, 2 insertions, 2 deletions
diff --git a/stdlib/optimize.tl b/stdlib/optimize.tl
index 788e1d04..2e0b2aa5 100644
--- a/stdlib/optimize.tl
+++ b/stdlib/optimize.tl
@@ -76,7 +76,7 @@
tryjoin
warned-insns
(:static start (gensym "start-"))
- (:static jump-ops '(jmp if ifq ifql close swtch ret abscsr
+ (:static jump-ops '(jmp if ifq ifql close swtch
uwprot catch block jend xend))
(:postinit (bb)
@@ -173,7 +173,7 @@
(set bl.links (list [bb.hash slabel])))
((uwprot @clabel)
(set bl.links (list [bb.hash clabel])))
- ((@(or abscsr ret jend) . @nil)
+ ((jend . @nil)
(set link-next nil))
((xend . @nil)
(set bl.nojoin t)))