2151 virtual bool doHeapRegion(HeapRegion* hr) { 2152 unsigned region_gc_time_stamp = hr->get_gc_time_stamp(); 2153 if (_gc_time_stamp != region_gc_time_stamp) { 2154 gclog_or_tty->print_cr("Region "HR_FORMAT" has GC time stamp = %d, " 2155 "expected %d", HR_FORMAT_PARAMS(hr), 2156 region_gc_time_stamp, _gc_time_stamp); 2157 _failures = true; 2158 } 2159 return false; 2160 } 2161 2162 bool failures() { return _failures; } 2163 }; 2164 2165 void G1CollectedHeap::check_gc_time_stamps() { 2166 CheckGCTimeStampsHRClosure cl(_gc_time_stamp); 2167 heap_region_iterate(&cl); 2168 guarantee(!cl.failures(), "all GC time stamps should have been reset"); 2169 } 2170 2171 bool G1CollectedHeap::heap_lock_held_for_gc() { 2172 Thread* t = Thread::current(); 2173 return Heap_lock->owned_by_self() 2174 || ( (t->is_GC_task_thread() || t->is_VM_thread()) 2175 && _thread_holds_heap_lock_for_gc); 2176 } 2177 2178 #endif // PRODUCT 2179 2180 void G1CollectedHeap::iterate_dirty_card_closure(CardTableEntryClosure* cl, 2181 DirtyCardQueue* into_cset_dcq, 2182 bool concurrent, 2183 uint worker_i) { 2184 // Clean cards in the hot card cache 2185 G1HotCardCache* hot_card_cache = _cg1r->hot_card_cache(); 2186 hot_card_cache->drain(worker_i, g1_rem_set(), into_cset_dcq); 2187 2188 DirtyCardQueueSet& dcqs = JavaThread::dirty_card_queue_set(); 2189 size_t n_completed_buffers = 0; 2190 while (dcqs.apply_closure_to_completed_buffer(cl, worker_i, 0, true)) { | 2151 virtual bool doHeapRegion(HeapRegion* hr) { 2152 unsigned region_gc_time_stamp = hr->get_gc_time_stamp(); 2153 if (_gc_time_stamp != region_gc_time_stamp) { 2154 gclog_or_tty->print_cr("Region "HR_FORMAT" has GC time stamp = %d, " 2155 "expected %d", HR_FORMAT_PARAMS(hr), 2156 region_gc_time_stamp, _gc_time_stamp); 2157 _failures = true; 2158 } 2159 return false; 2160 } 2161 2162 bool failures() { return _failures; } 2163 }; 2164 2165 void G1CollectedHeap::check_gc_time_stamps() { 2166 CheckGCTimeStampsHRClosure cl(_gc_time_stamp); 2167 heap_region_iterate(&cl); 2168 guarantee(!cl.failures(), "all GC time stamps should have been reset"); 2169 } 2170 2171 void G1CollectedHeap::set_heap_lock_held_for_gc(bool value) { 2172 _thread_holds_heap_lock_for_gc = value; 2173 } 2174 2175 bool G1CollectedHeap::heap_lock_held_for_gc() { 2176 Thread* t = Thread::current(); 2177 return Heap_lock->owned_by_self() 2178 || ( (t->is_GC_task_thread() || t->is_VM_thread()) 2179 && _thread_holds_heap_lock_for_gc); 2180 } 2181 2182 #endif // PRODUCT 2183 2184 void G1CollectedHeap::iterate_dirty_card_closure(CardTableEntryClosure* cl, 2185 DirtyCardQueue* into_cset_dcq, 2186 bool concurrent, 2187 uint worker_i) { 2188 // Clean cards in the hot card cache 2189 G1HotCardCache* hot_card_cache = _cg1r->hot_card_cache(); 2190 hot_card_cache->drain(worker_i, g1_rem_set(), into_cset_dcq); 2191 2192 DirtyCardQueueSet& dcqs = JavaThread::dirty_card_queue_set(); 2193 size_t n_completed_buffers = 0; 2194 while (dcqs.apply_closure_to_completed_buffer(cl, worker_i, 0, true)) { |