mirror of
https://github.com/justinethier/cyclone.git
synced 2025-05-23 20:15:05 +02:00
Emit more efficient calls for compiled continuations
This commit is contained in:
parent
cc7a2a5027
commit
881ce5fb7f
1 changed files with 16 additions and 1 deletions
|
@ -1097,7 +1097,10 @@
|
|||
(this-cont (c:body cfun))
|
||||
(cargs (c-compile-args (cdr args) append-preamble " " this-cont ast-id trace cps?))
|
||||
(raw-cargs (cdddr cargs)) ; Same as above but with lists instead of appended strings
|
||||
(num-cargs (c:num-args cargs)))
|
||||
(num-cargs (c:num-args cargs))
|
||||
(is-cont (and (equal? (length fun) 4)
|
||||
(cadddr fun))))
|
||||
;(trace:error `(JAE DEBUG ,is-cont ,fun))
|
||||
(cond
|
||||
((not cps?)
|
||||
(c:code
|
||||
|
@ -1214,6 +1217,18 @@
|
|||
(if (> num-cargs 0) "," "")
|
||||
(c:body cargs)
|
||||
");"))))
|
||||
(is-cont ;; Compiled continuation, can make a more efficient call
|
||||
(c:code
|
||||
(string-append
|
||||
(c:allocs->str (c:allocs cfun) "\n")
|
||||
(c:allocs->str (c:allocs cargs) "\n")
|
||||
"return_direct_with_clo" (number->string (c:num-args cargs))
|
||||
"(data,"
|
||||
this-cont
|
||||
", (((closure)" this-cont ")->fn)"
|
||||
(if (> (c:num-args cargs) 0) "," "")
|
||||
(c:body cargs)
|
||||
");")))
|
||||
(else
|
||||
(c:code
|
||||
(string-append
|
||||
|
|
Loading…
Add table
Reference in a new issue