Make function for adding vars to unboxed vars table.
This commit is contained in:
parent
3cab38845e
commit
7af7dea078
|
@ -130,7 +130,7 @@
|
||||||
(for ((v (in-syntax #'(opt-candidates.id ...)))
|
(for ((v (in-syntax #'(opt-candidates.id ...)))
|
||||||
(r (in-syntax #'(opt-candidates.real-binding ...)))
|
(r (in-syntax #'(opt-candidates.real-binding ...)))
|
||||||
(i (in-syntax #'(opt-candidates.imag-binding ...))))
|
(i (in-syntax #'(opt-candidates.imag-binding ...))))
|
||||||
(dict-set! unboxed-vars-table v (list r i v)))]
|
(add-unboxed-var! v r i))]
|
||||||
;; in the case where no bindings are unboxed, we create a let
|
;; in the case where no bindings are unboxed, we create a let
|
||||||
;; that is equivalent to the original, but with all parts optimized
|
;; that is equivalent to the original, but with all parts optimized
|
||||||
#:with opt (quasisyntax/loc/origin
|
#:with opt (quasisyntax/loc/origin
|
||||||
|
@ -274,10 +274,7 @@
|
||||||
body.opt ...))]
|
body.opt ...))]
|
||||||
[(memq i to-unbox)
|
[(memq i to-unbox)
|
||||||
;; we unbox the current param, add to the table
|
;; we unbox the current param, add to the table
|
||||||
(dict-set! unboxed-vars-table (car params)
|
(add-unboxed-var! (car params) (car real-parts) (car imag-parts))
|
||||||
(list (car real-parts)
|
|
||||||
(car imag-parts)
|
|
||||||
(car params)))
|
|
||||||
(loop (cdr params) (add1 i)
|
(loop (cdr params) (add1 i)
|
||||||
(cdr real-parts) (cdr imag-parts)
|
(cdr real-parts) (cdr imag-parts)
|
||||||
boxed)]
|
boxed)]
|
||||||
|
|
|
@ -5,14 +5,18 @@
|
||||||
(utils tc-utils))
|
(utils tc-utils))
|
||||||
|
|
||||||
(provide
|
(provide
|
||||||
unboxed-vars-table
|
|
||||||
unboxed-funs-table
|
unboxed-funs-table
|
||||||
|
add-unboxed-var!
|
||||||
unboxed-var)
|
unboxed-var)
|
||||||
|
|
||||||
;; contains the bindings which actually exist as separate bindings for each component
|
;; contains the bindings which actually exist as separate bindings for each component
|
||||||
;; associates identifiers to lists (real-binding imag-binding orig-binding-occurrence)
|
;; associates identifiers to lists (real-binding imag-binding orig-binding-occurrence)
|
||||||
(define unboxed-vars-table (make-free-id-table))
|
(define unboxed-vars-table (make-free-id-table))
|
||||||
|
|
||||||
|
(define (add-unboxed-var! orig-binding real-binding imag-binding)
|
||||||
|
(dict-set! unboxed-vars-table orig-binding
|
||||||
|
(list real-binding imag-binding orig-binding)))
|
||||||
|
|
||||||
(define-syntax-class unboxed-var
|
(define-syntax-class unboxed-var
|
||||||
#:attributes (real-binding imag-binding)
|
#:attributes (real-binding imag-binding)
|
||||||
(pattern v:id
|
(pattern v:id
|
||||||
|
|
Loading…
Reference in New Issue
Block a user