diff --git a/collects/tests/typed-racket/optimizer/missed-optimizations/fixnum.rkt b/collects/tests/typed-racket/optimizer/missed-optimizations/fixnum.rkt index ef7983f1..2625d3f3 100644 --- a/collects/tests/typed-racket/optimizer/missed-optimizations/fixnum.rkt +++ b/collects/tests/typed-racket/optimizer/missed-optimizations/fixnum.rkt @@ -7,16 +7,16 @@ TR missed opt: fixnum.rkt 40:0 (fx* (ann x Index) (ann y Index)) -- out of fixnu TR missed opt: fixnum.rkt 41:0 (abs (ann -3 Fixnum)) -- out of fixnum range TR opt: fixnum.rkt 42:3 (+ 300 301) -- fixnum bounded expr TR opt: fixnum.rkt 42:15 (+ 301 302) -- fixnum bounded expr -TR opt: fixnum.rkt 42:3 (+ 300 301) -- fixnum bounded expr -TR opt: fixnum.rkt 42:15 (+ 301 302) -- fixnum bounded expr -TR opt: fixnum.rkt 42:3 (+ 300 301) -- fixnum bounded expr -TR opt: fixnum.rkt 42:15 (+ 301 302) -- fixnum bounded expr TR missed opt: fixnum.rkt 42:0 (+ (+ 300 301) (+ 301 302)) -- out of fixnum range -TR opt: fixnum.rkt 43:5 (+ 300 301) -- fixnum bounded expr -TR opt: fixnum.rkt 43:17 (+ 301 302) -- fixnum bounded expr +TR opt: fixnum.rkt 42:3 (+ 300 301) -- fixnum bounded expr +TR opt: fixnum.rkt 42:15 (+ 301 302) -- fixnum bounded expr +TR opt: fixnum.rkt 42:3 (+ 300 301) -- fixnum bounded expr +TR opt: fixnum.rkt 42:15 (+ 301 302) -- fixnum bounded expr TR opt: fixnum.rkt 43:5 (+ 300 301) -- fixnum bounded expr TR opt: fixnum.rkt 43:17 (+ 301 302) -- fixnum bounded expr TR missed opt: fixnum.rkt 43:0 (fx+ (+ 300 301) (+ 301 302)) -- out of fixnum range +TR opt: fixnum.rkt 43:5 (+ 300 301) -- fixnum bounded expr +TR opt: fixnum.rkt 43:17 (+ 301 302) -- fixnum bounded expr TR missed opt: fixnum.rkt 44:0 (fxquotient -4 -5) -- out of fixnum range 468 234 diff --git a/collects/tests/typed-racket/optimizer/missed-optimizations/nested-same-kind.rkt b/collects/tests/typed-racket/optimizer/missed-optimizations/nested-same-kind.rkt index a048835f..92c659c9 100644 --- a/collects/tests/typed-racket/optimizer/missed-optimizations/nested-same-kind.rkt +++ b/collects/tests/typed-racket/optimizer/missed-optimizations/nested-same-kind.rkt @@ -1,9 +1,23 @@ #; ( -TR missed opt: nested-same-kind.rkt 20:0 (* 2.0 (* 3.0 (ann 4 Integer))) -- all args float-arg-expr, result not Float -- caused by: 20:19 4 (2 times) -TR missed opt: nested-same-kind.rkt 21:0 (* 1.0 (* 2.0 (* 3.0 (ann 4 Integer)))) -- all args float-arg-expr, result not Float -- caused by: 21:26 4 (3 times) -TR missed opt: nested-same-kind.rkt 22:0 (* 2.0 (* 3.0 (ann 4 Integer) (ann 5 Integer))) -- all args float-arg-expr, result not Float -- caused by: 22:19 4, 22:35 5 (2 times) -TR missed opt: nested-same-kind.rkt 23:0 (* (* 3.0 (ann 4 Integer)) (* 3.0 (ann 4 Integer))) -- all args float-arg-expr, result not Float -- caused by: 23:15 4, 23:39 4 (3 times) +TR missed opt: nested-same-kind.rkt 34:7 (* 3.0 (ann 4 Integer)) -- all args float-arg-expr, result not Float -- caused by: 34:19 4 +TR missed opt: nested-same-kind.rkt 34:0 (* 2.0 (* 3.0 (ann 4 Integer))) -- all args float-arg-expr, result not Float -- caused by: 34:7 (* 3.0 (ann 4 Integer)) +TR missed opt: nested-same-kind.rkt 34:7 (* 3.0 (ann 4 Integer)) -- all args float-arg-expr, result not Float -- caused by: 34:19 4 +TR missed opt: nested-same-kind.rkt 35:14 (* 3.0 (ann 4 Integer)) -- all args float-arg-expr, result not Float -- caused by: 35:26 4 +TR missed opt: nested-same-kind.rkt 35:7 (* 2.0 (* 3.0 (ann 4 Integer))) -- all args float-arg-expr, result not Float -- caused by: 35:14 (* 3.0 (ann 4 Integer)) +TR missed opt: nested-same-kind.rkt 35:14 (* 3.0 (ann 4 Integer)) -- all args float-arg-expr, result not Float -- caused by: 35:26 4 +TR missed opt: nested-same-kind.rkt 35:0 (* 1.0 (* 2.0 (* 3.0 (ann 4 Integer)))) -- all args float-arg-expr, result not Float -- caused by: 35:7 (* 2.0 (* 3.0 (ann 4 Integer))) +TR missed opt: nested-same-kind.rkt 35:14 (* 3.0 (ann 4 Integer)) -- all args float-arg-expr, result not Float -- caused by: 35:26 4 +TR missed opt: nested-same-kind.rkt 35:7 (* 2.0 (* 3.0 (ann 4 Integer))) -- all args float-arg-expr, result not Float -- caused by: 35:14 (* 3.0 (ann 4 Integer)) +TR missed opt: nested-same-kind.rkt 35:14 (* 3.0 (ann 4 Integer)) -- all args float-arg-expr, result not Float -- caused by: 35:26 4 +TR missed opt: nested-same-kind.rkt 36:7 (* 3.0 (ann 4 Integer) (ann 5 Integer)) -- all args float-arg-expr, result not Float -- caused by: 36:19 4, 36:35 5 +TR missed opt: nested-same-kind.rkt 36:0 (* 2.0 (* 3.0 (ann 4 Integer) (ann 5 Integer))) -- all args float-arg-expr, result not Float -- caused by: 36:7 (* 3.0 (ann 4 Integer) (ann 5 Integer)) +TR missed opt: nested-same-kind.rkt 36:7 (* 3.0 (ann 4 Integer) (ann 5 Integer)) -- all args float-arg-expr, result not Float -- caused by: 36:19 4, 36:35 5 +TR missed opt: nested-same-kind.rkt 37:3 (* 3.0 (ann 4 Integer)) -- all args float-arg-expr, result not Float -- caused by: 37:15 4 +TR missed opt: nested-same-kind.rkt 37:27 (* 3.0 (ann 4 Integer)) -- all args float-arg-expr, result not Float -- caused by: 37:39 4 +TR missed opt: nested-same-kind.rkt 37:0 (* (* 3.0 (ann 4 Integer)) (* 3.0 (ann 4 Integer))) -- all args float-arg-expr, result not Float -- caused by: 37:3 (* 3.0 (ann 4 Integer)), 37:27 (* 3.0 (ann 4 Integer)) +TR missed opt: nested-same-kind.rkt 37:3 (* 3.0 (ann 4 Integer)) -- all args float-arg-expr, result not Float -- caused by: 37:15 4 +TR missed opt: nested-same-kind.rkt 37:27 (* 3.0 (ann 4 Integer)) -- all args float-arg-expr, result not Float -- caused by: 37:39 4 24.0 24.0 120.0 diff --git a/collects/tests/typed-racket/optimizer/missed-optimizations/pair.rkt b/collects/tests/typed-racket/optimizer/missed-optimizations/pair.rkt index 808df47e..9250af55 100644 --- a/collects/tests/typed-racket/optimizer/missed-optimizations/pair.rkt +++ b/collects/tests/typed-racket/optimizer/missed-optimizations/pair.rkt @@ -9,10 +9,10 @@ TR opt: pair.rkt 62:5 (cdr (list 1 2 3)) -- pair TR opt: pair.rkt 63:0 (cdr (cdr (cdr (list 1 2 3)))) -- pair TR opt: pair.rkt 63:5 (cdr (cdr (list 1 2 3))) -- pair TR opt: pair.rkt 63:10 (cdr (list 1 2 3)) -- pair +TR missed opt: pair.rkt 64:16 (cdr (cdr (cdr (cdr (list 1 2 3))))) -- car/cdr on a potentially empty list -- caused by: 64:21 (cdr (cdr (cdr (list 1 2 3)))) TR opt: pair.rkt 64:21 (cdr (cdr (cdr (list 1 2 3)))) -- pair TR opt: pair.rkt 64:26 (cdr (cdr (list 1 2 3))) -- pair TR opt: pair.rkt 64:31 (cdr (list 1 2 3)) -- pair -TR missed opt: pair.rkt 64:16 (cdr (cdr (cdr (cdr (list 1 2 3))))) -- car/cdr on a potentially empty list -- caused by: 64:21 (cdr (cdr (cdr (list 1 2 3)))) TR missed opt: pair.rkt 67:0 (mcar (ann (mlist 1) (MListof Byte))) -- car/cdr on a potentially empty list -- caused by: 67:0 (mcar (ann (mlist 1) (MListof Byte))) TR opt: pair.rkt 68:0 (mcar (mlist 1 2 3)) -- pair TR missed opt: pair.rkt 69:0 (mcdr (ann (mlist 1) (MListof Byte))) -- car/cdr on a potentially empty list -- caused by: 69:0 (mcdr (ann (mlist 1) (MListof Byte))) diff --git a/collects/tests/typed-racket/optimizer/missed-optimizations/precision-loss.rkt b/collects/tests/typed-racket/optimizer/missed-optimizations/precision-loss.rkt index b1504241..b8ea816f 100644 --- a/collects/tests/typed-racket/optimizer/missed-optimizations/precision-loss.rkt +++ b/collects/tests/typed-racket/optimizer/missed-optimizations/precision-loss.rkt @@ -1,19 +1,25 @@ #; ( -TR opt: precision-loss.rkt 30:0 (+ (* 3/4 2/3) 2.0) -- binary float -TR missed opt: precision-loss.rkt 30:0 (+ (* 3/4 2/3) 2.0) -- exact ops inside float expr -- caused by: 30:3 (* 3/4 2/3) -TR opt: precision-loss.rkt 32:0 (+ 3/4 2.0) -- binary float -TR opt: precision-loss.rkt 34:0 (+ (- 3/4) 2.0) -- binary float -TR missed opt: precision-loss.rkt 34:0 (+ (- 3/4) 2.0) -- exact ops inside float expr -- caused by: 34:3 (- 3/4) -TR opt: precision-loss.rkt 36:0 (+ (vector-ref (quote #(2/3 1/2 3/4)) (assert (+ 1/4 3/4) exact-integer?)) 2.0) -- binary float -TR opt: precision-loss.rkt 43:3 (car (list (* 2.0 (ann (* 3/4 2/3) Real)))) -- pair -TR opt: precision-loss.rkt 43:3 (car (list (* 2.0 (ann (* 3/4 2/3) Real)))) -- pair -TR missed opt: precision-loss.rkt 43:14 (* 2.0 (ann (* 3/4 2/3) Real)) -- all args float-arg-expr, result not Float -- caused by: 43:29 3/4, 43:33 2/3 (2 times) -TR missed opt: precision-loss.rkt 43:14 (* 2.0 (ann (* 3/4 2/3) Real)) -- exact ops inside float expr -- caused by: 43:26 (* 3/4 2/3) -TR missed opt: precision-loss.rkt 42:0 (* (ann (* 3/4 2/3) Real) (car (list (* 2.0 (ann (* 3/4 2/3) Real)))) 2.0) -- exact ops inside float expr -- caused by: 42:8 (* 3/4 2/3) -TR missed opt: precision-loss.rkt 42:0 (* (ann (* 3/4 2/3) Real) (car (list (* 2.0 (ann (* 3/4 2/3) Real)))) 2.0) -- all args float-arg-expr, result not Float -- caused by: 42:11 3/4, 42:15 2/3, 43:3 (car (list (* 2.0 (ann (* 3/4 2/3) Real)))) (2 times) -TR missed opt: precision-loss.rkt 43:14 (* 2.0 (ann (* 3/4 2/3) Real)) -- exact ops inside float expr -- caused by: 43:26 (* 3/4 2/3) -TR missed opt: precision-loss.rkt 43:14 (* 2.0 (ann (* 3/4 2/3) Real)) -- all args float-arg-expr, result not Float -- caused by: 43:29 3/4, 43:33 2/3 (2 times) +TR missed opt: precision-loss.rkt 36:0 (+ (* 3/4 2/3) 2.0) -- exact ops inside float expr -- caused by: 36:3 (* 3/4 2/3) +TR opt: precision-loss.rkt 36:0 (+ (* 3/4 2/3) 2.0) -- binary float +TR opt: precision-loss.rkt 38:0 (+ 3/4 2.0) -- binary float +TR missed opt: precision-loss.rkt 40:0 (+ (- 3/4) 2.0) -- exact ops inside float expr -- caused by: 40:3 (- 3/4) +TR opt: precision-loss.rkt 40:0 (+ (- 3/4) 2.0) -- binary float +TR opt: precision-loss.rkt 42:0 (+ (vector-ref (quote #(2/3 1/2 3/4)) (assert (+ 1/4 3/4) exact-integer?)) 2.0) -- binary float +TR missed opt: precision-loss.rkt 48:8 (* 3/4 2/3) -- all args float-arg-expr, result not Float -- caused by: 48:11 3/4, 48:15 2/3 +TR opt: precision-loss.rkt 49:3 (car (list (* 2.0 (ann (* 3/4 2/3) Real)))) -- pair +TR missed opt: precision-loss.rkt 49:26 (* 3/4 2/3) -- all args float-arg-expr, result not Float -- caused by: 49:29 3/4, 49:33 2/3 +TR missed opt: precision-loss.rkt 49:14 (* 2.0 (ann (* 3/4 2/3) Real)) -- all args float-arg-expr, result not Float -- caused by: 49:26 (* 3/4 2/3) +TR missed opt: precision-loss.rkt 49:14 (* 2.0 (ann (* 3/4 2/3) Real)) -- exact ops inside float expr -- caused by: 49:26 (* 3/4 2/3) +TR missed opt: precision-loss.rkt 49:26 (* 3/4 2/3) -- all args float-arg-expr, result not Float -- caused by: 49:29 3/4, 49:33 2/3 +TR missed opt: precision-loss.rkt 48:0 (* (ann (* 3/4 2/3) Real) (car (list (* 2.0 (ann (* 3/4 2/3) Real)))) 2.0) -- all args float-arg-expr, result not Float -- caused by: 48:8 (* 3/4 2/3), 49:3 (car (list (* 2.0 (ann (* 3/4 2/3) Real)))) +TR missed opt: precision-loss.rkt 48:0 (* (ann (* 3/4 2/3) Real) (car (list (* 2.0 (ann (* 3/4 2/3) Real)))) 2.0) -- exact ops inside float expr -- caused by: 48:8 (* 3/4 2/3) +TR missed opt: precision-loss.rkt 48:8 (* 3/4 2/3) -- all args float-arg-expr, result not Float -- caused by: 48:11 3/4, 48:15 2/3 +TR opt: precision-loss.rkt 49:3 (car (list (* 2.0 (ann (* 3/4 2/3) Real)))) -- pair +TR missed opt: precision-loss.rkt 49:26 (* 3/4 2/3) -- all args float-arg-expr, result not Float -- caused by: 49:29 3/4, 49:33 2/3 +TR missed opt: precision-loss.rkt 49:14 (* 2.0 (ann (* 3/4 2/3) Real)) -- all args float-arg-expr, result not Float -- caused by: 49:26 (* 3/4 2/3) +TR missed opt: precision-loss.rkt 49:14 (* 2.0 (ann (* 3/4 2/3) Real)) -- exact ops inside float expr -- caused by: 49:26 (* 3/4 2/3) +TR missed opt: precision-loss.rkt 49:26 (* 3/4 2/3) -- all args float-arg-expr, result not Float -- caused by: 49:29 3/4, 49:33 2/3 2.5 2.75 1.25 diff --git a/collects/tests/typed-racket/optimizer/tests/case-arrow.rkt b/collects/tests/typed-racket/optimizer/tests/case-arrow.rkt index 360ad66e..3d8c3f29 100644 --- a/collects/tests/typed-racket/optimizer/tests/case-arrow.rkt +++ b/collects/tests/typed-racket/optimizer/tests/case-arrow.rkt @@ -1,7 +1,27 @@ #; ( -TR missed opt: case-arrow.rkt 21:2 (+ min (/ (* (- max min) x) p)) -- exact ops inside float expr -- caused by: 21:15 (- max min) (3 times) -TR missed opt: case-arrow.rkt 21:2 (+ min (/ (* (- max min) x) p)) -- all args float-arg-expr, result not Float -- caused by: 21:5 min, 21:18 max, 21:22 min, 21:27 x, 21:30 p (4 times) +TR missed opt: case-arrow.rkt 41:15 (- max min) -- all args float-arg-expr, result not Float -- caused by: 41:18 max, 41:22 min +TR missed opt: case-arrow.rkt 41:12 (* (- max min) x) -- all args float-arg-expr, result not Float -- caused by: 41:15 (- max min), 41:27 x +TR missed opt: case-arrow.rkt 41:12 (* (- max min) x) -- exact ops inside float expr -- caused by: 41:15 (- max min) +TR missed opt: case-arrow.rkt 41:15 (- max min) -- all args float-arg-expr, result not Float -- caused by: 41:18 max, 41:22 min +TR missed opt: case-arrow.rkt 41:9 (/ (* (- max min) x) p) -- all args float-arg-expr, result not Float -- caused by: 41:12 (* (- max min) x), 41:30 p +TR missed opt: case-arrow.rkt 41:9 (/ (* (- max min) x) p) -- exact ops inside float expr -- caused by: 41:12 (* (- max min) x) +TR missed opt: case-arrow.rkt 41:15 (- max min) -- all args float-arg-expr, result not Float -- caused by: 41:18 max, 41:22 min +TR missed opt: case-arrow.rkt 41:12 (* (- max min) x) -- all args float-arg-expr, result not Float -- caused by: 41:15 (- max min), 41:27 x +TR missed opt: case-arrow.rkt 41:12 (* (- max min) x) -- exact ops inside float expr -- caused by: 41:15 (- max min) +TR missed opt: case-arrow.rkt 41:15 (- max min) -- all args float-arg-expr, result not Float -- caused by: 41:18 max, 41:22 min +TR missed opt: case-arrow.rkt 41:2 (+ min (/ (* (- max min) x) p)) -- all args float-arg-expr, result not Float -- caused by: 41:5 min, 41:9 (/ (* (- max min) x) p) +TR missed opt: case-arrow.rkt 41:2 (+ min (/ (* (- max min) x) p)) -- exact ops inside float expr -- caused by: 41:9 (/ (* (- max min) x) p) +TR missed opt: case-arrow.rkt 41:15 (- max min) -- all args float-arg-expr, result not Float -- caused by: 41:18 max, 41:22 min +TR missed opt: case-arrow.rkt 41:12 (* (- max min) x) -- all args float-arg-expr, result not Float -- caused by: 41:15 (- max min), 41:27 x +TR missed opt: case-arrow.rkt 41:12 (* (- max min) x) -- exact ops inside float expr -- caused by: 41:15 (- max min) +TR missed opt: case-arrow.rkt 41:15 (- max min) -- all args float-arg-expr, result not Float -- caused by: 41:18 max, 41:22 min +TR missed opt: case-arrow.rkt 41:9 (/ (* (- max min) x) p) -- all args float-arg-expr, result not Float -- caused by: 41:12 (* (- max min) x), 41:30 p +TR missed opt: case-arrow.rkt 41:9 (/ (* (- max min) x) p) -- exact ops inside float expr -- caused by: 41:12 (* (- max min) x) +TR missed opt: case-arrow.rkt 41:15 (- max min) -- all args float-arg-expr, result not Float -- caused by: 41:18 max, 41:22 min +TR missed opt: case-arrow.rkt 41:12 (* (- max min) x) -- all args float-arg-expr, result not Float -- caused by: 41:15 (- max min), 41:27 x +TR missed opt: case-arrow.rkt 41:12 (* (- max min) x) -- exact ops inside float expr -- caused by: 41:15 (- max min) +TR missed opt: case-arrow.rkt 41:15 (- max min) -- all args float-arg-expr, result not Float -- caused by: 41:18 max, 41:22 min ) #lang typed/racket diff --git a/collects/tests/typed-racket/optimizer/tests/expt.rkt b/collects/tests/typed-racket/optimizer/tests/expt.rkt index e96d8cc0..1cf3b12f 100644 --- a/collects/tests/typed-racket/optimizer/tests/expt.rkt +++ b/collects/tests/typed-racket/optimizer/tests/expt.rkt @@ -1,7 +1,7 @@ #; ( -TR opt: expt.rkt 13:19 (sin 0.25) -- unary float TR missed opt: expt.rkt 13:13 (expt (sin 0.25) 1.0) -- unexpected complex type +TR opt: expt.rkt 13:19 (sin 0.25) -- unary float ) #lang typed/racket diff --git a/collects/tests/typed-racket/optimizer/tests/fixnum-bounded-expr.rkt b/collects/tests/typed-racket/optimizer/tests/fixnum-bounded-expr.rkt index 2e498f26..77cc604a 100644 --- a/collects/tests/typed-racket/optimizer/tests/fixnum-bounded-expr.rkt +++ b/collects/tests/typed-racket/optimizer/tests/fixnum-bounded-expr.rkt @@ -20,9 +20,9 @@ TR opt: fixnum-bounded-expr.rkt 96:8 (+ (+ 34 231) 23) -- fixnum bounded expr TR opt: fixnum-bounded-expr.rkt 96:0 (fx+ -4 (+ (+ 34 231) 23)) -- fixnum fx+ TR opt: fixnum-bounded-expr.rkt 97:5 (+ 300 301) -- fixnum bounded expr TR opt: fixnum-bounded-expr.rkt 97:17 (+ 301 302) -- fixnum bounded expr +TR missed opt: fixnum-bounded-expr.rkt 97:0 (fx+ (+ 300 301) (+ 301 302)) -- out of fixnum range TR opt: fixnum-bounded-expr.rkt 97:5 (+ 300 301) -- fixnum bounded expr TR opt: fixnum-bounded-expr.rkt 97:17 (+ 301 302) -- fixnum bounded expr -TR missed opt: fixnum-bounded-expr.rkt 97:0 (fx+ (+ 300 301) (+ 301 302)) -- out of fixnum range TR opt: fixnum-bounded-expr.rkt 99:5 (+ 300 301) -- fixnum bounded expr TR opt: fixnum-bounded-expr.rkt 99:17 (+ 301 302) -- fixnum bounded expr TR opt: fixnum-bounded-expr.rkt 99:0 (fx- (+ 300 301) (+ 301 302)) -- fixnum fx- diff --git a/collects/tests/typed-racket/optimizer/tests/float-complex-sin.rkt b/collects/tests/typed-racket/optimizer/tests/float-complex-sin.rkt index b58c9e44..2f30ca5d 100644 --- a/collects/tests/typed-racket/optimizer/tests/float-complex-sin.rkt +++ b/collects/tests/typed-racket/optimizer/tests/float-complex-sin.rkt @@ -1,10 +1,14 @@ #; ( -TR opt: float-complex-sin.rkt 15:13 (sin (* t 6.28)) -- float-arg-expr in complex ops -TR opt: float-complex-sin.rkt 15:30 0.0+0.0i -- unboxed literal -TR opt: float-complex-sin.rkt 15:10 (+ (sin (* t 6.28)) 0.0+0.0i) -- unboxed binary float complex -TR missed opt: float-complex-sin.rkt 15:13 (sin (* t 6.28)) -- all args float-arg-expr, result not Float -- caused by: 15:21 t (2 times) -TR missed opt: float-complex-sin.rkt 15:13 (sin (* t 6.28)) -- all args float-arg-expr, result not Float -- caused by: 15:21 t (2 times) +TR missed opt: float-complex-sin.rkt 19:18 (* t 6.28) -- all args float-arg-expr, result not Float -- caused by: 19:21 t +TR missed opt: float-complex-sin.rkt 19:13 (sin (* t 6.28)) -- all args float-arg-expr, result not Float -- caused by: 19:18 (* t 6.28) +TR missed opt: float-complex-sin.rkt 19:18 (* t 6.28) -- all args float-arg-expr, result not Float -- caused by: 19:21 t +TR missed opt: float-complex-sin.rkt 19:18 (* t 6.28) -- all args float-arg-expr, result not Float -- caused by: 19:21 t +TR missed opt: float-complex-sin.rkt 19:13 (sin (* t 6.28)) -- all args float-arg-expr, result not Float -- caused by: 19:18 (* t 6.28) +TR missed opt: float-complex-sin.rkt 19:18 (* t 6.28) -- all args float-arg-expr, result not Float -- caused by: 19:21 t +TR opt: float-complex-sin.rkt 19:13 (sin (* t 6.28)) -- float-arg-expr in complex ops +TR opt: float-complex-sin.rkt 19:30 0.0+0.0i -- unboxed literal +TR opt: float-complex-sin.rkt 19:10 (+ (sin (* t 6.28)) 0.0+0.0i) -- unboxed binary float complex -0.0031853017931379904+0.0i ) diff --git a/collects/tests/typed-racket/optimizer/tests/float-real.rkt b/collects/tests/typed-racket/optimizer/tests/float-real.rkt index 74a0601e..417c216c 100644 --- a/collects/tests/typed-racket/optimizer/tests/float-real.rkt +++ b/collects/tests/typed-racket/optimizer/tests/float-real.rkt @@ -1,9 +1,11 @@ #; ( -TR opt: float-real.rkt 16:0 (+ 2.3 (ann 3 Real)) -- binary float -TR opt: float-real.rkt 17:0 (+ 2.3 (* (ann 2 Integer) 3.2)) -- binary float -TR missed opt: float-real.rkt 17:7 (* (ann 2 Integer) 3.2) -- all args float-arg-expr, result not Float -- caused by: 17:15 2 -TR missed opt: float-real.rkt 18:0 (* 2.3 (* (ann 2 Integer) 3.1)) -- all args float-arg-expr, result not Float -- caused by: 18:15 2 (2 times) +TR opt: float-real.rkt 18:0 (+ 2.3 (ann 3 Real)) -- binary float +TR missed opt: float-real.rkt 19:7 (* (ann 2 Integer) 3.2) -- all args float-arg-expr, result not Float -- caused by: 19:15 2 +TR opt: float-real.rkt 19:0 (+ 2.3 (* (ann 2 Integer) 3.2)) -- binary float +TR missed opt: float-real.rkt 20:7 (* (ann 2 Integer) 3.1) -- all args float-arg-expr, result not Float -- caused by: 20:15 2 +TR missed opt: float-real.rkt 20:0 (* 2.3 (* (ann 2 Integer) 3.1)) -- all args float-arg-expr, result not Float -- caused by: 20:7 (* (ann 2 Integer) 3.1) +TR missed opt: float-real.rkt 20:7 (* (ann 2 Integer) 3.1) -- all args float-arg-expr, result not Float -- caused by: 20:15 2 5.3 8.7 14.26 diff --git a/collects/typed-racket/optimizer/logging.rkt b/collects/typed-racket/optimizer/logging.rkt index be26841b..17db6d32 100644 --- a/collects/typed-racket/optimizer/logging.rkt +++ b/collects/typed-racket/optimizer/logging.rkt @@ -5,7 +5,6 @@ "../utils/tc-utils.rkt") (provide log-optimization log-missed-optimization - print-log clear-log log-message-from-tr-opt? with-intercepted-tr-logging with-tr-logging-to-port (struct-out log-entry) @@ -61,87 +60,17 @@ (irritants merged-irritants badness) #:prefab) -(define missed-optimizations-log '()) - -;; is parent the "parent" missed optimization of child? -;; this determines whether they get reported together or not -;; currently, parents and children must be of the same kind of missed -;; optimization, and the child must be an irritant of the parent, or be a -;; merged irritant of the parent -(define (parent-of? parent child) - (and (equal? (log-entry-kind parent) - (log-entry-kind child)) - (member (log-entry-stx child) - (append (missed-opt-log-entry-irritants parent) - (missed-opt-log-entry-merged-irritants parent))))) - -;; combine reporting of two missed optimizations, increasing badness in the -;; process -(define (combine-missed-optimizations parent child) - (missed-opt-log-entry - (log-entry-kind parent) ; same as child's - (log-entry-msg parent) - (log-entry-stx parent) ; we report the outermost one - (log-entry-located-stx parent) - (log-entry-pos parent) - - (remove-duplicates - (append (remove (log-entry-stx child) - (missed-opt-log-entry-irritants parent)) - (missed-opt-log-entry-irritants child))) - (remove-duplicates - (append (missed-opt-log-entry-merged-irritants child) - (missed-opt-log-entry-merged-irritants parent) - ;; we merge child in, keep it for future merges - (list (log-entry-stx child)))) - (+ (missed-opt-log-entry-badness parent) - (missed-opt-log-entry-badness child)))) - ;; Attempts to merge the incoming missed optimization with existing ones. ;; Otherwise, adds the new one to the log. (define (log-missed-optimization kind msg stx [irritants '()]) (when (anyone-listening?) - (let* (;; for convenience, if a single irritant is given, wrap it in a list - ;; implicitly - [irritants (if (list? irritants) irritants (list irritants))] - [new - (missed-opt-log-entry kind msg - stx (locate-stx stx) (syntax-position stx) - irritants '() 1)] - ;; check if the new one is the child of an old one - ;; for/first is ok, since we can only have one parent in the list - ;; (if we had more, one would have to be the parent of the other, so - ;; only one would be in the list) - [parent (for/first ([m (in-list missed-optimizations-log)] - #:when (parent-of? m new)) - m)] - ;; do we have children in the list, if so, merge with all of them - [children (for/list ([m (in-list missed-optimizations-log)] - #:when (parent-of? new m)) - m)]) - ;; update - (set! missed-optimizations-log - (cond [parent - ;; we found our parent, merge with it - (if (member (log-entry-stx new) - (missed-opt-log-entry-merged-irritants - parent)) - ;; we have been merged in the past, do nothing - missed-optimizations-log - ;; do the actual merge - (cons (combine-missed-optimizations parent new) - (remove parent missed-optimizations-log)))] - [(not (null? children)) - ;; we found children, merge with them - (let ([new (for/fold ([new new]) - ([child children]) - (combine-missed-optimizations new child))]) - (cons new - (filter (lambda (x) (not (member x children))) - missed-optimizations-log)))] - [else - ;; no related entry, just add the new one - (cons new missed-optimizations-log)]))))) + (let (;; for convenience, if a single irritant is given, wrap it in a list + ;; implicitly + [irritants (if (list? irritants) irritants (list irritants))]) + (emit-log-message + (missed-opt-log-entry kind msg + stx (locate-stx stx) (syntax-position stx) + irritants '() 1))))) ;;-------------------------------------------------------------------- @@ -189,15 +118,6 @@ (format " (~a times)" badness) ""))])) - -;; Once the optimizer is done, we sort the log according to source -;; location, then print it. -(define (print-log) - (for-each emit-log-message missed-optimizations-log)) - -(define (clear-log) - (set! missed-optimizations-log '())) - ;;-------------------------------------------------------------------- (define (log-message-from-tr-opt? l) diff --git a/collects/typed-racket/optimizer/optimizer.rkt b/collects/typed-racket/optimizer/optimizer.rkt index 8a23a82d..caf276a1 100644 --- a/collects/typed-racket/optimizer/optimizer.rkt +++ b/collects/typed-racket/optimizer/optimizer.rkt @@ -82,18 +82,17 @@ #:with opt #'other)) (define (optimize-top stx) - (clear-log) ; Reset log. We don't want to accumulate after each top-level expression. - (begin0 - (parameterize ([optimize (syntax-parser - [e:expr - #:when (and (not (syntax-property #'e 'typechecker:ignore)) - (not (syntax-property #'e 'typechecker:ignore-some)) - (not (syntax-property #'e 'typechecker:with-handlers))) - #:with e*:opt-expr #'e - #'e*.opt] - [e:expr #'e])]) - (let ((result ((optimize) stx))) - (when *show-optimized-code* - (pretty-print (syntax->datum result))) - result)) - (print-log))) ; Now that we have the full log for this top-level expression, print it in order. + (parameterize + ([optimize + (syntax-parser + [e:expr + #:when (and (not (syntax-property #'e 'typechecker:ignore)) + (not (syntax-property #'e 'typechecker:ignore-some)) + (not (syntax-property #'e 'typechecker:with-handlers))) + #:with e*:opt-expr #'e + #'e*.opt] + [e:expr #'e])]) + (let ((result ((optimize) stx))) + (when *show-optimized-code* + (pretty-print (syntax->datum result))) + result)))