From cc7a2a50278fc285846e55b638bd2aaf6b8a956a Mon Sep 17 00:00:00 2001 From: Justin Ethier Date: Fri, 28 May 2021 17:08:44 -0400 Subject: [PATCH] Indicate compiled closures for closure convert phase --- scheme/cyclone/cps-optimizations.sld | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/scheme/cyclone/cps-optimizations.sld b/scheme/cyclone/cps-optimizations.sld index cd0f0518..e3fb9698 100644 --- a/scheme/cyclone/cps-optimizations.sld +++ b/scheme/cyclone/cps-optimizations.sld @@ -345,6 +345,12 @@ (let ((var (adb:get/default sym (adb:make-var)))) (fnc var))) + ;; If var found in adb pass to callback and return result, else return #f + (define (if-var sym callback) + (let* ((var (adb:get/default sym #f)) + (result (if var (callback var) #f))) + result)) + (define (with-fnc id callback) (let ((fnc (adb:get/default id (adb:make-fnc)))) (callback fnc))) @@ -1961,7 +1967,12 @@ ((lambda? fn) (error `(Unexpected lambda in closure-convert ,exp))) (else (let ((f (cc fn))) - `((%closure-ref ,f 0) + `((%closure-ref ,f 0 + ;; Indicate if closure refers to a compiled continuation + ,@(if (and (symbol? fn) + (if-var fn adbv:cont?)) + (list #t) + (list))) ,f ,@args)))))) (else