diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2021-09-14 00:14:17 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2021-09-14 00:14:17 -0700 |
commit | 11c20a2342c69e720413def54332087ef7ab9d58 (patch) | |
tree | 410b8f9f8711f4beda16f67b4053a1cc46bd7595 | |
parent | bd959a4747f0a2fffe9aa18b5b94e64ee4ccb3b8 (diff) | |
download | txr-11c20a2342c69e720413def54332087ef7ab9d58.tar.gz txr-11c20a2342c69e720413def54332087ef7ab9d58.tar.bz2 txr-11c20a2342c69e720413def54332087ef7ab9d58.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.tl | 4 |
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))) |