Fix optimizer to work with new types.
original commit: 768bb6336142726023bfe2029b5aa25728bda0a3
This commit is contained in:
parent
956a1533c8
commit
f6590e9db2
|
@ -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
|
||||
|
|
|
@ -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)))))))
|
||||
|
|
|
@ -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)]
|
||||
|
|
|
@ -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))
|
||||
|
|
|
@ -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)))
|
||||
|
|
|
@ -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))
|
||||
|
|
|
@ -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))
|
||||
|
|
|
@ -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)))
|
||||
|
|
|
@ -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)))
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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))
|
||||
|
|
|
@ -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))
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue
Block a user