summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2018-04-01 10:47:14 -0700
committerKaz Kylheku <kaz@kylheku.com>2018-04-01 10:47:14 -0700
commit4567fe9b8c9937414ee7f3367279f2e204159438 (patch)
tree9b0dbf0dce71c05ef916a41822a41ff524cc944e
parenta90b5a19094bd2fc0178897afa3c385227a96ad1 (diff)
downloadtxr-4567fe9b8c9937414ee7f3367279f2e204159438.tar.gz
txr-4567fe9b8c9937414ee7f3367279f2e204159438.tar.bz2
txr-4567fe9b8c9937414ee7f3367279f2e204159438.zip
compiler: bugfix: incorrect jmp in catch.
* share/txr/stdlib/compiler.tl (comp-catch): The emitted code doesn't handle the normal non-exception path. It assumes that only the frame established with the earlier frame instruction needs to be terminated; but in fact the catch intruction's frame has to be ended also. Thus we don't need the frame-end label; all exit cases jump too the handler-end label in front of the two end instructions.
-rw-r--r--share/txr/stdlib/compiler.tl4
1 files changed, 1 insertions, 3 deletions
diff --git a/share/txr/stdlib/compiler.tl b/share/txr/stdlib/compiler.tl
index c8563bea..7a289290 100644
--- a/share/txr/stdlib/compiler.tl
+++ b/share/txr/stdlib/compiler.tl
@@ -521,7 +521,6 @@
(tfrag me.(compile oreg env try-expr))
(lhand (gensym "l"))
(lhend (gensym "l"))
- (lfrend (gensym "l"))
(nclauses (len clauses))
(cfrags (collect-each ((cl clauses)
(i (range 1)))
@@ -547,12 +546,11 @@
^((frame ,nenv.lev ,nenv.v-cntr)
(catch ,esvb.loc ,eavb.loc ,me.(get-dreg symbols) ,lhand)
,*tfrag.code
- (jmp ,lfrend)
+ (jmp ,lhend)
,lhand
,*(mappend .code cfrags)
,lhend
(end ,tfrag.oreg)
- ,lfrend
(end ,tfrag.oreg))
(uni tfrag.fvars [reduce-left uni cfrags nil .fvars])
(uni tfrag.ffuns [reduce-left uni cfrags nil .ffuns])))))))