From d4e3c65ca706ff6847fed54f898dcf23627cc2e7 Mon Sep 17 00:00:00 2001 From: Justin Ethier Date: Fri, 14 Sep 2018 18:06:50 -0400 Subject: [PATCH] Staging initial cgen changes --- scheme/cyclone/cgen.sld | 35 +++++++++++++++++++++++++---------- 1 file changed, 25 insertions(+), 10 deletions(-) diff --git a/scheme/cyclone/cgen.sld b/scheme/cyclone/cgen.sld index 87b9d194..4eb9d277 100644 --- a/scheme/cyclone/cgen.sld +++ b/scheme/cyclone/cgen.sld @@ -912,16 +912,31 @@ ");"))) (else ;; CPS, IE normal behavior (set-c-call-arity! num-cargs) - (c-code - (string-append - (c:allocs->str (c:allocs cfun) "\n") - (c:allocs->str (c:allocs cargs) "\n") - "return_closcall" (number->string num-cargs) - "(data," - this-cont - (if (> num-cargs 0) "," "") - (c:body cargs) - ");")))))) + (with-fnc (ast:lambda-id (closure->lam fun)) (lambda (fnc) + (if (and #f (adbf:well-known fnc)) + #f + ;;(c-code + ;; (string-append + ;; (c:allocs->str (c:allocs cfun) "\n") + ;; (c:allocs->str (c:allocs cargs) "\n") + ;; "return_direct_with_clo" (number->string num-cargs) + ;; "(data," + ;; this-cont + ;; "," + ;; // TODO: fnc name, twice + ;; (if (> num-cargs 0) "," "") + ;; (c:body cargs) + ;; ");")) + (c-code + (string-append + (c:allocs->str (c:allocs cfun) "\n") + (c:allocs->str (c:allocs cargs) "\n") + "return_closcall" (number->string num-cargs) + "(data," + this-cont + (if (> num-cargs 0) "," "") + (c:body cargs) + ");"))))))))) ((equal? 'Cyc-seq fun) (let ((exps (foldr