Compile args separately

This commit is contained in:
Justin Ethier 2018-06-07 13:23:04 -04:00
parent b3ea8324bd
commit a61ba42a1d

View file

@ -724,20 +724,32 @@
(equal? (cadr fun) (cdr trace)) ;; Needed? (equal? (cadr fun) (cdr trace)) ;; Needed?
(equal? (car args) (cdr trace)) (equal? (car args) (cdr trace))
) )
(let* ((cgen (let* ((cgen-lis
;; TODO: skip the closure, just cdr the cdr??? ;; TODO: need a way to get the original args to the top-level function
(c-compile-args ;; TODO: probably need a specilized function here instead
(cdr args)
append-preamble ;(c-compile-args
"" ; (cddr args) ;; Skip the closure
"" ;;this-cont ; append-preamble
trace ; ""
cps?))) ; "" ;;this-cont
; trace
; cps?)
(map
(lambda (e)
(c-compile-exp e append-preamble "" "" cps?))
(cddr args)) ;; Skip the closure
)
(cgen-allocs
(apply string-append
(map (lambda (a) (c:allocs->str (c:allocs a))) cgen-lis)))
)
(trace:info `(loop ,cgen-lis))
(c-code (c-code
(string-append (string-append
;(c:allocs->str (c:allocs cgen)) cgen-allocs ;(c:allocs->str (c:allocs cgen))
"\n" "\n"
(c:body cgen) ;; TODO: re-assign function args, longer-term using temp variables ;; TODO: (c:body cgen) ;; TODO: re-assign function args, longer-term using temp variables
"\n" "\n"
"goto loop;"))) "goto loop;")))
) )