[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] 04/05: Fix bug in intmap-map
From: |
Andy Wingo |
Subject: |
[Guile-commits] 04/05: Fix bug in intmap-map |
Date: |
Sat, 26 Dec 2015 21:12:29 +0000 |
wingo pushed a commit to branch master
in repository guile.
commit 620b640a4eccf6fdaa9cda8dc77c415e975a1834
Author: Andy Wingo <address@hidden>
Date: Sat Dec 26 20:16:21 2015 +0100
Fix bug in intmap-map
* module/language/cps/utils.scm (intmap-map): Use transient intmap-add!
on an empty intmap to build the result instead of intmap-replace! on
the argument. Avoids spooky action-at-a-distance mutation of the
argument if it happens to be a transient -- although the intmap-fold
will correctly traverse a snapshot of the argument and the result will
be correct, the argument value would be modified in place, causing
strange results to calling code that passes in a transient.
---
module/language/cps/utils.scm | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/module/language/cps/utils.scm b/module/language/cps/utils.scm
index 64b403d..3fce00a 100644
--- a/module/language/cps/utils.scm
+++ b/module/language/cps/utils.scm
@@ -124,9 +124,9 @@ member, or @code{#f} otherwise."
(define (intmap-map proc map)
(persistent-intmap
- (intmap-fold (lambda (k v out) (intmap-replace! out k (proc k v)))
+ (intmap-fold (lambda (k v out) (intmap-add! out k (proc k v)))
map
- map)))
+ empty-intmap)))
(define (intmap-keys map)
"Return an intset of the keys in @var{map}."
- [Guile-commits] branch master updated (3c27145 -> a9c2606), Andy Wingo, 2015/12/26
- [Guile-commits] 02/05: Fix emit-receive* for many locals, Andy Wingo, 2015/12/26
- [Guile-commits] 04/05: Fix bug in intmap-map,
Andy Wingo <=
- [Guile-commits] 01/05: Assembler works on byte offsets, not u32 offsets, Andy Wingo, 2015/12/26
- [Guile-commits] 05/05: Type inference copes better with unsorted graphs, Andy Wingo, 2015/12/26
- [Guile-commits] 03/05: Assembler O(n) in instruction encodings, not instruction count, Andy Wingo, 2015/12/26