guile-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Guile-commits] 03/04: Better range inference


From: Andy Wingo
Subject: [Guile-commits] 03/04: Better range inference
Date: Mon, 13 Nov 2017 09:27:16 -0500 (EST)

wingo pushed a commit to branch master
in repository guile.

commit dae0004627e3248db83278ac20599ff3fb308813
Author: Andy Wingo <address@hidden>
Date:   Mon Nov 13 14:31:36 2017 +0100

    Better range inference
    
    * module/language/cps/types.scm (&fx32-min, &fx32-max, &fx64-min)
      (&fx64-max): New internal definitions.
    * module/language/cps/types.scm (type-entry-saturating-union): Add more
      stops as we saturate ranges towards infinity.
---
 module/language/cps/types.scm | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/module/language/cps/types.scm b/module/language/cps/types.scm
index 81cb377..9e370f7 100644
--- a/module/language/cps/types.scm
+++ b/module/language/cps/types.scm
@@ -220,9 +220,13 @@
          (var (identifier? #'var)
               (datum->syntax #'var val)))))))
 
-(define-compile-time-value &s64-min (- #x8000000000000000))
-(define-compile-time-value &s64-max    #x7fffFFFFffffFFFF)
-(define-compile-time-value &u64-max    #xffffFFFFffffFFFF)
+(define-compile-time-value &fx32-min (- #x20000000))
+(define-compile-time-value &fx32-max    #x1fffFFFF)
+(define-compile-time-value &fx64-min (- #x2000000000000000))
+(define-compile-time-value &fx64-max    #x1fffFFFFffffFFFF)
+(define-compile-time-value &s64-min  (- #x8000000000000000))
+(define-compile-time-value &s64-max     #x7fffFFFFffffFFFF)
+(define-compile-time-value &u64-max     #xffffFFFFffffFFFF)
 
 (define-syntax &range-min (identifier-syntax &s64-min))
 (define-syntax &range-max (identifier-syntax &u64-max))
@@ -297,12 +301,17 @@
        (cond
         ((not (< b-min a-min)) a-min)
         ((< 0 b-min) 0)
+        ((< &fx32-min b-min) &fx32-min)
+        ((< &fx64-min b-min) &fx64-min)
         ((< &range-min b-min) &range-min)
         (else -inf.0)))
      (let ((a-max (type-entry-max a))
            (b-max (type-entry-max b)))
        (cond
         ((not (> b-max a-max)) a-max)
+        ((> &fx32-max b-max) &fx32-max)
+        ((> &fx64-max b-max) &fx64-max)
+        ((> &s64-max b-max) &s64-max)
         ((> &range-max b-max) &range-max)
         (else +inf.0)))))))
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]