summaryrefslogtreecommitdiff
path: root/module/language/glil/compile-assembly.scm
diff options
context:
space:
mode:
Diffstat (limited to 'module/language/glil/compile-assembly.scm')
-rw-r--r--module/language/glil/compile-assembly.scm13
1 files changed, 11 insertions, 2 deletions
diff --git a/module/language/glil/compile-assembly.scm b/module/language/glil/compile-assembly.scm
index c76e41225..a51fd580a 100644
--- a/module/language/glil/compile-assembly.scm
+++ b/module/language/glil/compile-assembly.scm
@@ -103,6 +103,15 @@
(define (immediate? x)
(object->assembly x))
+;; This tests for a proper scheme list whose last cdr is '(), not #nil.
+;;
+(define (scheme-list? 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
;; procedure's module. Hence all of this 1+ length business.
@@ -733,7 +742,7 @@
((keyword? x)
`(,@(dump-object (keyword->symbol x) addr)
(make-keyword)))
- ((list? x)
+ ((scheme-list? x)
(let ((tail (let ((len (length x)))
(if (>= len 65536) (too-long "list"))
`((list ,(quotient len 256) ,(modulo len 256))))))
@@ -815,7 +824,7 @@
(values code (addr+ addr code))))
((variable-cache-cell? x)
(dump1 (variable-cache-cell-key x) i addr))
- ((list? x)
+ ((scheme-list? x)
(receive (codes addr)
(fold2 (lambda (x codes addr)
(receive (subcode addr) (ref-or-dump x i addr)