diff --git a/collects/tests/typed-scheme/optimizer/generic/unboxed-let-functions2.rkt b/collects/tests/typed-scheme/optimizer/generic/unboxed-let-functions2.rkt new file mode 100644 index 0000000000..9c9238003a --- /dev/null +++ b/collects/tests/typed-scheme/optimizer/generic/unboxed-let-functions2.rkt @@ -0,0 +1,9 @@ +#lang typed/scheme #:optimize + +(require racket/unsafe/ops) + +;; function with multiple complex args +(let ((f (lambda: ((x : Inexact-Complex) (y : Inexact-Complex)) + (+ x y)))) + (f (+ 1.0+2.0i 2.0+4.0i) + 3.0+6.0i)) diff --git a/collects/tests/typed-scheme/optimizer/generic/unboxed-let-functions3.rkt b/collects/tests/typed-scheme/optimizer/generic/unboxed-let-functions3.rkt new file mode 100644 index 0000000000..9bc0f44c9a --- /dev/null +++ b/collects/tests/typed-scheme/optimizer/generic/unboxed-let-functions3.rkt @@ -0,0 +1,9 @@ +#lang typed/scheme #:optimize + +(require racket/unsafe/ops) + +;; function with a mix of complex and non-complex args +(let ((f (lambda: ((x : Inexact-Complex) (y : Float)) + (+ x y)))) + (f (+ 1.0+2.0i 2.0+4.0i) + 3.0)) diff --git a/collects/tests/typed-scheme/optimizer/generic/unboxed-let-functions4.rkt b/collects/tests/typed-scheme/optimizer/generic/unboxed-let-functions4.rkt new file mode 100644 index 0000000000..eef4690197 --- /dev/null +++ b/collects/tests/typed-scheme/optimizer/generic/unboxed-let-functions4.rkt @@ -0,0 +1,9 @@ +#lang typed/scheme #:optimize + +(require racket/unsafe/ops) + +;; function with a mix of complex and non-complex args, non-complex first +(let ((f (lambda: ((y : Float) (x : Inexact-Complex)) + (+ x y)))) + (f 3.0 + (+ 1.0+2.0i 2.0+4.0i))) diff --git a/collects/tests/typed-scheme/optimizer/generic/unboxed-let-functions5.rkt b/collects/tests/typed-scheme/optimizer/generic/unboxed-let-functions5.rkt new file mode 100644 index 0000000000..7b6859422c --- /dev/null +++ b/collects/tests/typed-scheme/optimizer/generic/unboxed-let-functions5.rkt @@ -0,0 +1,10 @@ +#lang typed/scheme #:optimize + +(require racket/unsafe/ops) + +;; invalid: f "escapes", according to our analysis +(letrec: ((f : (Inexact-Complex -> Inexact-Complex) + (lambda: ((x : Inexact-Complex)) + (let: ((y : (Inexact-Complex -> Inexact-Complex) f)) + x)))) + (f (+ 1.0+2.0i 2.0+4.0i))) diff --git a/collects/tests/typed-scheme/optimizer/hand-optimized/unboxed-let-functions2.rkt b/collects/tests/typed-scheme/optimizer/hand-optimized/unboxed-let-functions2.rkt new file mode 100644 index 0000000000..10d68ed889 --- /dev/null +++ b/collects/tests/typed-scheme/optimizer/hand-optimized/unboxed-let-functions2.rkt @@ -0,0 +1,22 @@ +#lang racket + +(require racket/unsafe/ops) + +;; function with multiple complex args +(let ((f (lambda (unboxed-real-1 unboxed-real-2 unboxed-imag-3 unboxed-imag-4) + (let*-values (((unboxed-gensym-5) (unsafe-fl+ unboxed-real-1 unboxed-real-2)) + ((unboxed-gensym-6) (unsafe-fl+ unboxed-imag-3 unboxed-imag-4))) + (unsafe-make-flrectangular unboxed-gensym-5 unboxed-gensym-6))))) + (let*-values (((unboxed-gensym-1) 1.0+2.0i) + ((unboxed-gensym-2) (unsafe-flreal-part unboxed-gensym-1)) + ((unboxed-gensym-3) (unsafe-flimag-part unboxed-gensym-1)) + ((unboxed-gensym-4) 2.0+4.0i) + ((unboxed-gensym-5) (unsafe-flreal-part unboxed-gensym-4)) + ((unboxed-gensym-6) (unsafe-flimag-part unboxed-gensym-4)) + ((unboxed-gensym-7) (unsafe-fl+ unboxed-gensym-2 unboxed-gensym-5)) + ((unboxed-gensym-8) (unsafe-fl+ unboxed-gensym-3 unboxed-gensym-6)) + ((unboxed-gensym-9) 3.0+6.0i) + ((unboxed-gensym-10) (unsafe-flreal-part unboxed-gensym-9)) + ((unboxed-gensym-11) (unsafe-flimag-part unboxed-gensym-9))) + (f unboxed-gensym-7 unboxed-gensym-10 unboxed-gensym-8 unboxed-gensym-11))) +(void) diff --git a/collects/tests/typed-scheme/optimizer/hand-optimized/unboxed-let-functions3.rkt b/collects/tests/typed-scheme/optimizer/hand-optimized/unboxed-let-functions3.rkt new file mode 100644 index 0000000000..2973ecf0cc --- /dev/null +++ b/collects/tests/typed-scheme/optimizer/hand-optimized/unboxed-let-functions3.rkt @@ -0,0 +1,20 @@ +#lang racket + +(require racket/unsafe/ops) + +;; function with a mix of complex and non-complex args +(let ((f (lambda (unboxed-real-1 unboxed-imag-2 y) + (let*-values (((unboxed-gensym-3) y) + ((unboxed-gensym-4) (unsafe-fl+ unboxed-real-1 unboxed-gensym-3)) + ((unboxed-gensym-5) unboxed-imag-2)) + (unsafe-make-flrectangular unboxed-gensym-4 unboxed-gensym-5))))) + (let*-values (((unboxed-gensym-1) 1.0+2.0i) + ((unboxed-gensym-2) (unsafe-flreal-part unboxed-gensym-1)) + ((unboxed-gensym-3) (unsafe-flimag-part unboxed-gensym-1)) + ((unboxed-gensym-4) 2.0+4.0i) + ((unboxed-gensym-5) (unsafe-flreal-part unboxed-gensym-4)) + ((unboxed-gensym-6) (unsafe-flimag-part unboxed-gensym-4)) + ((unboxed-gensym-7) (unsafe-fl+ unboxed-gensym-2 unboxed-gensym-5)) + ((unboxed-gensym-8) (unsafe-fl+ unboxed-gensym-3 unboxed-gensym-6))) + (f unboxed-gensym-7 unboxed-gensym-8 3.0))) +(void) diff --git a/collects/tests/typed-scheme/optimizer/hand-optimized/unboxed-let-functions4.rkt b/collects/tests/typed-scheme/optimizer/hand-optimized/unboxed-let-functions4.rkt new file mode 100644 index 0000000000..2973ecf0cc --- /dev/null +++ b/collects/tests/typed-scheme/optimizer/hand-optimized/unboxed-let-functions4.rkt @@ -0,0 +1,20 @@ +#lang racket + +(require racket/unsafe/ops) + +;; function with a mix of complex and non-complex args +(let ((f (lambda (unboxed-real-1 unboxed-imag-2 y) + (let*-values (((unboxed-gensym-3) y) + ((unboxed-gensym-4) (unsafe-fl+ unboxed-real-1 unboxed-gensym-3)) + ((unboxed-gensym-5) unboxed-imag-2)) + (unsafe-make-flrectangular unboxed-gensym-4 unboxed-gensym-5))))) + (let*-values (((unboxed-gensym-1) 1.0+2.0i) + ((unboxed-gensym-2) (unsafe-flreal-part unboxed-gensym-1)) + ((unboxed-gensym-3) (unsafe-flimag-part unboxed-gensym-1)) + ((unboxed-gensym-4) 2.0+4.0i) + ((unboxed-gensym-5) (unsafe-flreal-part unboxed-gensym-4)) + ((unboxed-gensym-6) (unsafe-flimag-part unboxed-gensym-4)) + ((unboxed-gensym-7) (unsafe-fl+ unboxed-gensym-2 unboxed-gensym-5)) + ((unboxed-gensym-8) (unsafe-fl+ unboxed-gensym-3 unboxed-gensym-6))) + (f unboxed-gensym-7 unboxed-gensym-8 3.0))) +(void) diff --git a/collects/tests/typed-scheme/optimizer/hand-optimized/unboxed-let-functions5.rkt b/collects/tests/typed-scheme/optimizer/hand-optimized/unboxed-let-functions5.rkt new file mode 100644 index 0000000000..e1daeb27f3 --- /dev/null +++ b/collects/tests/typed-scheme/optimizer/hand-optimized/unboxed-let-functions5.rkt @@ -0,0 +1,18 @@ +#lang racket + +(require racket/unsafe/ops) + +;; invalid: f "escapes", according to our analysis +(letrec ((f (lambda (x) + (let ((y f)) + x)))) + (f (let*-values (((unboxed-gensym-1) 1.0+2.0i) + ((unboxed-gensym-2) (unsafe-flreal-part unboxed-gensym-1)) + ((unboxed-gensym-3) (unsafe-flimag-part unboxed-gensym-1)) + ((unboxed-gensym-4) 2.0+4.0i) + ((unboxed-gensym-5) (unsafe-flreal-part unboxed-gensym-4)) + ((unboxed-gensym-6) (unsafe-flimag-part unboxed-gensym-4)) + ((unboxed-gensym-7) (unsafe-fl+ unboxed-gensym-2 unboxed-gensym-5)) + ((unboxed-gensym-8) (unsafe-fl+ unboxed-gensym-3 unboxed-gensym-6))) + (unsafe-make-flrectangular unboxed-gensym-7 unboxed-gensym-8)))) +(void) diff --git a/collects/tests/typed-scheme/optimizer/non-optimized/unboxed-let-functions2.rkt b/collects/tests/typed-scheme/optimizer/non-optimized/unboxed-let-functions2.rkt new file mode 100644 index 0000000000..6454579e6f --- /dev/null +++ b/collects/tests/typed-scheme/optimizer/non-optimized/unboxed-let-functions2.rkt @@ -0,0 +1,9 @@ +#lang typed/scheme + +(require racket/unsafe/ops) + +;; function with multiple complex args +(let ((f (lambda: ((x : Inexact-Complex) (y : Inexact-Complex)) + (+ x y)))) + (f (+ 1.0+2.0i 2.0+4.0i) + 3.0+6.0i)) diff --git a/collects/tests/typed-scheme/optimizer/non-optimized/unboxed-let-functions3.rkt b/collects/tests/typed-scheme/optimizer/non-optimized/unboxed-let-functions3.rkt new file mode 100644 index 0000000000..e6e2963214 --- /dev/null +++ b/collects/tests/typed-scheme/optimizer/non-optimized/unboxed-let-functions3.rkt @@ -0,0 +1,9 @@ +#lang typed/scheme + +(require racket/unsafe/ops) + +;; function with a mix of complex and non-complex args +(let ((f (lambda: ((x : Inexact-Complex) (y : Float)) + (+ x y)))) + (f (+ 1.0+2.0i 2.0+4.0i) + 3.0)) diff --git a/collects/tests/typed-scheme/optimizer/non-optimized/unboxed-let-functions4.rkt b/collects/tests/typed-scheme/optimizer/non-optimized/unboxed-let-functions4.rkt new file mode 100644 index 0000000000..d6e565f643 --- /dev/null +++ b/collects/tests/typed-scheme/optimizer/non-optimized/unboxed-let-functions4.rkt @@ -0,0 +1,9 @@ +#lang typed/scheme + +(require racket/unsafe/ops) + +;; function with a mix of complex and non-complex args, non-complex first +(let ((f (lambda: ((y : Float) (x : Inexact-Complex)) + (+ x y)))) + (f 3.0 + (+ 1.0+2.0i 2.0+4.0i))) diff --git a/collects/tests/typed-scheme/optimizer/non-optimized/unboxed-let-functions5.rkt b/collects/tests/typed-scheme/optimizer/non-optimized/unboxed-let-functions5.rkt new file mode 100644 index 0000000000..2c9889a60c --- /dev/null +++ b/collects/tests/typed-scheme/optimizer/non-optimized/unboxed-let-functions5.rkt @@ -0,0 +1,10 @@ +#lang typed/scheme + +(require racket/unsafe/ops) + +;; invalid: f "escapes", according to our analysis +(letrec: ((f : (Inexact-Complex -> Inexact-Complex) + (lambda: ((x : Inexact-Complex)) + (let: ((y : (Inexact-Complex -> Inexact-Complex) f)) + x)))) + (f (+ 1.0+2.0i 2.0+4.0i)))