summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2021-09-14 00:14:17 -0700
committerKaz Kylheku <kaz@kylheku.com>2021-09-14 00:14:17 -0700
commit44f4ef01ce095d334769b071460f19c5d74217c3 (patch)
tree410b8f9f8711f4beda16f67b4053a1cc46bd7595
parentcd1260bb180dae6686a7059540e49ebe9f1b7543 (diff)
downloadtxr-44f4ef01ce095d334769b071460f19c5d74217c3.tar.gz
txr-44f4ef01ce095d334769b071460f19c5d74217c3.tar.bz2
txr-44f4ef01ce095d334769b071460f19c5d74217c3.zip
compiler: fix random perturbance in reg allocation.
At optimization level 2 or higher, an issue occurs whereby code generation exhibits instabilities. The same code is compiled slightly differently (but not incorrectly) depending on irrelevant circumstances, due to some different registers being used. * stdlib/compiler.tl (compiler eliminate-frame): Do not free the newly allocated t-registers inside a dohash loop. We have a separate list of them in order; just hand that off to free-tregs. The dohash loop is not ordered, because it traverses a hash, which is keyed by object identities; i.e. machine addresses assigned by memory allocation.
-rw-r--r--stdlib/compiler.tl4
1 files changed, 2 insertions, 2 deletions
diff --git a/stdlib/compiler.tl b/stdlib/compiler.tl
index 82450528..e2301296 100644
--- a/stdlib/compiler.tl
+++ b/stdlib/compiler.tl
@@ -914,8 +914,8 @@
((@else . @rest) (list else))))))
(dohash (loc treg trhash)
(let ((vb [vbhash loc]))
- (set vb.loc treg)
- me.(free-treg treg)))
+ (set vb.loc treg)))
+ me.(free-tregs tregs)
(if (plusp me.loop-nest)
(append (mapcar (ret ^(mov ,@1 (t 0))) (nreverse tregs)) ncode)
ncode)))