room: Fix reconstituting CONS cells with unbound-marker in the CAR.
authorAlastair Bridgewater <alastair.bridgewater@gmail.com>
Mon, 20 May 2013 19:43:19 +0000 (15:43 -0400)
committerAlastair Bridgewater <nyef@kana.lisphacker.com>
Mon, 20 May 2013 19:51:22 +0000 (15:51 -0400)
  * When I originally rewrote ROOM in terms of RECONSTITUTE-OBJECT,
I looked at what constitutes a valid CONS according to the runtime.
I noticed that one of the immediate types was an unbound marker
and said to myself "nobody's going to put one of those in a list".
This turned out to be a mistake.

  * x86 systems (and plausibly not any others) put unbound-markers
in lists when loading FASLs.  I have no real idea how or why, but
they do.  This would lead to an error, "Unrecognized widetag #x4A
in reconstitute-object".

  * Fix, by recording unbound-marker-widetag as being valid as the
first word of a CONS cell.

  * Issue reported by "scymtym" on #sbcl.

src/code/room.lisp

index 462474b..b94d9d8 100644 (file)
 (let ((cons-info (make-room-info :name 'cons
                                  :kind :list)))
   ;; A cons consists of two words, both of which may be either a
-  ;; pointer or immediate data.  Disregarding the possibility of an
-  ;; unbound-marker (permitted, according to the GC), this means
-  ;; either a fixnum, a character, a single-float on a 64-bit system,
-  ;; or a pointer.
+  ;; pointer or immediate data.  According to the runtime this means
+  ;; either a fixnum, a character, an unbound-marker, a single-float
+  ;; on a 64-bit system, or a pointer.
   (dotimes (i (ash 1 (- n-widetag-bits n-fixnum-tag-bits)))
     (setf (svref *meta-room-info* (ash i n-fixnum-tag-bits)) cons-info))
 
 
   (setf (svref *meta-room-info* character-widetag) cons-info)
 
+  (setf (svref *meta-room-info* unbound-marker-widetag) cons-info)
+
   ;; Single-floats are immediate data on 64-bit systems.
   #!+#.(cl:if (cl:= 64 sb!vm:n-word-bits) '(and) '(or))
   (setf (svref *meta-room-info* single-float-widetag) cons-info))