@@ -66,7 +66,6 @@ public class GraalHotSpotVMConfig extends GraalHotSpotVMConfigAccess {
6666 GraalHotSpotVMConfig (HotSpotVMConfigStore store ) {
6767 super (store );
6868
69- assert narrowKlassShift <= logKlassAlignment : Assertions .errorMessageContext ("narrowKlassShift" , narrowKlassShift , "logKlassAlignment" , logKlassAlignment );
7069 int logMinObjAlignment = logMinObjAlignment ();
7170 assert narrowOopShift <= logMinObjAlignment : Assertions .errorMessageContext ("narrowOopShift" , narrowOopShift , "logMinObjAlignment" , logMinObjAlignment );
7271 oopEncoding = new CompressEncoding (narrowOopBase , narrowOopShift );
@@ -201,6 +200,11 @@ public long gcTotalCollectionsAddress() {
201200 // Compressed Oops related values.
202201 public final boolean useCompressedOops = getFlag ("UseCompressedOops" , Boolean .class );
203202 public final boolean useCompressedClassPointers = getFlag ("UseCompressedClassPointers" , Boolean .class );
203+ // JDK-8305895 allows storing the compressed class pointer in the upper 22 bits of the mark
204+ // word. This runtime optimization is guarded by the flag UseCompactObjectHeaders. It depends
205+ // on compressed class pointers, meaning that if useCompactObjectHeaders is true,
206+ // useCompressedClassPointers is certainly true.
207+ public final boolean useCompactObjectHeaders = getFlag ("UseCompactObjectHeaders" , Boolean .class , false , JDK >= 24 );
204208
205209 public final long narrowOopBase = getFieldValue ("CompilerToVM::Data::Universe_narrow_oop_base" , Long .class , "address" );
206210 public final int narrowOopShift = getFieldValue ("CompilerToVM::Data::Universe_narrow_oop_shift" , Integer .class , "int" );
@@ -213,7 +217,6 @@ public final int logMinObjAlignment() {
213217 public final int narrowKlassSize = getFieldValue ("CompilerToVM::Data::sizeof_narrowKlass" , Integer .class , "int" );
214218 public final long narrowKlassBase = getFieldValue ("CompilerToVM::Data::Universe_narrow_klass_base" , Long .class , "address" );
215219 public final int narrowKlassShift = getFieldValue ("CompilerToVM::Data::Universe_narrow_klass_shift" , Integer .class , "int" );
216- public final int logKlassAlignment = getConstant ("LogKlassAlignmentInBytes" , Integer .class );
217220
218221 public final int stackShadowPages = getFlag ("StackShadowPages" , Integer .class );
219222 public final int vmPageSize = getFieldValue ("CompilerToVM::Data::vm_page_size" , Integer .class , "size_t" );
@@ -255,12 +258,17 @@ public final int logMinObjAlignment() {
255258
256259 public final int arrayOopDescSize = getFieldValue ("CompilerToVM::Data::sizeof_arrayOopDesc" , Integer .class , "int" );
257260
261+ public final int arrayLengthOffsetInBytes = getFieldValue ("CompilerToVM::Data::arrayOopDesc_length_offset_in_bytes" , Integer .class , "int" , -1 , JDK >= 24 );
262+
258263 /**
259264 * The offset of the array length word in an array object's header.
260265 * <p>
261266 * See {@code arrayOopDesc::length_offset_in_bytes()}.
262267 */
263268 public final int arrayOopDescLengthOffset () {
269+ if (JDK >= 24 ) {
270+ return arrayLengthOffsetInBytes ;
271+ }
264272 return useCompressedClassPointers ? hubOffset + narrowKlassSize : arrayOopDescSize ;
265273 }
266274
@@ -294,6 +302,8 @@ public final int arrayOopDescLengthOffset() {
294302 public final int threadCarrierThreadObjectOffset = getFieldOffset ("JavaThread::_threadObj" , Integer .class , "OopHandle" );
295303 public final int threadScopedValueCacheOffset = getFieldOffset ("JavaThread::_scopedValueCache" , Integer .class , "OopHandle" );
296304
305+ public final int javaThreadLockIDOffset = getFieldOffset ("JavaThread::_lock_id" , Integer .class , "int64_t" , -1 , JDK > 21 );
306+
297307 public final int threadIsInVTMSTransitionOffset = getFieldOffset ("JavaThread::_is_in_VTMS_transition" , Integer .class , "bool" );
298308 public final int threadIsInTmpVTMSTransitionOffset = getFieldOffset ("JavaThread::_is_in_tmp_VTMS_transition" , Integer .class , "bool" , -1 , JDK == 21 );
299309 public final int threadIsDisableSuspendOffset = getFieldOffset ("JavaThread::_is_disable_suspend" , Integer .class , "bool" , -1 , JDK >= 22 );
@@ -365,37 +375,35 @@ public int threadLastJavaFpOffset() {
365375 public final int frameInterpreterFrameSenderSpOffset = getConstant ("frame::interpreter_frame_sender_sp_offset" , Integer .class , 0 , osArch .equals ("amd64" ));
366376 public final int frameInterpreterFrameLastSpOffset = getConstant ("frame::interpreter_frame_last_sp_offset" , Integer .class , 0 , osArch .equals ("amd64" ));
367377
368- public final int lockMaskInPlace = getConstant ("markWord::lock_mask_in_place" , Integer .class );
378+ public final long markWordLockMaskInPlace = getConstant ("markWord::lock_mask_in_place" , Long .class );
379+ public final long markWordHashMask = getConstant ("markWord::hash_mask" , Long .class );
380+
381+ public final long markWordNoHashInPlace = getConstant ("markWord::no_hash_in_place" , Long .class );
382+ public final long markWordNoLockInPlace = getConstant ("markWord::no_lock_in_place" , Long .class );
383+
384+ // Mark word right shift to get identity hash code.
385+ public final int markWordHashCodeShift = getConstant ("markWord::hash_shift" , Integer .class );
386+ // Mark word right shift to get compressed klass pointer
387+ public final int markWordKlassShift = getConstant ("markWord::klass_shift" , Integer .class , 0 , JDK >= 24 );
388+
389+ // The following three constants are declared as 64 bits uintptr_t, but known to be 32 bits
369390 public final int unlockedValue = getConstant ("markWord::unlocked_value" , Integer .class );
370391 public final int monitorValue = getConstant ("markWord::monitor_value" , Integer .class );
392+ public final int ageMaskInPlace = getConstant ("markWord::age_mask_in_place" , Integer .class );
393+ public final int unusedMark = getConstant ("markWord::marked_value" , Integer .class , 3 , JDK > 21 );
394+ // Identity hash code value when uninitialized.
395+ public final int uninitializedIdentityHashCodeValue = getConstant ("markWord::no_hash" , Integer .class );
371396
372397 // This field has no type in vmStructs.cpp
373- public final int objectMonitorOwner = getFieldOffset ("ObjectMonitor::_owner" , Integer .class , null );
398+ public final int objectMonitorOwner = getFieldOffset ("ObjectMonitor::_owner" , Integer .class , JDK > 21 ? "int64_t" : null );
374399 public final int objectMonitorRecursions = getFieldOffset ("ObjectMonitor::_recursions" , Integer .class , "intptr_t" );
375400 public final int objectMonitorCxq = getFieldOffset ("ObjectMonitor::_cxq" , Integer .class , "ObjectWaiter*" );
376401 public final int objectMonitorEntryList = getFieldOffset ("ObjectMonitor::_EntryList" , Integer .class , "ObjectWaiter*" );
377- public final int objectMonitorSucc = getFieldOffset ("ObjectMonitor::_succ" , Integer .class , "JavaThread*" );
378-
379- public final int markWordNoHashInPlace = getConstant ("markWord::no_hash_in_place" , Integer .class );
380- public final int markWordNoLockInPlace = getConstant ("markWord::no_lock_in_place" , Integer .class );
381-
382- public long defaultPrototypeMarkWord () {
383- return this .markWordNoHashInPlace | this .markWordNoLockInPlace ;
384- }
385-
386- /**
387- * Mark word right shift to get identity hash code.
388- */
389- public final int identityHashCodeShift = getConstant ("markWord::hash_shift" , Integer .class );
402+ public final int objectMonitorSucc = getFieldOffset ("ObjectMonitor::_succ" , Integer .class , JDK > 21 ? "int64_t" : "JavaThread*" );
390403
391404 public final int contEntry = getFieldOffset ("JavaThread::_cont_entry" , Integer .class , "ContinuationEntry*" , -1 , JDK >= 24 );
392405 public final int pinCount = getFieldOffset ("ContinuationEntry::_pin_count" , Integer .class , "uint32_t" , -1 , JDK >= 24 );
393406
394- /**
395- * Identity hash code value when uninitialized.
396- */
397- public final int uninitializedIdentityHashCodeValue = getConstant ("markWord::no_hash" , Integer .class );
398-
399407 public final int methodCompiledEntryOffset = getFieldOffset ("Method::_from_compiled_entry" , Integer .class , "address" );
400408
401409 public final int compilationLevelFullOptimization = getConstant ("CompLevel_full_optimization" , Integer .class );
0 commit comments