From 66065bb127ea2d6351f89dcd6172284dc7c743c3 Mon Sep 17 00:00:00 2001 From: Justin Ethier Date: Tue, 5 Jun 2018 17:52:25 -0400 Subject: [PATCH] Output loop label --- scheme/cyclone/cgen.sld | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/scheme/cyclone/cgen.sld b/scheme/cyclone/cgen.sld index 67a49b2d..2ab5741b 100644 --- a/scheme/cyclone/cgen.sld +++ b/scheme/cyclone/cgen.sld @@ -1219,6 +1219,11 @@ (and (> (string-length tmp-ident) 3) (equal? "self" (substring tmp-ident 0 4)))) + (has-loop? + (and (not has-closure?) ;; Only top-level functions for now + (pair? trace) + (not (null? (cdr trace))) + (adbv:direct-rec-call? (adb:get (cdr trace))))) (formals* (string-append (if has-closure? @@ -1261,7 +1266,12 @@ (c:append (c-code ;; Only trace when entering initial defined function - (if has-closure? "" (st:->code trace))) + (cond + (has-closure? "") + (else + (string-append + (if has-loop? "\nloop:\n" "") + (st:->code trace))))) body) " ") "; \n"