diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2018-04-02 08:19:55 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2018-04-02 08:19:55 -0700 |
commit | c6a4325717a7a5a9dc6f086cd56a28fd6e36a557 (patch) | |
tree | 1ccdd9bf50e10802cfafda8e7cc4a809dca43e12 /share | |
parent | 65fa23daa475b3fb8a9922508a980529c74933aa (diff) | |
download | txr-c6a4325717a7a5a9dc6f086cd56a28fd6e36a557.tar.gz txr-c6a4325717a7a5a9dc6f086cd56a28fd6e36a557.tar.bz2 txr-c6a4325717a7a5a9dc6f086cd56a28fd6e36a557.zip |
compiler: switch: bugfix: missing mov to oreg.
* share/txr/stdlib/compiler.tl (comp-switch): When compiling
the shared case of switch (generated by tagbody), we must
identify the last fragment's output register and move that to
oreg.
Diffstat (limited to 'share')
-rw-r--r-- | share/txr/stdlib/compiler.tl | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/share/txr/stdlib/compiler.tl b/share/txr/stdlib/compiler.tl index 73258677..c9d9bd05 100644 --- a/share/txr/stdlib/compiler.tl +++ b/share/txr/stdlib/compiler.tl @@ -435,10 +435,13 @@ (clabels (mapcar (ret (gensym "l")) cases)) (treg me.(maybe-alloc-treg oreg)) (ifrag me.(compile treg env idx-form)) + last-cfrag (cfrags (collect-each ((cs cases) (lb clabels) (i (range 1))) (let ((cfrag me.(comp-progn oreg env cs))) + (when (eq i ncases) + (set last-cfrag cfrag)) (new (frag oreg ^(,lb ,*cfrag.code @@ -452,6 +455,8 @@ ^(,*ifrag.code (swtch ,ifrag.oreg ,*clabels) ,*(mappend .code cfrags) + ,*(when (and shared last-cfrag) + (maybe-mov oreg last-cfrag.oreg)) ,lend) (uni ifrag.fvars [reduce-left uni cfrags nil .fvars]) (uni ifrag.ffuns [reduce-left uni cfrags nil .ffuns])))))) |