Change api of add unboxed-fun..

original commit: ced8879881a2c20ed96d747208e4563d7a4a5cd1
This commit is contained in:
Eric Dobson 2013-09-18 22:25:52 -07:00
parent a8a46ddeef
commit add9841c10
2 changed files with 11 additions and 8 deletions

View File

@ -86,9 +86,8 @@
(syntax-parse (cadr p)
#:literal-sets (kernel-literals)
[(#%plain-lambda params body ...)
(define-values (unboxed boxed)
(for/fold ([unboxed empty] [boxed empty])
([param (in-syntax #'params)]
(define unboxed-args
(for/list ([param (in-syntax #'params)]
[dom doms]
[i (in-naturals)])
(cond
@ -98,14 +97,14 @@
#'(begin body ...)))
;; we can unbox
(log-optimization "unboxed var -> table" arity-raising-opt-msg param)
(values (cons i unboxed) boxed)]
[else (values unboxed (cons i boxed))])))
#t]
[else #f])))
;; can we unbox anything?
(and (> (length unboxed) 0)
(and (member #t unboxed-args)
;; if so, add to the table of functions with
;; unboxed params, so we can modify its call
;; sites, its body and its header
(add-unboxed-fun! fun-name unboxed boxed))]
(add-unboxed-fun! fun-name unboxed-args))]
[_ #f])]
[_ #f])))))
rest)))

View File

@ -37,7 +37,11 @@
;; params first, then all imaginary parts, then all boxed arguments
(define unboxed-funs-table (make-free-id-table))
(define (add-unboxed-fun! fun-name unboxed boxed)
(define (add-unboxed-fun! fun-name unboxed-args)
(define unboxed
(for/list ([i (in-naturals)] [unboxed? unboxed-args] #:when unboxed?) i))
(define boxed
(for/list ([i (in-naturals)] [unboxed? unboxed-args] #:unless unboxed?) i))
(dict-set! unboxed-funs-table fun-name (list unboxed boxed)))
(define-syntax-class unboxed-fun