layout depth conflict with custom funcallable sequence class

Bug #2050088 reported by Christophe
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
SBCL
Fix Released
Medium
Unassigned

Bug Description

I'm trying to replicate the first example from "User-extensible sequences in Common Lisp" but SBCL master (e75515a6a) and SBCL 2.4.0 (both built with "--fancy") report an error with these two definitions (the behavior is the same whether or not I define "queue" first or second):

(defclass queue (standard-object sequence)
    ((%data :accessor %queue-data)
     (%pointer :accessor %queue-pointer)))

(defclass funcallable-queue (queue sb-mop:funcallable-standard-object)
  ()
  (:metaclass sb-mop:funcallable-standard-class))

When the second class is being defined, an error shows up as follows:

layout depth conflict: #(#<SB-KERNEL:LAYOUT (ID=340) for T {50101003}>
                         #<SB-KERNEL:LAYOUT (ID=129) for SEQUENCE {50101233}>
                         #<SB-KERNEL:LAYOUT (ID=341) for SB-PCL::SLOT-OBJECT {50111463}>
                         #<SB-KERNEL:LAYOUT (ID=342) for STANDARD-OBJECT {501134D3}>
                         #<SB-KERNEL:LAYOUT (ID=128) for FUNCTION {50101153}>
                         #<SB-KERNEL:LAYOUT (ID=343) for SB-MOP:FUNCALLABLE-STANDARD-OBJECT {50113463}>
                         #<SB-KERNEL:LAYOUT (ID=345) for QUEUE {502E5303}>)

I believe the example should still work as presented in the paper, hopefully this is the correct way to write it (I added "sb-mop:" in front of two symbols).

