From bb230e093972d5836fc05a99b412d43c942c9f81 Mon Sep 17 00:00:00 2001 From: Eric Dobson Date: Thu, 19 Sep 2013 08:51:46 -0700 Subject: [PATCH] Make parsing unboxed calls more declarative. original commit: a41e70375e07376b84294beb07b2e97ff0174b57 --- .../typed-racket/optimizer/float-complex.rkt | 5 ++--- .../typed-racket/optimizer/unboxed-let.rkt | 14 +++++--------- 2 files changed, 7 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 ae7f9f06..6be2f165 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 @@ -394,9 +394,8 @@ #:with opt #`(let*-values (exp.bindings ...) (unsafe-make-flrectangular exp.real-binding exp.imag-binding))) - (pattern (#%plain-app op:unboxed-fun args:expr ...) - ;no need to optimize op - #:with (~var call (float-complex-call-site-opt-expr #'op.unboxed-info)) #'(args ...) + (pattern (#%plain-app op:unboxed-fun . + (~var call (float-complex-call-site-opt-expr #'op.unboxed-info))) #:do [(log-arity-raising-opt "call to fun with unboxed args")] #:with opt #'(let*-values (call.bindings ...) (op call.args ...))) 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 7cef103a..d7a81fa1 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 @@ -28,15 +28,11 @@ #:literal-sets (kernel-literals) #:attributes (opt) (pattern (#%plain-app - (~and let-e (letrec-values - bindings - loop-fun:id)) ; sole element of the body - args:expr ...) - #: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 call (float-complex-call-site-opt-expr #'loop-fun2.unboxed-info)) - #'(args ...) + (~and (letrec-values _ :id) ; sole element of the body is an id + (~var operator (unboxed-let-opt-expr-internal #t)) + (letrec-values _ loop-fun:unboxed-fun)) . + (~var call (float-complex-call-site-opt-expr #'loop-fun.unboxed-info))) + #:do [(log-optimization "unboxed let loop" arity-raising-opt-msg #'loop-fun)] #:with opt #'(let*-values (((op) operator.opt) call.bindings ...) (op call.args ...))))