1

The source code of the hotspot define the obj markword as markOop,in it's Annotation,the markword has the status as follow:

//  32 bits:  
//  --------
//             hash:25 ------------>| age:4    biased_lock:1 lock:2 (normal object)
//             JavaThread*:23 epoch:2 age:4    biased_lock:1 lock:2 (biased object)
//             size:32 ------------------------------------------>| (CMS free block)
//             PromotedObject*:29 ---------->| promo_bits:3 ----->| (CMS promoted object)
//
//  64 bits:
//  --------  
//  unused:25 hash:31 -->| unused:1   age:4    biased_lock:1 lock:2 (normal object)
//  JavaThread*:54 epoch:2 unused:1   age:4    biased_lock:1 lock:2 (biased object)
//  PromotedObject*:61 --------------------->| promo_bits:3 ----->| (CMS promoted object)
//  size:64 ----------------------------------------------------->| (CMS free block)
//
//  --------  
//  unused:25 hash:31 -->| cms_free:1 age:4    biased_lock:1 lock:2 (COOPs && normal object)
//  JavaThread*:54 epoch:2 cms_free:1 age:4    biased_lock:1 lock:2 (COOPs && biased object)
//  narrowOop:32 unused:24 cms_free:1 unused:4 promo_bits:3 ----->| (COOPs && CMS promoted object)
//  unused:21 size:35 -->| cms_free:1 unused:7 ------------------>| (COOPs && CMS free block)

it say that when the lock Promoted,the markOop is contain of (61 bits of the PromotedObject ptr,and 3 bits of the promo_bits). but i find the diff statement in openJdk wiki:https://wiki.openjdk.java.net/display/HotSpot/Synchronization in this wiki ,it say that when the lock promoted,the markOop is contain of (62 bits of the PromotedObject and 2 bit of lock status). I don't know what is correct. my question is: if the sourceCode Annotation is correct, What is the use of 3 promo_bits in the java obj header

Wiggin
  • 11
  • 1

0 Answers0