equal
deleted
inserted
replaced
39 #include "gc/g1/heapRegion.inline.hpp" |
39 #include "gc/g1/heapRegion.inline.hpp" |
40 #include "gc/g1/heapRegionManager.inline.hpp" |
40 #include "gc/g1/heapRegionManager.inline.hpp" |
41 #include "gc/g1/heapRegionRemSet.hpp" |
41 #include "gc/g1/heapRegionRemSet.hpp" |
42 #include "gc/g1/heapRegionSet.inline.hpp" |
42 #include "gc/g1/heapRegionSet.inline.hpp" |
43 #include "gc/g1/suspendibleThreadSet.hpp" |
43 #include "gc/g1/suspendibleThreadSet.hpp" |
|
44 #include "gc/shared/gcId.hpp" |
44 #include "gc/shared/gcTimer.hpp" |
45 #include "gc/shared/gcTimer.hpp" |
45 #include "gc/shared/gcTrace.hpp" |
46 #include "gc/shared/gcTrace.hpp" |
46 #include "gc/shared/gcTraceTime.hpp" |
47 #include "gc/shared/gcTraceTime.hpp" |
47 #include "gc/shared/genOopClosures.inline.hpp" |
48 #include "gc/shared/genOopClosures.inline.hpp" |
48 #include "gc/shared/referencePolicy.hpp" |
49 #include "gc/shared/referencePolicy.hpp" |
518 _terminator(ParallelTaskTerminator((int) _max_worker_id, _task_queues)), |
519 _terminator(ParallelTaskTerminator((int) _max_worker_id, _task_queues)), |
519 |
520 |
520 _has_overflown(false), |
521 _has_overflown(false), |
521 _concurrent(false), |
522 _concurrent(false), |
522 _has_aborted(false), |
523 _has_aborted(false), |
523 _aborted_gc_id(GCId::undefined()), |
|
524 _restart_for_overflow(false), |
524 _restart_for_overflow(false), |
525 _concurrent_marking_in_progress(false), |
525 _concurrent_marking_in_progress(false), |
526 |
526 |
527 // _verbose_level set below |
527 // _verbose_level set below |
528 |
528 |
989 // marking. |
989 // marking. |
990 reset_marking_state(true /* clear_overflow */); |
990 reset_marking_state(true /* clear_overflow */); |
991 force_overflow()->update(); |
991 force_overflow()->update(); |
992 |
992 |
993 if (G1Log::fine()) { |
993 if (G1Log::fine()) { |
994 gclog_or_tty->gclog_stamp(concurrent_gc_id()); |
994 gclog_or_tty->gclog_stamp(); |
995 gclog_or_tty->print_cr("[GC concurrent-mark-reset-for-overflow]"); |
995 gclog_or_tty->print_cr("[GC concurrent-mark-reset-for-overflow]"); |
996 } |
996 } |
997 } |
997 } |
998 } |
998 } |
999 |
999 |
1179 // scan_in_progress() will have been set to true only if there was |
1179 // scan_in_progress() will have been set to true only if there was |
1180 // at least one root region to scan. So, if it's false, we |
1180 // at least one root region to scan. So, if it's false, we |
1181 // should not attempt to do any further work. |
1181 // should not attempt to do any further work. |
1182 if (root_regions()->scan_in_progress()) { |
1182 if (root_regions()->scan_in_progress()) { |
1183 if (G1Log::fine()) { |
1183 if (G1Log::fine()) { |
1184 gclog_or_tty->gclog_stamp(concurrent_gc_id()); |
1184 gclog_or_tty->gclog_stamp(); |
1185 gclog_or_tty->print_cr("[GC concurrent-root-region-scan-start]"); |
1185 gclog_or_tty->print_cr("[GC concurrent-root-region-scan-start]"); |
1186 } |
1186 } |
1187 |
1187 |
1188 _parallel_marking_threads = calc_parallel_marking_threads(); |
1188 _parallel_marking_threads = calc_parallel_marking_threads(); |
1189 assert(parallel_marking_threads() <= max_parallel_marking_threads(), |
1189 assert(parallel_marking_threads() <= max_parallel_marking_threads(), |
1193 CMRootRegionScanTask task(this); |
1193 CMRootRegionScanTask task(this); |
1194 _parallel_workers->set_active_workers(active_workers); |
1194 _parallel_workers->set_active_workers(active_workers); |
1195 _parallel_workers->run_task(&task); |
1195 _parallel_workers->run_task(&task); |
1196 |
1196 |
1197 if (G1Log::fine()) { |
1197 if (G1Log::fine()) { |
1198 gclog_or_tty->gclog_stamp(concurrent_gc_id()); |
1198 gclog_or_tty->gclog_stamp(); |
1199 gclog_or_tty->print_cr("[GC concurrent-root-region-scan-end, %1.7lf secs]", os::elapsedTime() - scan_start); |
1199 gclog_or_tty->print_cr("[GC concurrent-root-region-scan-end, %1.7lf secs]", os::elapsedTime() - scan_start); |
1200 } |
1200 } |
1201 |
1201 |
1202 // It's possible that has_aborted() is true here without actually |
1202 // It's possible that has_aborted() is true here without actually |
1203 // aborting the survivor scan earlier. This is OK as it's |
1203 // aborting the survivor scan earlier. This is OK as it's |
1244 return doit; |
1244 return doit; |
1245 } |
1245 } |
1246 |
1246 |
1247 public: |
1247 public: |
1248 G1CMTraceTime(const char* title, bool doit) |
1248 G1CMTraceTime(const char* title, bool doit) |
1249 : _gc_trace_time(title, doit_and_prepend(doit), false, G1CollectedHeap::heap()->gc_timer_cm(), |
1249 : _gc_trace_time(title, doit_and_prepend(doit), false, G1CollectedHeap::heap()->gc_timer_cm()) { |
1250 G1CollectedHeap::heap()->concurrent_mark()->concurrent_gc_id()) { |
|
1251 } |
1250 } |
1252 }; |
1251 }; |
1253 |
1252 |
1254 void ConcurrentMark::checkpointRootsFinal(bool clear_all_soft_refs) { |
1253 void ConcurrentMark::checkpointRootsFinal(bool clear_all_soft_refs) { |
1255 // world is stopped at this checkpoint |
1254 // world is stopped at this checkpoint |
2390 const ReferenceProcessorStats& stats = |
2389 const ReferenceProcessorStats& stats = |
2391 rp->process_discovered_references(&g1_is_alive, |
2390 rp->process_discovered_references(&g1_is_alive, |
2392 &g1_keep_alive, |
2391 &g1_keep_alive, |
2393 &g1_drain_mark_stack, |
2392 &g1_drain_mark_stack, |
2394 executor, |
2393 executor, |
2395 g1h->gc_timer_cm(), |
2394 g1h->gc_timer_cm()); |
2396 concurrent_gc_id()); |
|
2397 g1h->gc_tracer_cm()->report_gc_reference_stats(stats); |
2395 g1h->gc_tracer_cm()->report_gc_reference_stats(stats); |
2398 |
2396 |
2399 // The do_oop work routines of the keep_alive and drain_marking_stack |
2397 // The do_oop work routines of the keep_alive and drain_marking_stack |
2400 // oop closures will set the has_overflown flag if we overflow the |
2398 // oop closures will set the has_overflown flag if we overflow the |
2401 // global marking stack. |
2399 // global marking stack. |
2987 for (uint i = 0; i < _max_worker_id; ++i) { |
2985 for (uint i = 0; i < _max_worker_id; ++i) { |
2988 _tasks[i]->clear_region_fields(); |
2986 _tasks[i]->clear_region_fields(); |
2989 } |
2987 } |
2990 _first_overflow_barrier_sync.abort(); |
2988 _first_overflow_barrier_sync.abort(); |
2991 _second_overflow_barrier_sync.abort(); |
2989 _second_overflow_barrier_sync.abort(); |
2992 _aborted_gc_id = _g1h->gc_tracer_cm()->gc_id(); |
|
2993 assert(!_aborted_gc_id.is_undefined(), "ConcurrentMark::abort() executed more than once?"); |
|
2994 _has_aborted = true; |
2990 _has_aborted = true; |
2995 |
2991 |
2996 SATBMarkQueueSet& satb_mq_set = JavaThread::satb_mark_queue_set(); |
2992 SATBMarkQueueSet& satb_mq_set = JavaThread::satb_mark_queue_set(); |
2997 satb_mq_set.abandon_partial_marking(); |
2993 satb_mq_set.abandon_partial_marking(); |
2998 // This can be called either during or outside marking, we'll read |
2994 // This can be called either during or outside marking, we'll read |
3001 false, /* new active value */ |
2997 false, /* new active value */ |
3002 satb_mq_set.is_active() /* expected_active */); |
2998 satb_mq_set.is_active() /* expected_active */); |
3003 |
2999 |
3004 _g1h->trace_heap_after_concurrent_cycle(); |
3000 _g1h->trace_heap_after_concurrent_cycle(); |
3005 _g1h->register_concurrent_cycle_end(); |
3001 _g1h->register_concurrent_cycle_end(); |
3006 } |
|
3007 |
|
3008 const GCId& ConcurrentMark::concurrent_gc_id() { |
|
3009 if (has_aborted()) { |
|
3010 return _aborted_gc_id; |
|
3011 } |
|
3012 return _g1h->gc_tracer_cm()->gc_id(); |
|
3013 } |
3002 } |
3014 |
3003 |
3015 static void print_ms_time_info(const char* prefix, const char* name, |
3004 static void print_ms_time_info(const char* prefix, const char* name, |
3016 NumberSeq& ns) { |
3005 NumberSeq& ns) { |
3017 gclog_or_tty->print_cr("%s%5d %12s: total time = %8.2f s (avg = %8.2f ms).", |
3006 gclog_or_tty->print_cr("%s%5d %12s: total time = %8.2f s (avg = %8.2f ms).", |