< prev index next >

src/share/vm/gc/g1/concurrentMark.cpp

Print this page




 419             CardTableModRefBS::card_shift,
 420             false /* in_resource_area*/),
 421 
 422   _prevMarkBitMap(&_markBitMap1),
 423   _nextMarkBitMap(&_markBitMap2),
 424 
 425   _markStack(this),
 426   // _finger set in set_non_marking_state
 427 
 428   _max_worker_id(ParallelGCThreads),
 429   // _active_tasks set in set_non_marking_state
 430   // _tasks set inside the constructor
 431   _task_queues(new CMTaskQueueSet((int) _max_worker_id)),
 432   _terminator(ParallelTaskTerminator((int) _max_worker_id, _task_queues)),
 433 
 434   _has_overflown(false),
 435   _concurrent(false),
 436   _has_aborted(false),
 437   _restart_for_overflow(false),
 438   _concurrent_marking_in_progress(false),

 439 
 440   // _verbose_level set below
 441 
 442   _init_times(),
 443   _remark_times(), _remark_mark_times(), _remark_weak_ref_times(),
 444   _cleanup_times(),
 445   _total_counting_time(0.0),
 446   _total_rs_scrub_time(0.0),
 447 
 448   _parallel_workers(NULL),
 449 
 450   _count_card_bitmaps(NULL),
 451   _count_marked_bytes(NULL),
 452   _completed_initialization(false) {
 453 
 454   _markBitMap1.initialize(g1h->reserved_region(), prev_bitmap_storage);
 455   _markBitMap2.initialize(g1h->reserved_region(), next_bitmap_storage);
 456 
 457   // Create & start a ConcurrentMark thread.
 458   _cmThread = new ConcurrentMarkThread(this);


 986   // should not attempt to do any further work.
 987   if (root_regions()->scan_in_progress()) {
 988     GCTraceConcTime(Info, gc) tt("Concurrent Root Region Scan");
 989 
 990     _parallel_marking_threads = calc_parallel_marking_threads();
 991     assert(parallel_marking_threads() <= max_parallel_marking_threads(),
 992            "Maximum number of marking threads exceeded");
 993     uint active_workers = MAX2(1U, parallel_marking_threads());
 994 
 995     CMRootRegionScanTask task(this);
 996     _parallel_workers->set_active_workers(active_workers);
 997     _parallel_workers->run_task(&task);
 998 
 999     // It's possible that has_aborted() is true here without actually
1000     // aborting the survivor scan earlier. This is OK as it's
1001     // mainly used for sanity checking.
1002     root_regions()->scan_finished();
1003   }
1004 }
1005 












