From 69f690f4b981901e060732aaae392189e1490c14 Mon Sep 17 00:00:00 2001 From: Eric Dobson Date: Sat, 26 Oct 2013 09:31:09 -0700 Subject: [PATCH] Move more call-site optimization structure into the syntax class. --- .../typed-racket/optimizer/float-complex.rkt | 19 ++++++++++--------- .../typed-racket/optimizer/unboxed-let.rkt | 4 +--- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/optimizer/float-complex.rkt b/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/optimizer/float-complex.rkt index ae0b1c44a5..b94b8394a1 100644 --- a/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/optimizer/float-complex.rkt +++ b/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/optimizer/float-complex.rkt @@ -410,7 +410,7 @@ (~var call (float-complex-call-site-opt-expr #'op.unboxed-info))) #:do [(log-unboxing-opt "unboxed call site") (log-arity-raising-opt "call to fun with unboxed args")] - #:with opt #'(let*-values (call.bindings ...) (op call.args ...))) + #:with opt ((attribute call.opt-app) #'op)) (pattern :float-complex-arith-opt-expr)) @@ -494,18 +494,19 @@ ;; We cannot log opt here because this doesn't see the full original syntax (define-syntax-class (float-complex-call-site-opt-expr unboxed-info) #:commit - #:attributes ((bindings 1) (args 1)) + #:attributes (opt-app) ;; call site of a function with unboxed parameters ;; the calling convention is: real parts of unboxed, imag parts, boxed (pattern (orig-args:expr ...) #:with (unboxed-args ...) unboxed-info - #:with ((bindings ...) (args ...)) - (syntax-parse #'((unboxed-args orig-args) ...) - [(e:possibly-unboxed ...) - #'((e.bindings ... ...) - (e.real-binding ... ... - e.imag-binding ... ... - e.boxed-binding ... ...))]))) + #:attr opt-app + (λ (op) + (syntax-parse #'((unboxed-args orig-args) ...) + [(e:possibly-unboxed ...) + #`(let*-values (e.bindings ... ...) + (#,op e.real-binding ... ... + e.imag-binding ... ... + e.boxed-binding ... ...))])))) (define-syntax-class/specialize float-complex-arith-opt-expr (float-complex-arith-expr* #t)) diff --git a/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/optimizer/unboxed-let.rkt b/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/optimizer/unboxed-let.rkt index 924c36711c..256039d0b5 100644 --- a/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/optimizer/unboxed-let.rkt +++ b/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/optimizer/unboxed-let.rkt @@ -36,9 +36,7 @@ (~var call (float-complex-call-site-opt-expr #'loop-fun.unboxed-info))) #:do [(log-opt "unboxed call site" "Complex number unboxing") (log-optimization "unboxed let loop" arity-raising-opt-msg #'loop-fun)] - #:with opt #'(let*-values - (((op) operator.opt) call.bindings ...) - (op call.args ...)))) + #:with opt #`(let*-values (((op) operator.opt)) #,((attribute call.opt-app) #'op)))) ;; does the bulk of the work ;; detects which let bindings can be unboxed, same for arguments of let-bound