From 0d0465135d3cc5d7882fefa6bc4e68f132f594ed Mon Sep 17 00:00:00 2001 From: Andy Wingo Date: Tue, 5 Nov 2013 18:16:13 +0100 Subject: [PATCH] Re-add the list hack to compile-cps * module/language/tree-il/compile-cps.scm (convert): Re-add the list hack. Ideally these go into some tree-il pass. --- module/language/tree-il/compile-cps.scm | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/module/language/tree-il/compile-cps.scm b/module/language/tree-il/compile-cps.scm index 67f1ec15c..493e1e760 100644 --- a/module/language/tree-il/compile-cps.scm +++ b/module/language/tree-il/compile-cps.scm @@ -376,6 +376,31 @@ (make-lexical-ref src 'v v) (reverse args) (reverse (iota len)))))) k subst)) + ((and (eq? name 'list) + (and-map (match-lambda + ((or ($ ) + ($ ) + ($ ) + ($ )) #t) + (_ #f)) + args)) + ;; The same situation occurs with "list". + (let lp ((args args) (k k)) + (match args + (() + (build-cps-term + ($continue k ($const '())))) + ((arg . args) + (let-gensyms (ktail tail) + (build-cps-term + ($letk ((ktail src + ($kargs ('tail) (tail) + ,(convert-arg arg + (lambda (head) + (build-cps-term + ($continue k + ($primcall 'cons (head tail))))))))) + ,(lp args ktail)))))))) (else (convert-args args (lambda (args) -- 2.20.1