< prev index next >

src/share/vm/runtime/synchronizer.cpp

Print this page
rev 12576 : 8171848: ObjectMonitor verify() and print() methods are empty
Reviewed-by: duke


1862     }
1863 
1864     if ((offset_hcSequence - offset_stwRandom) < cache_line_size) {
1865       tty->print_cr("WARNING: the SharedGlobals.stwRandom and "
1866                     "SharedGlobals.hcSequence fields are closer than a cache "
1867                     "line which permits false sharing.");
1868       (*warning_cnt_ptr)++;
1869     }
1870 
1871     if ((sizeof(SharedGlobals) - offset_hcSequence) < cache_line_size) {
1872       tty->print_cr("WARNING: the SharedGlobals.hcSequence field is closer "
1873                     "to the struct end than a cache line which permits false "
1874                     "sharing.");
1875       (*warning_cnt_ptr)++;
1876     }
1877   }
1878 }
1879 
1880 #ifndef PRODUCT
1881 
1882 // Verify all monitors in the monitor cache, the verification is weak.
1883 void ObjectSynchronizer::verify() {
1884   PaddedEnd<ObjectMonitor> * block =
1885     (PaddedEnd<ObjectMonitor> *)OrderAccess::load_ptr_acquire(&gBlockList);
1886   while (block != NULL) {
1887     assert(block->object() == CHAINMARKER, "must be a block header");
1888     for (int i = 1; i < _BLOCKSIZE; i++) {
1889       ObjectMonitor* mid = (ObjectMonitor *)(block + i);
1890       oop object = (oop)mid->object();
1891       if (object != NULL) {
1892         mid->verify();
1893       }
1894     }
1895     block = (PaddedEnd<ObjectMonitor> *)block->FreeNext;
1896   }
1897 }
1898 
1899 // Check if monitor belongs to the monitor cache
1900 // The list is grow-only so it's *relatively* safe to traverse
1901 // the list of extant blocks without taking a lock.
1902 
1903 int ObjectSynchronizer::verify_objmon_isinpool(ObjectMonitor *monitor) {
1904   PaddedEnd<ObjectMonitor> * block =
1905     (PaddedEnd<ObjectMonitor> *)OrderAccess::load_ptr_acquire(&gBlockList);
1906   while (block != NULL) {
1907     assert(block->object() == CHAINMARKER, "must be a block header");
1908     if (monitor > (ObjectMonitor *)&block[0] &&
1909         monitor < (ObjectMonitor *)&block[_BLOCKSIZE]) {
1910       address mon = (address)monitor;
1911       address blk = (address)block;
1912       size_t diff = mon - blk;
1913       assert((diff % sizeof(PaddedEnd<ObjectMonitor>)) == 0, "must be aligned");
1914       return 1;
1915     }
1916     block = (PaddedEnd<ObjectMonitor> *)block->FreeNext;
1917   }
1918   return 0;


1862     }
1863 
1864     if ((offset_hcSequence - offset_stwRandom) < cache_line_size) {
1865       tty->print_cr("WARNING: the SharedGlobals.stwRandom and "
1866                     "SharedGlobals.hcSequence fields are closer than a cache "
1867                     "line which permits false sharing.");
1868       (*warning_cnt_ptr)++;
1869     }
1870 
1871     if ((sizeof(SharedGlobals) - offset_hcSequence) < cache_line_size) {
1872       tty->print_cr("WARNING: the SharedGlobals.hcSequence field is closer "
1873                     "to the struct end than a cache line which permits false "
1874                     "sharing.");
1875       (*warning_cnt_ptr)++;
1876     }
1877   }
1878 }
1879 
1880 #ifndef PRODUCT
1881 

















1882 // Check if monitor belongs to the monitor cache
1883 // The list is grow-only so it's *relatively* safe to traverse
1884 // the list of extant blocks without taking a lock.
1885 
1886 int ObjectSynchronizer::verify_objmon_isinpool(ObjectMonitor *monitor) {
1887   PaddedEnd<ObjectMonitor> * block =
1888     (PaddedEnd<ObjectMonitor> *)OrderAccess::load_ptr_acquire(&gBlockList);
1889   while (block != NULL) {
1890     assert(block->object() == CHAINMARKER, "must be a block header");
1891     if (monitor > (ObjectMonitor *)&block[0] &&
1892         monitor < (ObjectMonitor *)&block[_BLOCKSIZE]) {
1893       address mon = (address)monitor;
1894       address blk = (address)block;
1895       size_t diff = mon - blk;
1896       assert((diff % sizeof(PaddedEnd<ObjectMonitor>)) == 0, "must be aligned");
1897       return 1;
1898     }
1899     block = (PaddedEnd<ObjectMonitor> *)block->FreeNext;
1900   }
1901   return 0;
< prev index next >