< prev index next >

src/hotspot/share/memory/universe.cpp

Print this page
rev 64188 : Rework xxx::verify() functions

@@ -146,10 +146,11 @@
 
 OopStorage*     Universe::_vm_weak = NULL;
 OopStorage*     Universe::_vm_global = NULL;
 
 CollectedHeap*  Universe::_collectedHeap = NULL;
+intptr_t        Universe::_non_heap_offset = 0;
 
 objArrayOop Universe::the_empty_class_array ()  {
   return (objArrayOop)_the_empty_class_array.resolve();
 }
 

@@ -851,10 +852,17 @@
       CompressedOops::initialize(total_rs);
     }
 
     Universe::calculate_verify_data((HeapWord*)total_rs.base(), (HeapWord*)total_rs.end());
 
+    // Make sure oop + offset is past the Java heap, plus some random positive offset.
+    // The offset should not hide the real alignment up to object alignment or cache line size.
+    intptr_t non_heap_offset = (intptr_t) total_rs.size() + abs(os::random());
+    non_heap_offset = align_up(non_heap_offset, MinObjAlignmentInBytes);
+    non_heap_offset = align_up(non_heap_offset, VM_Version::L1_data_cache_line_size());
+    Universe::_non_heap_offset = non_heap_offset;
+
     return total_rs;
   }
 
   vm_exit_during_initialization(
     err_msg("Could not reserve enough space for " SIZE_FORMAT "KB object heap",
< prev index next >