Make unboxed let-bindings only log their clause.
This commit is contained in:
parent
74ce1ea748
commit
af6bc6e8e2
|
@ -65,40 +65,34 @@
|
|||
_:unboxed-fun-definition)))
|
||||
|
||||
(define-syntax-class unboxed-clause?
|
||||
#:attributes (unboxed-let bindings)
|
||||
#:attributes (bindings)
|
||||
(pattern v:unboxed-let-clause?
|
||||
#:attr unboxed-let #t
|
||||
#:with (real-binding imag-binding) (binding-names)
|
||||
#:do [(add-unboxed-var! #'v.id #'real-binding #'imag-binding)]
|
||||
#:attr bindings
|
||||
(delay
|
||||
(syntax-parse #'v
|
||||
[((id:id) c:unboxed-float-complex-opt-expr)
|
||||
#:do [(log-opt "unboxed let bindings" arity-raising-opt-msg)]
|
||||
#'(c.bindings ...
|
||||
((real-binding) c.real-binding)
|
||||
((imag-binding) c.imag-binding))])))
|
||||
(pattern v:unboxed-fun-clause?
|
||||
#:attr unboxed-let #f
|
||||
#:attr bindings
|
||||
(delay
|
||||
(syntax-parse #'v
|
||||
[c:unboxed-fun-clause
|
||||
#'(c.bindings ...)])))
|
||||
(pattern v
|
||||
#:attr unboxed-let #f
|
||||
#:attr bindings
|
||||
(delay
|
||||
(syntax-parse #'v
|
||||
[(vs rhs:opt-expr)
|
||||
#'((vs rhs.opt))]))))
|
||||
(define full-syntax this-syntax)
|
||||
|
||||
(define-syntax-class unboxed-clauses
|
||||
#:attributes ([bindings 1])
|
||||
(pattern (clauses:unboxed-clause? ...)
|
||||
;; only log when we actually optimize
|
||||
#:do [(when (member #t (attribute clauses.unboxed-let))
|
||||
(log-optimization "unboxed let bindings" arity-raising-opt-msg full-syntax))]
|
||||
#:with (bindings ...) (template ((?@ . clauses.bindings) ...))))]
|
||||
|
||||
#:with opt
|
||||
|
|
|
@ -1,13 +1,12 @@
|
|||
#;#;
|
||||
#<<END
|
||||
TR info: flrandom.rkt 14:7 random -- hidden parameter (random)
|
||||
TR info: flrandom.rkt 15:7 random -- hidden parameter (random)
|
||||
TR info: flrandom.rkt 16:7 random -- hidden parameter (random)
|
||||
TR opt: flrandom.rkt 15:6 (random) -- float 0-arg random
|
||||
TR opt: flrandom.rkt 17:6 (random (current-pseudo-random-generator)) -- float random
|
||||
TR opt: flrandom.rkt 18:6 (flrandom (current-pseudo-random-generator)) -- float random
|
||||
END
|
||||
#<<END
|
||||
TR opt: flrandom.rkt 14:6 (random) -- float 0-arg random
|
||||
TR opt: flrandom.rkt 16:6 (random (current-pseudo-random-generator)) -- float random
|
||||
TR opt: flrandom.rkt 17:6 (flrandom (current-pseudo-random-generator)) -- float random
|
||||
END
|
||||
""
|
||||
|
||||
#lang typed/racket
|
||||
|
||||
|
|
|
@ -4,10 +4,10 @@ TR info: invalid-unboxed-let.rkt 27:3 display -- hidden parameter
|
|||
TR info: invalid-unboxed-let.rkt 28:3 display -- hidden parameter
|
||||
TR info: invalid-unboxed-let.rkt 29:3 display -- hidden parameter
|
||||
TR info: invalid-unboxed-let.rkt 30:3 display -- hidden parameter
|
||||
TR opt: invalid-unboxed-let.rkt 23:0 (let ((t1 (+ 1.0+2.0i 2.0+4.0i)) (t2 (+ 3.0+6.0i 4.0+8.0i)) (t3 1.0+2.0i) (t4 1)) (display (+ t1 t1)) (display t2) (display t3) (display t4)) -- unboxed let bindings
|
||||
TR opt: invalid-unboxed-let.rkt 23:10 (+ 1.0+2.0i 2.0+4.0i) -- unboxed binary float complex
|
||||
TR opt: invalid-unboxed-let.rkt 23:13 1.0+2.0i -- unboxed literal
|
||||
TR opt: invalid-unboxed-let.rkt 23:22 2.0+4.0i -- unboxed literal
|
||||
TR opt: invalid-unboxed-let.rkt 23:6 (t1 (+ 1.0+2.0i 2.0+4.0i)) -- unboxed let bindings
|
||||
TR opt: invalid-unboxed-let.rkt 24:10 (+ 3.0+6.0i 4.0+8.0i) -- unboxed binary float complex
|
||||
TR opt: invalid-unboxed-let.rkt 24:13 3.0+6.0i -- unboxed literal
|
||||
TR opt: invalid-unboxed-let.rkt 24:22 4.0+8.0i -- unboxed literal
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
#<<END
|
||||
TR opt: make-polar.rkt 28:6 (make-polar 1.0 1.0) -- make-polar
|
||||
TR opt: make-polar.rkt 28:6 (make-polar 1.0 1.0) -- make-rectangular elimination
|
||||
TR opt: make-polar.rkt 31:0 (let ((p (+ 1.0+2.0i (make-polar 2.0 4.0)))) (string-append (real->decimal-string (real-part p) 3) (real->decimal-string (imag-part p) 3))) -- unboxed let bindings
|
||||
TR opt: make-polar.rkt 31:12 1.0+2.0i -- unboxed literal
|
||||
TR opt: make-polar.rkt 31:21 (make-polar 2.0 4.0) -- make-rectangular elimination
|
||||
TR opt: make-polar.rkt 31:6 (p (+ 1.0+2.0i (make-polar 2.0 4.0))) -- unboxed let bindings
|
||||
TR opt: make-polar.rkt 31:9 (+ 1.0+2.0i (make-polar 2.0 4.0)) -- unboxed binary float complex
|
||||
TR opt: make-polar.rkt 32:39 (real-part p) -- complex accessor elimination
|
||||
TR opt: make-polar.rkt 32:50 p -- leave var unboxed
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
#;#;
|
||||
#<<END
|
||||
TR opt: nested-unboxed-let.rkt 23:0 (let ((x (+ 1.0+2.0i 2.0+3.0i))) (let ((x (+ x 2.0+3.0i))) (+ x 3.0+6.0i))) -- unboxed let bindings
|
||||
TR opt: nested-unboxed-let.rkt 23:12 1.0+2.0i -- unboxed literal
|
||||
TR opt: nested-unboxed-let.rkt 23:21 2.0+3.0i -- unboxed literal
|
||||
TR opt: nested-unboxed-let.rkt 23:6 (x (+ 1.0+2.0i 2.0+3.0i)) -- unboxed let bindings
|
||||
TR opt: nested-unboxed-let.rkt 23:9 (+ 1.0+2.0i 2.0+3.0i) -- unboxed binary float complex
|
||||
TR opt: nested-unboxed-let.rkt 24:11 (+ x 2.0+3.0i) -- unboxed binary float complex
|
||||
TR opt: nested-unboxed-let.rkt 24:14 x -- leave var unboxed
|
||||
TR opt: nested-unboxed-let.rkt 24:16 2.0+3.0i -- unboxed literal
|
||||
TR opt: nested-unboxed-let.rkt 24:2 (let ((x (+ x 2.0+3.0i))) (+ x 3.0+6.0i)) -- unboxed let bindings
|
||||
TR opt: nested-unboxed-let.rkt 24:8 (x (+ x 2.0+3.0i)) -- unboxed let bindings
|
||||
TR opt: nested-unboxed-let.rkt 25:4 (+ x 3.0+6.0i) -- unboxed binary float complex
|
||||
TR opt: nested-unboxed-let.rkt 25:7 x -- leave var unboxed
|
||||
TR opt: nested-unboxed-let.rkt 25:9 3.0+6.0i -- unboxed literal
|
||||
|
|
|
@ -1,14 +1,15 @@
|
|||
#;#;
|
||||
#<<END
|
||||
TR info: unboxed-let-constants-fail1.rkt 22:22 displayln -- hidden parameter
|
||||
TR opt: unboxed-let-constants-fail1.rkt 21:0 (letrec-values (((x) 5.0+5.0i) ((_) (displayln (exact? x))) ((z) x)) (real-part (+ x z))) -- unboxed let bindings
|
||||
TR opt: unboxed-let-constants-fail1.rkt 21:21 5.0+5.0i -- unboxed literal
|
||||
TR opt: unboxed-let-constants-fail1.rkt 22:40 x -- unboxed complex variable
|
||||
TR opt: unboxed-let-constants-fail1.rkt 23:21 x -- leave var unboxed
|
||||
TR opt: unboxed-let-constants-fail1.rkt 24:13 (+ x z) -- unboxed binary float complex
|
||||
TR opt: unboxed-let-constants-fail1.rkt 24:16 x -- leave var unboxed
|
||||
TR opt: unboxed-let-constants-fail1.rkt 24:18 z -- leave var unboxed
|
||||
TR opt: unboxed-let-constants-fail1.rkt 24:2 (real-part (+ x z)) -- complex accessor elimination
|
||||
TR info: unboxed-let-constants-fail1.rkt 23:22 displayln -- hidden parameter
|
||||
TR opt: unboxed-let-constants-fail1.rkt 22:16 ((x) 5.0+5.0i) -- unboxed let bindings
|
||||
TR opt: unboxed-let-constants-fail1.rkt 22:21 5.0+5.0i -- unboxed literal
|
||||
TR opt: unboxed-let-constants-fail1.rkt 23:40 x -- unboxed complex variable
|
||||
TR opt: unboxed-let-constants-fail1.rkt 24:16 ((z) x) -- unboxed let bindings
|
||||
TR opt: unboxed-let-constants-fail1.rkt 24:21 x -- leave var unboxed
|
||||
TR opt: unboxed-let-constants-fail1.rkt 25:13 (+ x z) -- unboxed binary float complex
|
||||
TR opt: unboxed-let-constants-fail1.rkt 25:16 x -- leave var unboxed
|
||||
TR opt: unboxed-let-constants-fail1.rkt 25:18 z -- leave var unboxed
|
||||
TR opt: unboxed-let-constants-fail1.rkt 25:2 (real-part (+ x z)) -- complex accessor elimination
|
||||
END
|
||||
#<<END
|
||||
#f
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
#;#;
|
||||
#<<END
|
||||
TR opt: unboxed-let-constants.rkt 18:0 (letrec-values (((x) 5.0+5.0i) ((z) x)) (real-part (+ x z))) -- unboxed let bindings
|
||||
TR opt: unboxed-let-constants.rkt 18:21 5.0+5.0i -- unboxed literal
|
||||
TR opt: unboxed-let-constants.rkt 19:21 x -- leave var unboxed
|
||||
TR opt: unboxed-let-constants.rkt 20:13 (+ x z) -- unboxed binary float complex
|
||||
TR opt: unboxed-let-constants.rkt 20:16 x -- leave var unboxed
|
||||
TR opt: unboxed-let-constants.rkt 20:18 z -- leave var unboxed
|
||||
TR opt: unboxed-let-constants.rkt 20:2 (real-part (+ x z)) -- complex accessor elimination
|
||||
TR opt: unboxed-let-constants.rkt 19:16 ((x) 5.0+5.0i) -- unboxed let bindings
|
||||
TR opt: unboxed-let-constants.rkt 19:21 5.0+5.0i -- unboxed literal
|
||||
TR opt: unboxed-let-constants.rkt 20:16 ((z) x) -- unboxed let bindings
|
||||
TR opt: unboxed-let-constants.rkt 20:21 x -- leave var unboxed
|
||||
TR opt: unboxed-let-constants.rkt 21:13 (+ x z) -- unboxed binary float complex
|
||||
TR opt: unboxed-let-constants.rkt 21:16 x -- leave var unboxed
|
||||
TR opt: unboxed-let-constants.rkt 21:18 z -- leave var unboxed
|
||||
TR opt: unboxed-let-constants.rkt 21:2 (real-part (+ x z)) -- complex accessor elimination
|
||||
END
|
||||
#<<END
|
||||
10.0
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
#;#;
|
||||
#<<END
|
||||
TR opt: unboxed-let.rkt 27:0 (let* ((t1 (+ 1.0+2.0i 2.0+4.0i)) (t2 (- t1 3.0+6.0i)) (t3 4.0+8.0i)) (+ t2 t3)) -- unboxed let bindings
|
||||
TR opt: unboxed-let.rkt 27:0 (let* ((t1 (+ 1.0+2.0i 2.0+4.0i)) (t2 (- t1 3.0+6.0i)) (t3 4.0+8.0i)) (+ t2 t3)) -- unboxed let bindings
|
||||
TR opt: unboxed-let.rkt 27:0 (let* ((t1 (+ 1.0+2.0i 2.0+4.0i)) (t2 (- t1 3.0+6.0i)) (t3 4.0+8.0i)) (+ t2 t3)) -- unboxed let bindings
|
||||
TR opt: unboxed-let.rkt 27:11 (+ 1.0+2.0i 2.0+4.0i) -- unboxed binary float complex
|
||||
TR opt: unboxed-let.rkt 27:14 1.0+2.0i -- unboxed literal
|
||||
TR opt: unboxed-let.rkt 27:23 2.0+4.0i -- unboxed literal
|
||||
TR opt: unboxed-let.rkt 27:7 (t1 (+ 1.0+2.0i 2.0+4.0i)) -- unboxed let bindings
|
||||
TR opt: unboxed-let.rkt 28:11 (- t1 3.0+6.0i) -- unboxed binary float complex
|
||||
TR opt: unboxed-let.rkt 28:14 t1 -- leave var unboxed
|
||||
TR opt: unboxed-let.rkt 28:17 3.0+6.0i -- unboxed literal
|
||||
TR opt: unboxed-let.rkt 28:7 (t2 (- t1 3.0+6.0i)) -- unboxed let bindings
|
||||
TR opt: unboxed-let.rkt 29:11 4.0+8.0i -- unboxed literal
|
||||
TR opt: unboxed-let.rkt 29:7 (t3 4.0+8.0i) -- unboxed let bindings
|
||||
TR opt: unboxed-let.rkt 30:2 (+ t2 t3) -- unboxed binary float complex
|
||||
TR opt: unboxed-let.rkt 30:5 t2 -- leave var unboxed
|
||||
TR opt: unboxed-let.rkt 30:8 t3 -- leave var unboxed
|
||||
|
|
|
@ -1,15 +1,16 @@
|
|||
#;#;
|
||||
#<<END
|
||||
TR opt: unboxed-let2.rkt 22:0 (let ((t1 (+ 1.0+2.0i 2.0+4.0i)) (t2 (+ 3.0+6.0i 4.0+8.0i))) (+ t1 t2)) -- unboxed let bindings
|
||||
TR opt: unboxed-let2.rkt 22:10 (+ 1.0+2.0i 2.0+4.0i) -- unboxed binary float complex
|
||||
TR opt: unboxed-let2.rkt 22:13 1.0+2.0i -- unboxed literal
|
||||
TR opt: unboxed-let2.rkt 22:22 2.0+4.0i -- unboxed literal
|
||||
TR opt: unboxed-let2.rkt 23:10 (+ 3.0+6.0i 4.0+8.0i) -- unboxed binary float complex
|
||||
TR opt: unboxed-let2.rkt 23:13 3.0+6.0i -- unboxed literal
|
||||
TR opt: unboxed-let2.rkt 23:22 4.0+8.0i -- unboxed literal
|
||||
TR opt: unboxed-let2.rkt 24:2 (+ t1 t2) -- unboxed binary float complex
|
||||
TR opt: unboxed-let2.rkt 24:5 t1 -- leave var unboxed
|
||||
TR opt: unboxed-let2.rkt 24:8 t2 -- leave var unboxed
|
||||
TR opt: unboxed-let2.rkt 23:10 (+ 1.0+2.0i 2.0+4.0i) -- unboxed binary float complex
|
||||
TR opt: unboxed-let2.rkt 23:13 1.0+2.0i -- unboxed literal
|
||||
TR opt: unboxed-let2.rkt 23:22 2.0+4.0i -- unboxed literal
|
||||
TR opt: unboxed-let2.rkt 23:6 (t1 (+ 1.0+2.0i 2.0+4.0i)) -- unboxed let bindings
|
||||
TR opt: unboxed-let2.rkt 24:10 (+ 3.0+6.0i 4.0+8.0i) -- unboxed binary float complex
|
||||
TR opt: unboxed-let2.rkt 24:13 3.0+6.0i -- unboxed literal
|
||||
TR opt: unboxed-let2.rkt 24:22 4.0+8.0i -- unboxed literal
|
||||
TR opt: unboxed-let2.rkt 24:6 (t2 (+ 3.0+6.0i 4.0+8.0i)) -- unboxed let bindings
|
||||
TR opt: unboxed-let2.rkt 25:2 (+ t1 t2) -- unboxed binary float complex
|
||||
TR opt: unboxed-let2.rkt 25:5 t1 -- leave var unboxed
|
||||
TR opt: unboxed-let2.rkt 25:8 t2 -- leave var unboxed
|
||||
END
|
||||
#<<END
|
||||
10.0+20.0i
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#;#;
|
||||
#<<END
|
||||
TR opt: unboxed-let3.rkt 27:0 (let ((x (+ 1.0+2.0i 2.0+4.0i))) (if (even? 2) x (+ x 2.0+4.0i))) -- unboxed let bindings
|
||||
TR opt: unboxed-let3.rkt 27:12 1.0+2.0i -- unboxed literal
|
||||
TR opt: unboxed-let3.rkt 27:21 2.0+4.0i -- unboxed literal
|
||||
TR opt: unboxed-let3.rkt 27:6 (x (+ 1.0+2.0i 2.0+4.0i)) -- unboxed let bindings
|
||||
TR opt: unboxed-let3.rkt 27:9 (+ 1.0+2.0i 2.0+4.0i) -- unboxed binary float complex
|
||||
TR opt: unboxed-let3.rkt 29:6 x -- unboxed complex variable
|
||||
TR opt: unboxed-let3.rkt 30:11 2.0+4.0i -- unboxed literal
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#;#;
|
||||
#<<END
|
||||
TR opt: unboxed-letrec-syntaxes+values.rkt 19:0 (letrec-syntaxes+values (((s) (syntax-rules () ((_ x) x)))) (((x) (+ 1.0+2.0i 2.0+4.0i))) (+ x 2.0+4.0i)) -- unboxed let bindings
|
||||
TR opt: unboxed-letrec-syntaxes+values.rkt 20:25 ((x) (+ 1.0+2.0i 2.0+4.0i)) -- unboxed let bindings
|
||||
TR opt: unboxed-letrec-syntaxes+values.rkt 20:30 (+ 1.0+2.0i 2.0+4.0i) -- unboxed binary float complex
|
||||
TR opt: unboxed-letrec-syntaxes+values.rkt 20:33 1.0+2.0i -- unboxed literal
|
||||
TR opt: unboxed-letrec-syntaxes+values.rkt 20:42 2.0+4.0i -- unboxed literal
|
||||
|
|
|
@ -1,13 +1,14 @@
|
|||
#;#;
|
||||
#<<END
|
||||
TR opt: unboxed-letrec.rkt 22:0 (letrec: ((f : (Any -> Any) (lambda: ((x : Any)) (f x))) (x : Float-Complex 1.0+2.0i) (y : Float-Complex (+ 2.0+4.0i 3.0+6.0i))) (+ x y)) -- unboxed let bindings
|
||||
TR opt: unboxed-letrec.rkt 23:31 1.0+2.0i -- unboxed literal
|
||||
TR opt: unboxed-letrec.rkt 24:31 (+ 2.0+4.0i 3.0+6.0i) -- unboxed binary float complex
|
||||
TR opt: unboxed-letrec.rkt 24:34 2.0+4.0i -- unboxed literal
|
||||
TR opt: unboxed-letrec.rkt 24:43 3.0+6.0i -- unboxed literal
|
||||
TR opt: unboxed-letrec.rkt 25:2 (+ x y) -- unboxed binary float complex
|
||||
TR opt: unboxed-letrec.rkt 25:5 x -- leave var unboxed
|
||||
TR opt: unboxed-letrec.rkt 25:7 y -- leave var unboxed
|
||||
TR opt: unboxed-letrec.rkt 24:10 (x : Float-Complex 1.0+2.0i) -- unboxed let bindings
|
||||
TR opt: unboxed-letrec.rkt 24:31 1.0+2.0i -- unboxed literal
|
||||
TR opt: unboxed-letrec.rkt 25:10 (y : Float-Complex (+ 2.0+4.0i 3.0+6.0i)) -- unboxed let bindings
|
||||
TR opt: unboxed-letrec.rkt 25:31 (+ 2.0+4.0i 3.0+6.0i) -- unboxed binary float complex
|
||||
TR opt: unboxed-letrec.rkt 25:34 2.0+4.0i -- unboxed literal
|
||||
TR opt: unboxed-letrec.rkt 25:43 3.0+6.0i -- unboxed literal
|
||||
TR opt: unboxed-letrec.rkt 26:2 (+ x y) -- unboxed binary float complex
|
||||
TR opt: unboxed-letrec.rkt 26:5 x -- leave var unboxed
|
||||
TR opt: unboxed-letrec.rkt 26:7 y -- leave var unboxed
|
||||
END
|
||||
#<<END
|
||||
6.0+12.0i
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
#;#;
|
||||
#<<END
|
||||
TR opt: unboxed-make-rectangular.rkt 26:0 (let ((x (make-rectangular 1.0 2.0))) (+ x 2.0+4.0i)) -- unboxed let bindings
|
||||
TR opt: unboxed-make-rectangular.rkt 26:6 (x (make-rectangular 1.0 2.0)) -- unboxed let bindings
|
||||
TR opt: unboxed-make-rectangular.rkt 26:9 (make-rectangular 1.0 2.0) -- make-rectangular elimination
|
||||
TR opt: unboxed-make-rectangular.rkt 27:2 (+ x 2.0+4.0i) -- unboxed binary float complex
|
||||
TR opt: unboxed-make-rectangular.rkt 27:5 x -- leave var unboxed
|
||||
TR opt: unboxed-make-rectangular.rkt 27:7 2.0+4.0i -- unboxed literal
|
||||
TR opt: unboxed-make-rectangular.rkt 28:0 (let ((x (unsafe-make-flrectangular 1.0 2.0))) (+ x 2.0+4.0i)) -- unboxed let bindings
|
||||
TR opt: unboxed-make-rectangular.rkt 28:6 (x (unsafe-make-flrectangular 1.0 2.0)) -- unboxed let bindings
|
||||
TR opt: unboxed-make-rectangular.rkt 28:9 (unsafe-make-flrectangular 1.0 2.0) -- make-rectangular elimination
|
||||
TR opt: unboxed-make-rectangular.rkt 29:2 (+ x 2.0+4.0i) -- unboxed binary float complex
|
||||
TR opt: unboxed-make-rectangular.rkt 29:5 x -- leave var unboxed
|
||||
|
|
Loading…
Reference in New Issue
Block a user