Fixed unsafe optimization that considered floats as complexes.
This commit is contained in:
parent
01c170c52f
commit
60bfce14bc
|
@ -0,0 +1,14 @@
|
||||||
|
#lang typed/scheme #:optimize
|
||||||
|
|
||||||
|
(require racket/unsafe/ops)
|
||||||
|
|
||||||
|
;; from the nbody-generic benchmark.
|
||||||
|
;; the result of sqrt was an Inexact-Complex, so inexact complex opts kicked
|
||||||
|
;; in but they resulted in segfaulting code.
|
||||||
|
;; the problem was that having Float be a subtype of Inexact-Complex was wrong
|
||||||
|
;; since you can't do unsafe-flreal-part of a float
|
||||||
|
|
||||||
|
(let* ([dx (- 0.0 0.0)]
|
||||||
|
[dist2 (* dx dx)]
|
||||||
|
[mag (assert (* dist2 (sqrt dist2)) inexact-real?)])
|
||||||
|
(void))
|
|
@ -0,0 +1,14 @@
|
||||||
|
#lang typed/scheme #:optimize
|
||||||
|
|
||||||
|
(require racket/unsafe/ops)
|
||||||
|
|
||||||
|
;; from the nbody-generic benchmark.
|
||||||
|
;; the result of sqrt was an Inexact-Complex, so inexact complex opts kicked
|
||||||
|
;; in but they resulted in segfaulting code.
|
||||||
|
;; the problem was that having Float be a subtype of Inexact-Complex was wrong
|
||||||
|
;; since you can't do unsafe-flreal-part of a float
|
||||||
|
|
||||||
|
(let* ([dx (unsafe-fl- 0.0 0.0)]
|
||||||
|
[dist2 (unsafe-fl* dx dx)]
|
||||||
|
[mag (assert (* dist2 (sqrt dist2)) inexact-real?)])
|
||||||
|
(void))
|
|
@ -0,0 +1,14 @@
|
||||||
|
#lang typed/scheme
|
||||||
|
|
||||||
|
(require racket/unsafe/ops)
|
||||||
|
|
||||||
|
;; from the nbody-generic benchmark.
|
||||||
|
;; the result of sqrt was an Inexact-Complex, so inexact complex opts kicked
|
||||||
|
;; in but they resulted in segfaulting code.
|
||||||
|
;; the problem was that having Float be a subtype of Inexact-Complex was wrong
|
||||||
|
;; since you can't do unsafe-flreal-part of a float
|
||||||
|
|
||||||
|
(let* ([dx (- 0.0 0.0)]
|
||||||
|
[dist2 (* dx dx)]
|
||||||
|
[mag (assert (* dist2 (sqrt dist2)) inexact-real?)])
|
||||||
|
(void))
|
|
@ -237,7 +237,6 @@
|
||||||
[((Base: 'Integer _) (Base: 'Number _)) A0]
|
[((Base: 'Integer _) (Base: 'Number _)) A0]
|
||||||
[((Base: 'Flonum _) (== -Real =t)) A0]
|
[((Base: 'Flonum _) (== -Real =t)) A0]
|
||||||
[((Base: 'Integer _) (== -Real =t)) A0]
|
[((Base: 'Integer _) (== -Real =t)) A0]
|
||||||
[((Base: 'Flonum _) (Base: 'InexactComplex _)) A0]
|
|
||||||
[((Base: 'Flonum _) (Base: 'Number _)) A0]
|
[((Base: 'Flonum _) (Base: 'Number _)) A0]
|
||||||
[((Base: 'Exact-Rational _) (Base: 'Number _)) A0]
|
[((Base: 'Exact-Rational _) (Base: 'Number _)) A0]
|
||||||
[((Base: 'Integer _) (Base: 'Exact-Rational _)) A0]
|
[((Base: 'Integer _) (Base: 'Exact-Rational _)) A0]
|
||||||
|
|
Loading…
Reference in New Issue
Block a user