[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] 18/27: Type inference distinguishes between untagged and
From: |
Andy Wingo |
Subject: |
[Guile-commits] 18/27: Type inference distinguishes between untagged and tagged flonums |
Date: |
Wed, 11 Nov 2015 11:39:13 +0000 |
wingo pushed a commit to branch master
in repository guile.
commit 608753982f012d40a466fe08a86041e92a85f908
Author: Andy Wingo <address@hidden>
Date: Wed Nov 11 10:14:51 2015 +0100
Type inference distinguishes between untagged and tagged flonums
* module/language/cps/types.scm (&f64): New type, for untagged f64
values. Having a distinct type prevents type folding from replacing
an untagged 3.0 with a tagged 3.0.
(scm->f64, f64->scm): Support these new primcalls.
---
module/language/cps/types.scm | 25 ++++++++++++++++++++++++-
1 files changed, 24 insertions(+), 1 deletions(-)
diff --git a/module/language/cps/types.scm b/module/language/cps/types.scm
index 55cde27..fc23e16 100644
--- a/module/language/cps/types.scm
+++ b/module/language/cps/types.scm
@@ -117,6 +117,9 @@
;; Union types.
&number &real
+ ;; Untagged types.
+ &f64
+
infer-types
lookup-pre-type
lookup-post-type
@@ -164,7 +167,9 @@
&bytevector
&bitvector
&array
- &hash-table)
+ &hash-table
+
+ &f64)
(define-syntax &no-type (identifier-syntax 0))
@@ -673,6 +678,24 @@ minimum, and maximum."
;;;
+;;; Unboxed double-precision floating-point numbers.
+;;;
+
+(define-type-checker (scm->f64 scm)
+ (check-type scm &real -inf.0 +inf.0))
+(define-type-inferrer (scm->f64 scm result)
+ (restrict! scm &real -inf.0 +inf.0)
+ (define! result &f64 (&min scm) (&max scm)))
+
+(define-type-checker (f64->scm f64)
+ #t)
+(define-type-inferrer (f64->scm f64 result)
+ (define! result &flonum (&min f64) (&max f64)))
+
+
+
+
+;;;
;;; Bytevectors.
;;;
- [Guile-commits] 19/27: bv-{f32, f64}-{ref, set!} operate on raw f64 values, (continued)
- [Guile-commits] 19/27: bv-{f32, f64}-{ref, set!} operate on raw f64 values, Andy Wingo, 2015/11/11
- [Guile-commits] 25/27: Better f64 unboxing for loop vars that might flow to $ktail, Andy Wingo, 2015/11/11
- [Guile-commits] 17/27: Add VM ops to pack and unpack raw f64 values., Andy Wingo, 2015/11/11
- [Guile-commits] 03/27: CSE can run on first-order CPS, Andy Wingo, 2015/11/11
- [Guile-commits] 16/27: Stack slots can hold a double, Andy Wingo, 2015/11/11
- [Guile-commits] 12/27: Remove return opcode, Andy Wingo, 2015/11/11
- [Guile-commits] 09/27: Always emit return-values, Andy Wingo, 2015/11/11
- [Guile-commits] 08/27: Replace return primcalls with $values, Andy Wingo, 2015/11/11
- [Guile-commits] 24/27: The compiler can unbox float64 loop variables, Andy Wingo, 2015/11/11
- [Guile-commits] 26/27: Remove debug printout in specialize-numbers, Andy Wingo, 2015/11/11
- [Guile-commits] 18/27: Type inference distinguishes between untagged and tagged flonums,
Andy Wingo <=
- [Guile-commits] 02/27: Revert "Bootstrap build doesn't have to expand CPS optimizations", Andy Wingo, 2015/11/11