< prev index next >

test/hotspot/gtest/runtime/test_objectMonitor.cpp

Print this page
@@ -25,22 +25,22 @@
  #include "runtime/objectMonitor.hpp"
  #include "runtime/vm_version.hpp"
  #include "unittest.hpp"
  
  TEST_VM(ObjectMonitor, sanity) {
-  uint cache_line_size = VM_Version::L1_data_cache_line_size();
+   uint cache_line_size = VM_Version::L1_data_cache_line_size();
  
-  if (cache_line_size != 0) {
-    // We were able to determine the L1 data cache line size so
-    // do some cache line specific sanity checks
-    EXPECT_EQ((size_t) 0, sizeof (PaddedEnd<ObjectMonitor>) % cache_line_size)
-         << "PaddedEnd<ObjectMonitor> size is not a "
-         << "multiple of a cache line which permits false sharing. "
-         << "sizeof(PaddedEnd<ObjectMonitor>) = "
-         << sizeof (PaddedEnd<ObjectMonitor>)
-         << "; cache_line_size = " << cache_line_size;
+   if (cache_line_size != 0) {
  
-    EXPECT_GE((size_t) in_bytes(ObjectMonitor::owner_offset()), cache_line_size)
-         << "the _header and _owner fields are closer "
-         << "than a cache line which permits false sharing.";
+     EXPECT_EQ(in_bytes(ObjectMonitor::metadata_offset()), 0)
+          << "_metadata at a non 0 offset. metadata_offset = "
+          << in_bytes(ObjectMonitor::metadata_offset());
+ 
+     EXPECT_GE((size_t) in_bytes(ObjectMonitor::owner_offset()), cache_line_size)
+          << "the _metadata and _owner fields are closer "
+          << "than a cache line which permits false sharing.";
+ 
+     EXPECT_GE((size_t) in_bytes(ObjectMonitor::recursions_offset() - ObjectMonitor::owner_offset()), cache_line_size)
+          << "the _owner and _recursions fields are closer "
+          << "than a cache line which permits false sharing.";
    }
  }
< prev index next >