From a61ba42a1dc4a727254d0f766dd4caa241502b7d Mon Sep 17 00:00:00 2001 From: Justin Ethier Date: Thu, 7 Jun 2018 13:23:04 -0400 Subject: [PATCH] Compile args separately --- scheme/cyclone/cgen.sld | 34 +++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/scheme/cyclone/cgen.sld b/scheme/cyclone/cgen.sld index 4697a6b4..c0323852 100644 --- a/scheme/cyclone/cgen.sld +++ b/scheme/cyclone/cgen.sld @@ -724,20 +724,32 @@ (equal? (cadr fun) (cdr trace)) ;; Needed? (equal? (car args) (cdr trace)) ) - (let* ((cgen - ;; TODO: skip the closure, just cdr the cdr??? - (c-compile-args - (cdr args) - append-preamble - "" - "" ;;this-cont - trace - cps?))) + (let* ((cgen-lis + ;; TODO: need a way to get the original args to the top-level function + ;; TODO: probably need a specilized function here instead + + ;(c-compile-args + ; (cddr args) ;; Skip the closure + ; append-preamble + ; "" + ; "" ;;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 (string-append - ;(c:allocs->str (c:allocs cgen)) + cgen-allocs ;(c:allocs->str (c:allocs cgen)) "\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" "goto loop;"))) )