equal
deleted
inserted
replaced
887 } |
887 } |
888 |
888 |
889 // Visitors ... |
889 // Visitors ... |
890 |
890 |
891 void ObjectSynchronizer::monitors_iterate(MonitorClosure* closure) { |
891 void ObjectSynchronizer::monitors_iterate(MonitorClosure* closure) { |
892 PaddedObjectMonitor* block = OrderAccess::load_acquire(&g_block_list); |
892 PaddedObjectMonitor* block = Atomic::load_acquire(&g_block_list); |
893 while (block != NULL) { |
893 while (block != NULL) { |
894 assert(block->object() == CHAINMARKER, "must be a block header"); |
894 assert(block->object() == CHAINMARKER, "must be a block header"); |
895 for (int i = _BLOCKSIZE - 1; i > 0; i--) { |
895 for (int i = _BLOCKSIZE - 1; i > 0; i--) { |
896 ObjectMonitor* mid = (ObjectMonitor *)(block + i); |
896 ObjectMonitor* mid = (ObjectMonitor *)(block + i); |
897 oop object = (oop)mid->object(); |
897 oop object = (oop)mid->object(); |
1116 // The very first ObjectMonitor in a block is reserved and dedicated. |
1116 // The very first ObjectMonitor in a block is reserved and dedicated. |
1117 // It serves as blocklist "next" linkage. |
1117 // It serves as blocklist "next" linkage. |
1118 temp[0]._next_om = g_block_list; |
1118 temp[0]._next_om = g_block_list; |
1119 // There are lock-free uses of g_block_list so make sure that |
1119 // There are lock-free uses of g_block_list so make sure that |
1120 // the previous stores happen before we update g_block_list. |
1120 // the previous stores happen before we update g_block_list. |
1121 OrderAccess::release_store(&g_block_list, temp); |
1121 Atomic::release_store(&g_block_list, temp); |
1122 |
1122 |
1123 // Add the new string of ObjectMonitors to the global free list |
1123 // Add the new string of ObjectMonitors to the global free list |
1124 temp[_BLOCKSIZE - 1]._next_om = g_free_list; |
1124 temp[_BLOCKSIZE - 1]._next_om = g_free_list; |
1125 g_free_list = temp + 1; |
1125 g_free_list = temp + 1; |
1126 Thread::muxRelease(&gListLock); |
1126 Thread::muxRelease(&gListLock); |
2167 // Check if monitor belongs to the monitor cache |
2167 // Check if monitor belongs to the monitor cache |
2168 // The list is grow-only so it's *relatively* safe to traverse |
2168 // The list is grow-only so it's *relatively* safe to traverse |
2169 // the list of extant blocks without taking a lock. |
2169 // the list of extant blocks without taking a lock. |
2170 |
2170 |
2171 int ObjectSynchronizer::verify_objmon_isinpool(ObjectMonitor *monitor) { |
2171 int ObjectSynchronizer::verify_objmon_isinpool(ObjectMonitor *monitor) { |
2172 PaddedObjectMonitor* block = OrderAccess::load_acquire(&g_block_list); |
2172 PaddedObjectMonitor* block = Atomic::load_acquire(&g_block_list); |
2173 while (block != NULL) { |
2173 while (block != NULL) { |
2174 assert(block->object() == CHAINMARKER, "must be a block header"); |
2174 assert(block->object() == CHAINMARKER, "must be a block header"); |
2175 if (monitor > &block[0] && monitor < &block[_BLOCKSIZE]) { |
2175 if (monitor > &block[0] && monitor < &block[_BLOCKSIZE]) { |
2176 address mon = (address)monitor; |
2176 address mon = (address)monitor; |
2177 address blk = (address)block; |
2177 address blk = (address)block; |