From f6590e9db20b923d6a680a3dabfa95693cd91a5c Mon Sep 17 00:00:00 2001 From: Vincent St-Amour Date: Wed, 12 Jan 2011 14:59:42 -0500 Subject: [PATCH] Fix optimizer to work with new types. original commit: 768bb6336142726023bfe2029b5aa25728bda0a3 --- .../optimizer/tests/float-complex-float-div.rkt | 2 +- .../typed-scheme/optimizer/tests/nested-let-loop.rkt | 12 ++++++------ .../typed-scheme/optimizer/tests/sqrt-segfault.rkt | 4 ++-- .../typed-scheme/optimizer/tests/unboxed-for.rkt | 4 ++-- .../optimizer/tests/unboxed-let-functions1.rkt | 2 +- .../optimizer/tests/unboxed-let-functions2.rkt | 2 +- .../optimizer/tests/unboxed-let-functions3.rkt | 2 +- .../optimizer/tests/unboxed-let-functions4.rkt | 2 +- .../optimizer/tests/unboxed-let-functions5.rkt | 6 +++--- .../optimizer/tests/unboxed-let-functions6.rkt | 2 +- .../optimizer/tests/unboxed-let-functions7.rkt | 2 +- .../optimizer/tests/unboxed-let-functions8.rkt | 4 ++-- .../typed-scheme/optimizer/tests/unboxed-letrec.rkt | 4 ++-- collects/typed-scheme/optimizer/fixnum.rkt | 2 +- 14 files changed, 25 insertions(+), 25 deletions(-) diff --git a/collects/tests/typed-scheme/optimizer/tests/float-complex-float-div.rkt b/collects/tests/typed-scheme/optimizer/tests/float-complex-float-div.rkt index 20e64f21..4f6f6829 100644 --- a/collects/tests/typed-scheme/optimizer/tests/float-complex-float-div.rkt +++ b/collects/tests/typed-scheme/optimizer/tests/float-complex-float-div.rkt @@ -43,7 +43,7 @@ float-complex-float-div.rkt line 56 col 6 - (#%app / (quote 1.0) (quote 2.0) (qu #lang typed/scheme #:optimize -(map (lambda: ((x : Inexact-Complex)) +(map (lambda: ((x : Float-Complex)) (string-append (real->decimal-string (real-part x) 10) (real->decimal-string (imag-part x) 10))) (list diff --git a/collects/tests/typed-scheme/optimizer/tests/nested-let-loop.rkt b/collects/tests/typed-scheme/optimizer/tests/nested-let-loop.rkt index 8a44e45b..ce926a25 100644 --- a/collects/tests/typed-scheme/optimizer/tests/nested-let-loop.rkt +++ b/collects/tests/typed-scheme/optimizer/tests/nested-let-loop.rkt @@ -44,14 +44,14 @@ nested-let-loop.rkt line 47 col 6 - loop1 - unboxed let loop -(let: loop1 : Inexact-Complex - ((x : (Listof Inexact-Complex) '(1.0+2.0i 2.0+4.0i)) - (r : Inexact-Complex 0.0+0.0i)) +(let: loop1 : Float-Complex + ((x : (Listof Float-Complex) '(1.0+2.0i 2.0+4.0i)) + (r : Float-Complex 0.0+0.0i)) (if (null? x) r - (let: loop2 : Inexact-Complex - ((y : (Listof Inexact-Complex) '(3.0+6.0i 4.0+8.0i)) - (s : Inexact-Complex 0.0+0.0i)) + (let: loop2 : Float-Complex + ((y : (Listof Float-Complex) '(3.0+6.0i 4.0+8.0i)) + (s : Float-Complex 0.0+0.0i)) (if (null? y) (loop1 (cdr x) (+ r s)) (loop2 (cdr y) (+ s (car x) (car y))))))) diff --git a/collects/tests/typed-scheme/optimizer/tests/sqrt-segfault.rkt b/collects/tests/typed-scheme/optimizer/tests/sqrt-segfault.rkt index a72b5155..39e25781 100644 --- a/collects/tests/typed-scheme/optimizer/tests/sqrt-segfault.rkt +++ b/collects/tests/typed-scheme/optimizer/tests/sqrt-segfault.rkt @@ -10,9 +10,9 @@ sqrt-segfault.rkt line 19 col 15 - * - binary float ;; from the nbody-generic benchmark. -;; the result of sqrt was an Inexact-Complex, so float complex opts kicked +;; the result of sqrt was an Float-Complex, so float complex opts kicked ;; in but they resulted in segfaulting code. -;; the problem was that having Float be a subtype of Inexact-Complex was wrong +;; the problem was that having Float be a subtype of Float-Complex was wrong ;; since you can't do unsafe-flreal-part of a float (let* ([dx (- 0.0 0.0)] diff --git a/collects/tests/typed-scheme/optimizer/tests/unboxed-for.rkt b/collects/tests/typed-scheme/optimizer/tests/unboxed-for.rkt index bf7dffc8..945bc162 100644 --- a/collects/tests/typed-scheme/optimizer/tests/unboxed-for.rkt +++ b/collects/tests/typed-scheme/optimizer/tests/unboxed-for.rkt @@ -48,6 +48,6 @@ unboxed-for.rkt line 51 col 0 - (letrec-values (((for-loop) (lambda (sum pos) (i -(for/fold: : Inexact-Complex ((sum : Inexact-Complex 0.0+0.0i)) - ((i : Inexact-Complex '(1.0+2.0i 2.0+4.0i))) +(for/fold: : Float-Complex ((sum : Float-Complex 0.0+0.0i)) + ((i : Float-Complex '(1.0+2.0i 2.0+4.0i))) (+ i sum)) diff --git a/collects/tests/typed-scheme/optimizer/tests/unboxed-let-functions1.rkt b/collects/tests/typed-scheme/optimizer/tests/unboxed-let-functions1.rkt index 991ee793..be9c8625 100644 --- a/collects/tests/typed-scheme/optimizer/tests/unboxed-let-functions1.rkt +++ b/collects/tests/typed-scheme/optimizer/tests/unboxed-let-functions1.rkt @@ -25,5 +25,5 @@ unboxed-let-functions1.rkt line 29 col 3 - f - call to fun with unboxed args ;; simple case, function with single complex arg -(let ((f (lambda: ((x : Inexact-Complex)) (+ x 3.0+6.0i)))) +(let ((f (lambda: ((x : Float-Complex)) (+ x 3.0+6.0i)))) (f (+ 1.0+2.0i 2.0+4.0i))) diff --git a/collects/tests/typed-scheme/optimizer/tests/unboxed-let-functions2.rkt b/collects/tests/typed-scheme/optimizer/tests/unboxed-let-functions2.rkt index 4282f227..12184377 100644 --- a/collects/tests/typed-scheme/optimizer/tests/unboxed-let-functions2.rkt +++ b/collects/tests/typed-scheme/optimizer/tests/unboxed-let-functions2.rkt @@ -31,7 +31,7 @@ unboxed-let-functions2.rkt line 36 col 3 - f - call to fun with unboxed args ;; function with multiple complex args -(let ((f (lambda: ((x : Inexact-Complex) (y : Inexact-Complex)) +(let ((f (lambda: ((x : Float-Complex) (y : Float-Complex)) (+ x y)))) (f (+ 1.0+2.0i 2.0+4.0i) 3.0+6.0i)) diff --git a/collects/tests/typed-scheme/optimizer/tests/unboxed-let-functions3.rkt b/collects/tests/typed-scheme/optimizer/tests/unboxed-let-functions3.rkt index 737a2068..0e41fbde 100644 --- a/collects/tests/typed-scheme/optimizer/tests/unboxed-let-functions3.rkt +++ b/collects/tests/typed-scheme/optimizer/tests/unboxed-let-functions3.rkt @@ -25,7 +25,7 @@ unboxed-let-functions3.rkt line 30 col 3 - f - call to fun with unboxed args ;; function with a mix of complex and non-complex args -(let ((f (lambda: ((x : Inexact-Complex) (y : Float)) +(let ((f (lambda: ((x : Float-Complex) (y : Float)) (+ x y)))) (f (+ 1.0+2.0i 2.0+4.0i) 3.0)) diff --git a/collects/tests/typed-scheme/optimizer/tests/unboxed-let-functions4.rkt b/collects/tests/typed-scheme/optimizer/tests/unboxed-let-functions4.rkt index 12f4d0a0..4a8c8eef 100644 --- a/collects/tests/typed-scheme/optimizer/tests/unboxed-let-functions4.rkt +++ b/collects/tests/typed-scheme/optimizer/tests/unboxed-let-functions4.rkt @@ -25,7 +25,7 @@ unboxed-let-functions4.rkt line 30 col 3 - f - call to fun with unboxed args ;; function with a mix of complex and non-complex args, non-complex first -(let ((f (lambda: ((y : Float) (x : Inexact-Complex)) +(let ((f (lambda: ((y : Float) (x : Float-Complex)) (+ x y)))) (f 3.0 (+ 1.0+2.0i 2.0+4.0i))) diff --git a/collects/tests/typed-scheme/optimizer/tests/unboxed-let-functions5.rkt b/collects/tests/typed-scheme/optimizer/tests/unboxed-let-functions5.rkt index 0505dea8..9cc06c17 100644 --- a/collects/tests/typed-scheme/optimizer/tests/unboxed-let-functions5.rkt +++ b/collects/tests/typed-scheme/optimizer/tests/unboxed-let-functions5.rkt @@ -13,8 +13,8 @@ unboxed-let-functions5.rkt line 20 col 12 - (#%app + (quote 1.0+2.0i) (quote 2.0 ;; invalid: f "escapes", according to our analysis -(letrec: ((f : (Inexact-Complex -> Inexact-Complex) - (lambda: ((x : Inexact-Complex)) - (let: ((y : (Inexact-Complex -> Inexact-Complex) f)) +(letrec: ((f : (Float-Complex -> Float-Complex) + (lambda: ((x : Float-Complex)) + (let: ((y : (Float-Complex -> Float-Complex) f)) x)))) (f (+ 1.0+2.0i 2.0+4.0i))) diff --git a/collects/tests/typed-scheme/optimizer/tests/unboxed-let-functions6.rkt b/collects/tests/typed-scheme/optimizer/tests/unboxed-let-functions6.rkt index 8f52c88d..397416ce 100644 --- a/collects/tests/typed-scheme/optimizer/tests/unboxed-let-functions6.rkt +++ b/collects/tests/typed-scheme/optimizer/tests/unboxed-let-functions6.rkt @@ -29,7 +29,7 @@ unboxed-let-functions6.rkt line 32 col 6 - loop - unboxed let loop -(let: loop : Inexact-Complex ((z : Inexact-Complex 0.0+0.0i) +(let: loop : Float-Complex ((z : Float-Complex 0.0+0.0i) (l : (Listof Integer) '(1 2 3))) (if (null? l) (+ z 0.0+1.0i) diff --git a/collects/tests/typed-scheme/optimizer/tests/unboxed-let-functions7.rkt b/collects/tests/typed-scheme/optimizer/tests/unboxed-let-functions7.rkt index 96e07c09..f04d6edf 100644 --- a/collects/tests/typed-scheme/optimizer/tests/unboxed-let-functions7.rkt +++ b/collects/tests/typed-scheme/optimizer/tests/unboxed-let-functions7.rkt @@ -27,7 +27,7 @@ unboxed-let-functions7.rkt line 30 col 6 - loop - unboxed let loop -(let: loop : Inexact-Complex ((z : Inexact-Complex 0.0+0.0i) +(let: loop : Float-Complex ((z : Float-Complex 0.0+0.0i) (l : (Listof Integer) '(1 2 3))) (if (null? l) z ; boxed use. z should be unboxed anyway diff --git a/collects/tests/typed-scheme/optimizer/tests/unboxed-let-functions8.rkt b/collects/tests/typed-scheme/optimizer/tests/unboxed-let-functions8.rkt index 73f41df3..84f71ce8 100644 --- a/collects/tests/typed-scheme/optimizer/tests/unboxed-let-functions8.rkt +++ b/collects/tests/typed-scheme/optimizer/tests/unboxed-let-functions8.rkt @@ -12,6 +12,6 @@ unboxed-let-functions8.rkt line 15 col 64 - (#%app + x (quote 2.0+4.0i)) - unbox -(letrec: ((f : (Inexact-Complex -> Inexact-Complex) (lambda (x) (+ x 2.0+4.0i))) - (g : (Inexact-Complex -> Inexact-Complex) f)) ; f escapes! can't unbox it's args +(letrec: ((f : (Float-Complex -> Float-Complex) (lambda (x) (+ x 2.0+4.0i))) + (g : (Float-Complex -> Float-Complex) f)) ; f escapes! can't unbox it's args (f 1.0+2.0i)) diff --git a/collects/tests/typed-scheme/optimizer/tests/unboxed-letrec.rkt b/collects/tests/typed-scheme/optimizer/tests/unboxed-letrec.rkt index 0b67b172..022f5a58 100644 --- a/collects/tests/typed-scheme/optimizer/tests/unboxed-letrec.rkt +++ b/collects/tests/typed-scheme/optimizer/tests/unboxed-letrec.rkt @@ -26,6 +26,6 @@ unboxed-letrec.rkt line 31 col 2 - (#%app + x y) - unboxed float complex (letrec: ((f : (Any -> Any) (lambda: ((x : Any)) (f x))) - (x : Inexact-Complex 1.0+2.0i) - (y : Inexact-Complex (+ 2.0+4.0i 3.0+6.0i))) + (x : Float-Complex 1.0+2.0i) + (y : Float-Complex (+ 2.0+4.0i 3.0+6.0i))) (+ x y)) diff --git a/collects/typed-scheme/optimizer/fixnum.rkt b/collects/typed-scheme/optimizer/fixnum.rkt index db6764fb..2f4fe204 100644 --- a/collects/typed-scheme/optimizer/fixnum.rkt +++ b/collects/typed-scheme/optimizer/fixnum.rkt @@ -55,7 +55,7 @@ (define-syntax-class nonzero-fixnum-expr #:commit (pattern e:expr - #:when (or (isoftype? #'e -PositiveFixnum) (isoftype? #'e -NegativeFixnum)) + #:when (or (subtypeof? #'e -PositiveFixnum) (subtypeof? #'e -NegativeFixnum)) #:with opt ((optimize) #'e))) (define-syntax-class fixnum-opt-expr