[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] 03/10: Fix intmap-ref bug
From: |
Andy Wingo |
Subject: |
[Guile-commits] 03/10: Fix intmap-ref bug |
Date: |
Thu, 04 Jun 2015 22:57:49 +0000 |
wingo pushed a commit to branch master
in repository guile.
commit 1850497a5c6f7526c5129637c2e25f44a52c8cb7
Author: Andy Wingo <address@hidden>
Date: Wed Jun 3 17:42:58 2015 +0200
Fix intmap-ref bug
* module/language/cps/intmap.scm (intmap-ref): Fix a case in which the
not-found procedure could be called with an incorrect value.
---
module/language/cps/intmap.scm | 9 +++++----
1 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/module/language/cps/intmap.scm b/module/language/cps/intmap.scm
index e3fdc2f..ba9d1c0 100644
--- a/module/language/cps/intmap.scm
+++ b/module/language/cps/intmap.scm
@@ -393,11 +393,12 @@ already, and always calls the meet procedure."
(define* (intmap-ref map i #:optional (not-found (lambda (i)
(error "not found" i))))
+ (define (absent) (not-found i))
(define (ref min shift root)
(if (zero? shift)
(if (and min (= i min) (present? root))
root
- (not-found i))
+ (absent))
(if (and (<= min i) (< i (+ min (ash 1 shift))))
(let ((i (- i min)))
(let lp ((node root) (shift shift))
@@ -406,13 +407,13 @@ already, and always calls the meet procedure."
(let ((node (vector-ref node (logand i
*branch-mask*))))
(if (present? node)
node
- (not-found i)))
+ (absent)))
(let* ((shift (- shift *branch-bits*))
(idx (logand (ash i (- shift))
*branch-mask*)))
(lp (vector-ref node idx) shift)))
- (not-found i))))
- (not-found i))))
+ (absent))))
+ (absent))))
(match map
(($ <intmap> min shift root)
(ref min shift root))
- [Guile-commits] branch master updated (f541ee1 -> 6f4487f), Andy Wingo, 2015/06/04
- [Guile-commits] 01/10: Fix write beyond stack boundary in vm-engine.c, Andy Wingo, 2015/06/04
- [Guile-commits] 02/10: Fix slot allocation hinting for intervening terms that define dead values, Andy Wingo, 2015/06/04
- [Guile-commits] 03/10: Fix intmap-ref bug,
Andy Wingo <=
- [Guile-commits] 04/10: Fix eta reduction on CPS2, Andy Wingo, 2015/06/04
- [Guile-commits] 05/10: Port self-references pass to CPS2, Andy Wingo, 2015/06/04
- [Guile-commits] 09/10: Enable all CPS2 optimization passes, Andy Wingo, 2015/06/04
- [Guile-commits] 06/10: Refactor renumber.scm, Andy Wingo, 2015/06/04
- [Guile-commits] 08/10: Tweaks to bootstrap build order, Andy Wingo, 2015/06/04
- [Guile-commits] 10/10: Disable CPS optimization passes, Andy Wingo, 2015/06/04
- [Guile-commits] 07/10: Add CPS2 verification pass, Andy Wingo, 2015/06/04