[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] 26/41: Slower range saturation in type inference
From: |
Andy Wingo |
Subject: |
[Guile-commits] 26/41: Slower range saturation in type inference |
Date: |
Wed, 02 Dec 2015 08:06:54 +0000 |
wingo pushed a commit to branch master
in repository guile.
commit 672853657c3775bb822a53d65785c69c545201ab
Author: Andy Wingo <address@hidden>
Date: Fri Nov 20 13:23:32 2015 +0100
Slower range saturation in type inference
* module/language/cps/types.scm (*max-size-t*): New definition.
(type-entry-saturating-union): Saturate more slowly, first stopping at
[0,*max-size-t*] then at [&range-min, &range-max] before saturating to
[-inf.0, +inf.0]. This allows most offset phi variables to have their
range inferred within the u64 range.
---
module/language/cps/types.scm | 21 +++++++++++++++++++--
1 files changed, 19 insertions(+), 2 deletions(-)
diff --git a/module/language/cps/types.scm b/module/language/cps/types.scm
index 41d4f56..543f550 100644
--- a/module/language/cps/types.scm
+++ b/module/language/cps/types.scm
@@ -206,6 +206,15 @@
(define-compile-time-value &range-min (- #x8000000000000000))
(define-compile-time-value &range-max #xffffFFFFffffFFFF)
+;; This is a hack that takes advantage of knowing that
+;; most-positive-fixnum is the size of a word, but with two tag bits and
+;; one sign bit. We also assume that the current common architectural
+;; restriction of a maximum 48-bit address space means that we won't see
+;; a size_t value above 2^48.
+(define *max-size-t*
+ (min (+ (ash most-positive-fixnum 3) #b111)
+ (1- (ash 1 48))))
+
(define-inlinable (make-unclamped-type-entry type min max)
(vector type min max))
(define-inlinable (type-entry-type tentry)
@@ -271,10 +280,18 @@
(logior (type-entry-type a) (type-entry-type b))
(let ((a-min (type-entry-min a))
(b-min (type-entry-min b)))
- (if (< b-min a-min) -inf.0 a-min))
+ (cond
+ ((not (< b-min a-min)) a-min)
+ ((> 0 b-min) 0)
+ ((> &range-min b-min) &range-min)
+ (else -inf.0)))
(let ((a-max (type-entry-max a))
(b-max (type-entry-max b)))
- (if (> b-max a-max) +inf.0 a-max))))))
+ (cond
+ ((not (> b-max a-max)) a-max)
+ ((> *max-size-t* b-max) *max-size-t*)
+ ((> &range-max b-max) &range-max)
+ (else +inf.0)))))))
(define (type-entry-intersection a b)
(cond
- [Guile-commits] 15/41: Remove frame-procedure, (continued)
- [Guile-commits] 15/41: Remove frame-procedure, Andy Wingo, 2015/12/02
- [Guile-commits] 13/41: Remove `procedure' repl command, Andy Wingo, 2015/12/02
- [Guile-commits] 14/41: VM traps don't match on value of slot 0, Andy Wingo, 2015/12/02
- [Guile-commits] 17/41: Remove frame->module, Andy Wingo, 2015/12/02
- [Guile-commits] 19/41: Add bv-length instruction, Andy Wingo, 2015/12/02
- [Guile-commits] 18/41: Range inference over the full U64+S64 range, Andy Wingo, 2015/12/02
- [Guile-commits] 20/41: bv-f{32, 64}-{ref, set!} take unboxed u64 index, Andy Wingo, 2015/12/02
- [Guile-commits] 23/41: Beginning of u64 phi unboxing, Andy Wingo, 2015/12/02
- [Guile-commits] 16/41: Add low-level support for unboxed 64-bit unsigned ints, Andy Wingo, 2015/12/02
- [Guile-commits] 22/41: Specialize u64 comparisons, Andy Wingo, 2015/12/02
- [Guile-commits] 26/41: Slower range saturation in type inference,
Andy Wingo <=
- [Guile-commits] 21/41: Add instructions to branch on u64 comparisons, Andy Wingo, 2015/12/02
- [Guile-commits] 25/41: Add unsigned 64-bit arithmetic operators: uadd, usub, umul, Andy Wingo, 2015/12/02
- [Guile-commits] 24/41: Unbox u64 phi values, Andy Wingo, 2015/12/02
- [Guile-commits] 28/41: Specialize u64 arithmetic, Andy Wingo, 2015/12/02
- [Guile-commits] 37/41: Disable warnings on bootstrap build, Andy Wingo, 2015/12/02
- [Guile-commits] 35/41: Add current-thread VM op, Andy Wingo, 2015/12/02
- [Guile-commits] 27/41: Better range inference for indexes of vector-ref, string-ref et al, Andy Wingo, 2015/12/02
- [Guile-commits] 29/41: Remove add1 and sub1, Andy Wingo, 2015/12/02
- [Guile-commits] 30/41: Add tagged and untagged arithmetic ops with immediate operands, Andy Wingo, 2015/12/02
- [Guile-commits] 32/41: Add support for unboxed s64 values, Andy Wingo, 2015/12/02