From c5f6c2e47fab220fd090d911efc2a71a563b7c1d Mon Sep 17 00:00:00 2001 From: Mark H Weaver Date: Sat, 14 Jan 2012 04:28:16 -0500 Subject: [PATCH] Don't diverge when serializing cyclic lists during compilation * module/language/glil/compile-assembly.scm (scheme-list?): Don't diverge when serializing cyclic lists. --- module/language/glil/compile-assembly.scm | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/module/language/glil/compile-assembly.scm b/module/language/glil/compile-assembly.scm index 997f7c78d..a51fd580a 100644 --- a/module/language/glil/compile-assembly.scm +++ b/module/language/glil/compile-assembly.scm @@ -106,9 +106,11 @@ ;; This tests for a proper scheme list whose last cdr is '(), not #nil. ;; (define (scheme-list? x) - (or (eq? x '()) - (and (pair? x) - (scheme-list? (cdr x))))) + (and (list? x) + (or (eq? x '()) + (let ((p (last-pair x))) + (and (pair? p) + (eq? (cdr p) '())))))) ;; Note: in all of these procedures that build up constant tables, the ;; first (zeroth) index is reserved. At runtime it is replaced with the