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 eed8d5a9..ae7f9f06 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 @@ -396,8 +396,9 @@ (pattern (#%plain-app op:unboxed-fun args:expr ...) ;no need to optimize op - #:with (~var || (float-complex-call-site-opt-expr #'op.unboxed-info)) #'(op args ...) - #:do [(log-arity-raising-opt "call to fun with unboxed args")]) + #:with (~var call (float-complex-call-site-opt-expr #'op.unboxed-info)) #'(args ...) + #:do [(log-arity-raising-opt "call to fun with unboxed args")] + #:with opt #'(let*-values (call.bindings ...) (op call.args ...))) (pattern :float-complex-arith-opt-expr)) @@ -478,24 +479,21 @@ #:with (boxed-binding ...) #'(binding-name))) ;; takes as argument a structure describing which arguments will be unboxed -;; and the optimized version of the operator. operators are optimized elsewhere -;; to benefit from local information (define-syntax-class (float-complex-call-site-opt-expr unboxed-info) #:commit - #:attributes (opt) + #:attributes ((bindings 1) (args 1)) ;; call site of a function with unboxed parameters ;; the calling convention is: real parts of unboxed, imag parts, boxed - (pattern (op:expr args:expr ...) + (pattern (orig-args:expr ...) #:with (unboxed-args ...) unboxed-info - #:with opt - (syntax-parse #'((unboxed-args args) ...) + #:with ((bindings ...) (args ...)) + (syntax-parse #'((unboxed-args orig-args) ...) [(e:possibly-unboxed ...) (log-unboxing-opt "unboxed call site") - #`(let*-values (e.bindings ... ...) - (#%plain-app op - e.real-binding ... ... - e.imag-binding ... ... - e.boxed-binding ... ...))]))) + #'((e.bindings ... ...) + (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 44f6dafd..7cef103a 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 @@ -35,8 +35,11 @@ #:with (~var operator (unboxed-let-opt-expr-internal #t)) #'let-e #:with loop-fun2:unboxed-fun #'loop-fun #:do [(log-optimization "unboxed let loop" arity-raising-opt-msg #'loop-fun2)] - #:with (~var || (float-complex-call-site-opt-expr #'loop-fun2.unboxed-info)) - #'(operator.opt args ...))) + #:with (~var call (float-complex-call-site-opt-expr #'loop-fun2.unboxed-info)) + #'(args ...) + #:with opt #'(let*-values + (((op) operator.opt) call.bindings ...) + (op call.args ...)))) ;; does the bulk of the work ;; detects which let bindings can be unboxed, same for arguments of let-bound