bug found

Henry Cejtin henry@sourcelight.com
Tue, 27 Nov 2001 03:30:40 -0600


I  must  be  missing  something  obvious,  but  in  gc.c, the isStackHeader()
function asserts that the header is not for a normal object, so the  top  bit
must  be 0, and that at least oe of bit 29 or 28 is set.  (This is because it
ands the header word with 0x30000000, which only has bit 29 and 28  set,  and
returns the result.  This is non-zero (i.e., true) iff either bit 29 or 28 is
set.)  From my reading of the object header comments, but 29 must be a 1  for
the object to be a stack.

...

No, I think that the code isStackHeader is just plain broken.  It only showed
up in this example because the last array growth made a char array with  2^28
elements, thus setting bit 28.

...

Yes, the following code dies the same way

    val _ = Array.array(0x10000000, #"x")
    val _ = Array.array(20, "y")

when compiled -g and GC_EVERY_CHECK.

The  current  C  code  is  really  pretty bad.  The `abstractions' of all the
functions buy very little I think and make  it  unreadable.   I  still  don't
know, despite reading gc.c and gc.h, what the actual bit patterns do.

I assume:

    A normal object ia any object with
        bit 31 set to 1.

    An array is indicated by an initial world which has
        bit 31 set to 0
        bit 29 set to 0.

    A stack is any object with
        bit 31 set to 0
        bit 29 set to 1
        bit 28 set to 0.

    A continuation object is any object with
        bit 31 set to 0
        bit 29 set to 1
        bit 28 set to 1.

It isn't clear if isStackHeader is supposed to return false on cont's.

Just  what IS the layout of objects?  Send me mail and I will fix the C code.