Re: I need an unused bit in the bidirectionnal layout object

Chris Pickett <[email protected]> Thu, 03 Mar 2005 13:34:36 -0500
Newsgroups gmane.comp.java.vm.sablevm.devel
Message-ID <[email protected]>
Chris Pickett wrote:
> Sébastien Adam wrote:
> 
>> Hi,
>>
>> I write a mark-compact gc for SableVM. In order to mark an object, I
>> use a bit in the header. A problem occurs while a bidirectionnal
>> layout object has no bit unused. Is there a possibility to change the
>> use of some others bits to free a bit.
>>
>> If it is not possible, can I use a bit in the start_offset of the object.
> 
> 
> My old comments in my sandbox (which really should get committed by me 
> before they go stale!) say that the object header where the thin lock 
> resides has a first word that looks like this:
> 
>      bits    31    30-21        20-16         15-0
>            SHAPE THREAD_ID RECURSIVE_COUNT EXTRA_BITS
>      value   ?       ?            ?             ?
> 
> So if you look at system.c and system.h, you might be able to put your 
> info in the extra unused bits at the least significant end of the 
> lockword (this is the first word in the object).  You should use 
> #define'd constants and write utility masking and unmasking functions as 
> is done for the locking algorithm in thread.c to make your design 
> choices somewhat modular.

My apologies.  You're talking about there being no free bits in the 
EXTRA_BITS field.  I understand now.

It is acceptable to reduce the recursive count field size from 5 bits to 
4 bits -- this just means locks can't be reentered as many times before 
expanding -- but this happens rarely in any event.  Just find some bit 
to use, and later you can worry about the most efficient tradeoff to make.

Cheers,
Chris