Re: [rvm-research] spare one bit from the object header

Michael Bond <[email protected]> Tue, 29 Sep 2015 13:23:37 -0400
Newsgroups gmane.comp.java.jikes.rvm.devel
Message-ID <[email protected]>
Dear Fellow Bit Stealer,

I believe I've run into the same issue before, but I don't know what's 
the reason for it. Two ideas:

(1) Perhaps the current implementation of thin locks relies on having 
the full 22 bits, and giving it just 21 bits means it still spills over 
into the stolen bit? See ThinLockConstants to try to figure that out? 
(This would imply that !ADDRESS_BASED_HASHING configs doesn't work 
correctly, although it might be hard to tell since hash codes would be 
subtly messed up.)

(2) Perhaps there's some other assumption in the thin locks 
implementation about how many / which bits are available. Have you 
considered trying to steal the high bit instead:

  *      OTTT TTTT TTTT TTTT TTTT TTHH AAAA AAAA

by changing only NUM_THIN_LOCK_BITS but not THIN_LOCK_SHIFT.

However, depending on what you're using the stolen bit for, I think that 
might introduce concurrency issues if the thin locks implementation is 
relying on being able to do non-CAS accesses to the high 16 bits of the 
status word.

An alternative to stealing a thin lock bit is to steal one of the GC bits:

  *      TTTT TTTT TTTT TTTT TTTT TTHH OAAA AAAA

which requires ensuring that GC does not use all 8 bits. I believe the 
default GenImmix uses all 8 by default, but you can tell it to use 7 
instead.

Cheers,
Mike

On 09/29/2015 07:36 AM, 王晨曦 wrote:
> Hi, every one.
>
> 	I want to spare one bit as a flag to mark some particular object from the thin lock bits used in the object header.
> In the production configuration ,the ADDRESS_BASED_HASHING is true.
> so the object header looks like:
>   *      TTTT TTTT TTTT TTTT TTTT TOHH AAAA AAAA
> the bit marked by ‘O’ is the bit  I want to spare.
>
>   I modified the thin lock definitions:
>    /** How many bits are allocated to a thin lock? */
>    public static final int NUM_THIN_LOCK_BITS = ADDRESS_BASED_HASHING ? 21 : 19;
>
>    /** How many bits to shift to get the thin lock? */
>    public static final int THIN_LOCK_SHIFT = ADDRESS_BASED_HASHING ? 11 : 13;
>
>
> But ,In GenNurseryTraceLocal.java traceObject() method.
> I find that ,the spared bit ‘O’  can be set by something I don’t know.
>
> the check code in the traceObject():
>       
>          Word objWordVal = VM.objectModel.readAvailableBitsWord(object);
>          Log.write("object header word value:");
>          Log.writeln(objWordVal);
>          
>        
> and the the print info is :
>    1871 object header word value:0x6e00859f  //  ….   0101  1001  1111
>
>    1876 object header word value:0x6e009dfb  //  ….   1101   1111  1011
>   
> we can see that  the spared bit may be set by something.
> So,my question is who set this spared bit ?
> I checked that the thin lock count bits, it is reduced 1 bit, and I think the thin lock will not use this bit.
>
> Any response is helpful, thank you.
> ------------------------------------------------------------------------------
> _______________________________________________
> Jikesrvm-researchers mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/jikesrvm-researchers


------------------------------------------------------------------------------
_______________________________________________
Jikesrvm-researchers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jikesrvm-researchers