mirror of
https://github.com/justinethier/cyclone.git
synced 2025-07-16 17:27:33 +02:00
WIP
This commit is contained in:
parent
c39183500a
commit
d0564e991e
1 changed files with 23 additions and 24 deletions
|
@ -947,36 +947,34 @@
|
||||||
(adbf:calls-self? ast-fnc)
|
(adbf:calls-self? ast-fnc)
|
||||||
(self-closure-call? fun (car (adbf:all-params ast-fnc)))
|
(self-closure-call? fun (car (adbf:all-params ast-fnc)))
|
||||||
)
|
)
|
||||||
;; TODO: need to emit all of this:
|
(let* ((params (map mangle (cdr (adbf:all-params ast-fnc))))
|
||||||
;; arg reassignment
|
;; TODO: doesn't work, arg may contain non-CPS functions which have their own args...
|
||||||
;; GC check (w/fnc args and closure) - do after so we can just use args directly
|
(args (map (lambda (s)
|
||||||
;; continue statement
|
(string-replace-all s " " ""))
|
||||||
;;
|
(string-split (c:body cargs) #\,)))
|
||||||
;; example:
|
(reassignments (apply string-append
|
||||||
;;
|
(map
|
||||||
;; if (stack_overflow(c_73374, (((gc_thread_data *)data)->stack_limit))) {
|
|
||||||
;; //printf("starting GC\n");
|
|
||||||
;; object buf[3]; buf[0] = k_73154; buf[1] = l_7317_73101;buf[2] = a_7318_73102;
|
|
||||||
;; GC(data, self_73251, buf, argc);
|
|
||||||
;; }
|
|
||||||
;;//return_closcall3(data, car(((closureN)self_73251)->elements[0]), k_73154, Cyc_cddr(data, l_7317_73101), c_73374);
|
|
||||||
;; // same, no need to reassign: k_73154 = k_73154;
|
|
||||||
;; l_7317_73101 = Cyc_cddr(data, l_7317_73101);
|
|
||||||
;; a_7318_73102 = c_73374;
|
|
||||||
;; continue;
|
|
||||||
|
|
||||||
;; TODO: how to handle varargs (maybe we don't)??
|
|
||||||
(for-each
|
|
||||||
(lambda (param arg)
|
(lambda (param arg)
|
||||||
(trace:error `(JAE ,param = ,arg)))
|
(cond
|
||||||
(cdr (adbf:all-params ast-fnc))
|
((equal? param arg) "") ;; No need to reassign
|
||||||
(string-split (c:body cargs) #\,))
|
(else
|
||||||
|
(string-append
|
||||||
|
param " = " arg ";\n"))))
|
||||||
|
params
|
||||||
|
args))
|
||||||
|
))
|
||||||
|
;(for-each
|
||||||
|
; (lambda (param arg)
|
||||||
|
; (trace:error `(JAE ,param = ,arg)))
|
||||||
|
; params
|
||||||
|
; args)
|
||||||
|
|
||||||
(c-code
|
(c-code
|
||||||
(string-append
|
(string-append
|
||||||
(c:allocs->str (c:allocs cfun) "\n")
|
(c:allocs->str (c:allocs cfun) "\n")
|
||||||
(c:allocs->str (c:allocs cargs) "\n")
|
(c:allocs->str (c:allocs cargs) "\n")
|
||||||
;; TODO: reassign args
|
;; TODO: reassign args
|
||||||
|
reassignments
|
||||||
;; TODO: consider passing in a "top" instead of always calling alloca in macro below:
|
;; TODO: consider passing in a "top" instead of always calling alloca in macro below:
|
||||||
"continue_or_gc" (number->string (c:num-args cargs))
|
"continue_or_gc" (number->string (c:num-args cargs))
|
||||||
"(data,"
|
"(data,"
|
||||||
|
@ -985,6 +983,7 @@
|
||||||
(c:body cargs)
|
(c:body cargs)
|
||||||
");"
|
");"
|
||||||
)))
|
)))
|
||||||
|
)
|
||||||
|
|
||||||
((and wkf fnc
|
((and wkf fnc
|
||||||
*optimize-well-known-lambdas*
|
*optimize-well-known-lambdas*
|
||||||
|
|
Loading…
Add table
Reference in a new issue