I believe you are using reference counting (RC). RC in Jikes RVM don't use any extra word to store the reference count, rather it uses 4 bits from the available byte to store the count. That is why GC_HEADER_WORDS_REQUIRED are set to 0. If you need extra words then you need to update GC_HEADER_WORDS_REQUIRED. After that you can read the words with appropriate offsets. For example,

public static final Offset RC1_HEADER_OFFSET = VM.objectModel.GC_HEADER_OFFSET()  // offset for the first extra word
object.toAddress().prepareWord(RC1_HEADER_OFFSET) // atomically read the word
object.toAddress().loadWord(RC1_HEADER_OFFSET) // non-atomic read
object.toAddress().attempt(oldValue, newValue, RC1_HEADER_OFFSET) // atomically write the word with prepare
object.toAddress().store(value, RC1_HEADER_OFFSET) // non-atomic write

For the next word you need to use the following offset to read/write
public static final Offset RC2_HEADER_OFFSET = RC1_HEADER_OFFSET.plus(BYTES_IN_WORD)  // offset for the next extra word


On 19/11/2013 10:27 pm, Hari Krishnan wrote:

I have a question about MMTK. I want my GC Header to be 4 words size. I see the change in the size of each object allocation that 4 words are allocated for GC Header but I cannot mutate those words. The method prepareavailableword() , readavailableword(), writeavailableword() works only  on one word in GCHeader. How do I read and write this 4 word sized GC Header? 

Hari Krishnan

Shape the Mobile Experience: Free Subscription
Software experts and developers: Be at the forefront of tech innovation.
Intel(R) Software Adrenaline delivers strategic insight and game-changing 
conversations that shape the rapidly evolving mobile landscape. Sign up now. 

Jikesrvm-core mailing list