From 11f7c39c03b7ed2ba5c46dc3d43774311d053c11 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Sun, 25 Mar 2018 08:02:40 -0700 Subject: compiler: setq bug: wrong return for globals. * share/txr/stdlib/compiler.tl (compiler comp-setq): The output register of the returned frag must be that of the value calculating frag, not vloc, because in the dynamic variable case, vloc holds the d-reg with the variable's name, not the v-reg that receives its value. (compiler compl-lisp1-setq): Fix same bug which got propagated by copy-and-paste coding. --- share/txr/stdlib/compiler.tl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/share/txr/stdlib/compiler.tl b/share/txr/stdlib/compiler.tl index 3fe8d595..406253a5 100644 --- a/share/txr/stdlib/compiler.tl +++ b/share/txr/stdlib/compiler.tl @@ -232,7 +232,7 @@ bind.loc me.(get-dreg sym))) (vfrag me.(compile (if bind vloc oreg) env value))) - (new (frag vloc + (new (frag vfrag.oreg ^(,*vfrag.code ,*(if bind (maybe-mov vloc vfrag.oreg) @@ -249,7 +249,7 @@ ((null bind) (let ((vfrag me.(compile oreg env val)) (l1loc me.(get-dreg sym))) - (new (frag l1loc + (new (frag vfrag.oreg ^(,*vfrag.code (setl1 ,vfrag.oreg ,l1loc)) (uni (list sym) vfrag.fvars) -- cgit v1.2.3