A call to (map () #'describe *) where * stands for the vector of layouts gives:

#<SB-KERNEL:LAYOUT (ID=340) for T {50101003}>
  [structure-object]

Slots with :INSTANCE allocation:
  FLAGS = 0
  CLOS-HASH = 2917193494582000972
  CLASSOID = #<SB-KERNEL:BUILT-IN-CLASSOID T (read-only)>
  INVALID = NIL
  INHERITS = #()
  %INFO = NIL
  EQUALP-IMPL = 0
  STRUCT-SLOT-MAP = 0
  SLOT-TABLE = #(1 NIL)
  ID-WORD0 = 340
  ID-WORD1 = 0
  ID-WORD2 = 0
#<SB-KERNEL:LAYOUT (ID=129) for SEQUENCE {50101233}>
  [structure-object]

Slots with :INSTANCE allocation:
  FLAGS = 8589934848
  CLOS-HASH = 2973156064943342943
  CLASSOID = #<SB-KERNEL:BUILT-IN-CLASSOID SEQUENCE (read-only)>
  INVALID = NIL
  INHERITS = #(#<SB-KERNEL:LAYOUT (ID=340) for T {50101003}>)
  %INFO = NIL
  EQUALP-IMPL = 0
  STRUCT-SLOT-MAP = 0
  SLOT-TABLE = #(1 NIL)
  ID-WORD0 = 129
  ID-WORD1 = 0
  ID-WORD2 = 0
#<SB-KERNEL:LAYOUT (ID=341) for SB-PCL::SLOT-OBJECT {50111463}>
  [structure-object]

Slots with :INSTANCE allocation:
  FLAGS = -8589934592
  CLOS-HASH = 3457679566203737886
  CLASSOID = #<SB-KERNEL:BUILT-IN-CLASSOID SB-PCL::SLOT-OBJECT (read-only)>
  INVALID = NIL
  INHERITS = #(#<SB-KERNEL:LAYOUT (ID=340) for T {50101003}>)
  %INFO = NIL
  EQUALP-IMPL = 0
  STRUCT-SLOT-MAP = 0
  SLOT-TABLE = #(1 NIL)
  ID-WORD0 = 341
  ID-WORD1 = 0
  ID-WORD2 = 0
#<SB-KERNEL:LAYOUT (ID=342) for STANDARD-OBJECT {501134D3}>
  [structure-object]

Slots with :INSTANCE allocation:
  FLAGS = -8589934076
  CLOS-HASH = 3541692201902988558
  CLASSOID = #<SB-KERNEL:STANDARD-CLASSOID STANDARD-OBJECT>
  INVALID = NIL
  INHERITS = #(#<SB-KERNEL:LAYOUT (ID=340) for T {50101003}> #<SB-KERNEL:LAYOUT (ID=341) for SB-PCL::SLOT-OBJECT {50111463}>)
  %INFO = NIL
  EQUALP-IMPL = 0
  STRUCT-SLOT-MAP = 0
  SLOT-TABLE = #(1 NIL)
  ID-WORD0 = 342
  ID-WORD1 = 0
  ID-WORD2 = 0
#<SB-KERNEL:LAYOUT (ID=128) for FUNCTION {50101153}>
  [structure-object]

Slots with :INSTANCE allocation:
  FLAGS = 8589934592
  CLOS-HASH = 3376082816255072221
  CLASSOID = #<SB-KERNEL:BUILT-IN-CLASSOID FUNCTION (read-only)>
  INVALID = NIL
  INHERITS = #(#<SB-KERNEL:LAYOUT (ID=340) for T {50101003}>)
  %INFO = NIL
  EQUALP-IMPL = 0
  STRUCT-SLOT-MAP = 0
  SLOT-TABLE = #(1 NIL)
  ID-WORD0 = 128
  ID-WORD1 = 0
  ID-WORD2 = 0
#<SB-KERNEL:LAYOUT (ID=343) for SB-MOP:FUNCALLABLE-STANDARD-OBJECT {50113463}>
  [structure-object]

Slots with :INSTANCE allocation:
  FLAGS = -8589934076
  CLOS-HASH = 4312183694679772690
  CLASSOID = #<SB-KERNEL:STANDARD-CLASSOID SB-MOP:FUNCALLABLE-STANDARD-OBJECT>
  INVALID = NIL
  INHERITS = #(#<SB-KERNEL:LAYOUT (ID=340) for T {50101003}> #<SB-KERNEL:LAYOUT (ID=128) for FUNCTION {50101153}> #<SB-KERNEL:LAYOUT (ID=341) for SB-PCL::SLOT-OBJECT {50111463}>..
  %INFO = NIL
  EQUALP-IMPL = 0
  STRUCT-SLOT-MAP = 0
  SLOT-TABLE = #(1 NIL)
  ID-WORD0 = 343
  ID-WORD1 = 0
  ID-WORD2 = 0
#<SB-KERNEL:LAYOUT (ID=345) for QUEUE {502E5303}>
  [structure-object]

Slots with :INSTANCE allocation:
  FLAGS = -8589933820
  CLOS-HASH = 2843883459518754746
  CLASSOID = #<SB-KERNEL:STANDARD-CLASSOID QUEUE>
  INVALID = NIL
  INHERITS = #(#<SB-KERNEL:LAYOUT (ID=340) for T {50101003}> #<SB-KERNEL:LAYOUT (ID=129) for SEQUENCE {50101233}> #<SB-KERNEL:LAYOUT (ID=341) for SB-PCL::SLOT-OBJECT {50111463}>..
  %INFO = NIL
  EQUALP-IMPL = 0
  STRUCT-SLOT-MAP = 0
  SLOT-TABLE = #(1 NIL)
  ID-WORD0 = 345
  ID-WORD1 = 0
  ID-WORD2 = 0
NIL

The above is from SBCL 2.4.0, started with --no-userinit. The same happens in the terminal without Slime etc, in which case the *features* are:

(:ARENA-ALLOCATOR :X86-64 :GENCGC :64-BIT :ANSI-CL :COMMON-LISP :ELF
 :IEEE-FLOATING-POINT :LINUX :LITTLE-ENDIAN :PACKAGE-LOCAL-NICKNAMES
 :SB-CORE-COMPRESSION :SB-LDB :SB-PACKAGE-LOCKS :SB-THREAD :SB-UNICODE :SBCL
 :UNIX)

Linux aperture 6.5.0-14-generic #14~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Mon Nov 20 18:15:30 UTC 2 x86_64 x86_64 x86_64 GNU/Linux

Thank you

Revision history for this message
Christophe Rhodes (csr21-cantab) wrote :

Thanks for the report. I think I have a fix for this, but we're in the freeze period (and I also need to test it a bit more extensively). Expect a fix to land early next month. (The fix is basically undoing commit 17945c81f96b406d3cbc6bfd73c0090e6ce92c6b, plus adding a lot of test cases :-)

Changed in sbcl:
status: New → Triaged
importance: Undecided → Medium
assignee: nobody → Christophe Rhodes (csr21-cantab)
Changed in sbcl:
status: Triaged → Fix Committed
assignee: Christophe Rhodes (csr21-cantab) → nobody
Changed in sbcl:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.