1006 void ConcurrentMark::markFromRoots() {
1007   // we might be tempted to assert that:
1008   // assert(asynch == !SafepointSynchronize::is_at_safepoint(),
1009   //        "inconsistent argument?");
1010   // However that wouldn't be right, because it's possible that
1011   // a safepoint is indeed in progress as a younger generation
1012   // stop-the-world GC happens even as we mark in this generation.
1013 


1014   _restart_for_overflow = false;
1015 
1016   // _g1h has _n_par_threads
1017   _parallel_marking_threads = calc_parallel_marking_threads();
1018   assert(parallel_marking_threads() <= max_parallel_marking_threads(),
1019     "Maximum number of marking threads exceeded");
1020 
1021   uint active_workers = MAX2(1U, parallel_marking_threads());
1022   assert(active_workers > 0, "Should have been set");
1023 
1024   // Parallel task terminator is set in "set_concurrency_and_phase()"
1025   set_concurrency_and_phase(active_workers, true /* concurrent */);
1026 
1027   CMConcurrentMarkingTask markingTask(this, cmThread());
1028   _parallel_workers->set_active_workers(active_workers);
1029   _parallel_workers->run_task(&markingTask);



1030   print_stats();
1031 }
1032 
1033 void ConcurrentMark::checkpointRootsFinal(bool clear_all_soft_refs) {
1034   // world is stopped at this checkpoint
1035   assert(SafepointSynchronize::is_at_safepoint(),
1036          "world should be stopped");
1037 
1038   G1CollectedHeap* g1h = G1CollectedHeap::heap();
1039 
1040   // If a full collection has happened, we shouldn't do this.
1041   if (has_aborted()) {
1042     g1h->collector_state()->set_mark_in_progress(false); // So bitmap clearing isn't confused
1043     return;
1044   }
1045 
1046   SvcGCMarker sgcm(SvcGCMarker::OTHER);
1047 
1048   if (VerifyDuringGC) {
1049     HandleMark hm;  // handle scope




 419             CardTableModRefBS::card_shift,
 420             false /* in_resource_area*/),
 421 
 422   _prevMarkBitMap(&_markBitMap1),
 423   _nextMarkBitMap(&_markBitMap2),
 424 
 425   _markStack(this),
 426   // _finger set in set_non_marking_state
 427 
 428   _max_worker_id(ParallelGCThreads),
 429   // _active_tasks set in set_non_marking_state
 430   // _tasks set inside the constructor
 431   _task_queues(new CMTaskQueueSet((int) _max_worker_id)),
 432   _terminator(ParallelTaskTerminator((int) _max_worker_id, _task_queues)),
 433 
 434   _has_overflown(false),
 435   _concurrent(false),
 436   _has_aborted(false),
 437   _restart_for_overflow(false),
 438   _concurrent_marking_in_progress(false),
 439   _concurrent_marking_from_roots(false),
 440 
 441   // _verbose_level set below
 442 
 443   _init_times(),
 444   _remark_times(), _remark_mark_times(), _remark_weak_ref_times(),
 445   _cleanup_times(),
 446   _total_counting_time(0.0),
 447   _total_rs_scrub_time(0.0),
 448 
 449   _parallel_workers(NULL),
 450 
 451   _count_card_bitmaps(NULL),
 452   _count_marked_bytes(NULL),
 453   _completed_initialization(false) {
 454 
 455   _markBitMap1.initialize(g1h->reserved_region(), prev_bitmap_storage);
 456   _markBitMap2.initialize(g1h->reserved_region(), next_bitmap_storage);
 457 
 458   // Create & start a ConcurrentMark thread.
 459   _cmThread = new ConcurrentMarkThread(this);


 987   // should not attempt to do any further work.
 988   if (root_regions()->scan_in_progress()) {
 989     GCTraceConcTime(Info, gc) tt("Concurrent Root Region Scan");
 990 
 991     _parallel_marking_threads = calc_parallel_marking_threads();
 992     assert(parallel_marking_threads() <= max_parallel_marking_threads(),
 993            "Maximum number of marking threads exceeded");
 994     uint active_workers = MAX2(1U, parallel_marking_threads());
 995 
 996     CMRootRegionScanTask task(this);
 997     _parallel_workers->set_active_workers(active_workers);
 998     _parallel_workers->run_task(&task);
 999 
1000     // It's possible that has_aborted() is true here without actually
1001     // aborting the survivor scan earlier. This is OK as it's
1002     // mainly used for sanity checking.
1003     root_regions()->scan_finished();
1004   }
1005 }
1006 
1007 void ConcurrentMark::register_mark_from_roots_phase_start() {
1008   _concurrent_marking_from_roots = true;
1009   _g1h->gc_timer_cm()->register_gc_concurrent_start("Concurrent Mark");
1010 }
1011 
1012 void ConcurrentMark::register_mark_from_roots_phase_end() {
1013   _concurrent_marking_from_roots = false;
1014   if (!has_aborted()) {
1015     _g1h->gc_timer_cm()->register_gc_concurrent_end();
1016   }
1017 }
1018 
1019 void ConcurrentMark::markFromRoots() {
1020   // we might be tempted to assert that:
1021   // assert(asynch == !SafepointSynchronize::is_at_safepoint(),
1022   //        "inconsistent argument?");
1023   // However that wouldn't be right, because it's possible that
1024   // a safepoint is indeed in progress as a younger generation
1025   // stop-the-world GC happens even as we mark in this generation.
1026 
1027   register_mark_from_roots_phase_start();
1028 
1029   _restart_for_overflow = false;
1030 
1031   // _g1h has _n_par_threads
1032   _parallel_marking_threads = calc_parallel_marking_threads();
1033   assert(parallel_marking_threads() <= max_parallel_marking_threads(),
1034     "Maximum number of marking threads exceeded");
1035 
1036   uint active_workers = MAX2(1U, parallel_marking_threads());
1037   assert(active_workers > 0, "Should have been set");
1038 
1039   // Parallel task terminator is set in "set_concurrency_and_phase()"
1040   set_concurrency_and_phase(active_workers, true /* concurrent */);
1041 
1042   CMConcurrentMarkingTask markingTask(this, cmThread());
1043   _parallel_workers->set_active_workers(active_workers);
1044   _parallel_workers->run_task(&markingTask);
1045 
1046   register_mark_from_roots_phase_end();
1047 
1048   print_stats();
1049 }
1050 
1051 void ConcurrentMark::checkpointRootsFinal(bool clear_all_soft_refs) {
1052   // world is stopped at this checkpoint
1053   assert(SafepointSynchronize::is_at_safepoint(),
1054          "world should be stopped");
1055 
1056   G1CollectedHeap* g1h = G1CollectedHeap::heap();
1057 
1058   // If a full collection has happened, we shouldn't do this.
1059   if (has_aborted()) {
1060     g1h->collector_state()->set_mark_in_progress(false); // So bitmap clearing isn't confused
1061     return;
1062   }
1063 
1064   SvcGCMarker sgcm(SvcGCMarker::OTHER);
1065 
1066   if (VerifyDuringGC) {
1067     HandleMark hm;  // handle scope


< prev index next >