aboutsummaryrefslogtreecommitdiffstats
path: root/csc/cps.csc
diff options
context:
space:
mode:
Diffstat (limited to 'csc/cps.csc')
-rw-r--r--csc/cps.csc13
1 files changed, 12 insertions, 1 deletions
diff --git a/csc/cps.csc b/csc/cps.csc
index 9e1721c..cdd6611 100644
--- a/csc/cps.csc
+++ b/csc/cps.csc
@@ -56,7 +56,9 @@
%branch
%fix
%primitive
+ %tail
*globals*
+ *tail*
branch-atom
closure-arguments
closure-body
@@ -69,7 +71,8 @@
make-label
make-label
make-primitive
- make-variable)
+ make-variable
+ tail?)
(only (csc loop)
loop
return)
@@ -341,6 +344,8 @@
(get-boxed false)))
((% %apply proc args)
(make-ref-map))
+ ((% %tail)
+ (make-ref-map))
((% %fix funs body)
(loop with m = (get-boxed body)
for fun in funs
@@ -404,6 +409,8 @@
do (set! new-expr (make-primitive 'peek (list p (make-constant 0)) (list var)
new-expr))
finally (return new-expr)))
+ ((% %tail)
+ *tail*)
((% %fix funs body)
(define-values (new-names boxed-names temp-names) (convert-arg-list (loop for fun in funs
collect (closure-name fun))))
@@ -468,6 +475,8 @@
if (free? arg)
do (set! m (insert m arg #t))
finally (return m)))
+ ((% %tail)
+ (make-ref-map))
((% %fix funs body)
(loop for fun in funs
for name = (closure-name fun)
@@ -521,6 +530,8 @@
(fn (make-variable (gensym))))
(make-primitive 'peek (list p (make-constant 0)) (list fn)
(make-apply fn (cons p (map translate args))))))
+ ((% %tail)
+ *tail*)
((% %fix functions body)
(define frees (map free-vars functions))
(define fn-ptrs (loop for fun in functions