comparison src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp @ 23816:6c57a16d0238

8017462: G1: guarantee fails with UseDynamicNumberOfGCThreads Reviewed-by: jmasa, tamao
author dbuck
date Thu, 18 Feb 2016 20:30:45 +0000
parents dae1435f96b7
children f13e777eb255
comparison
equal deleted inserted replaced
23815:240ea32410fa 23816:6c57a16d0238
3989 3989
3990 _gc_tracer_stw->report_yc_type(yc_type()); 3990 _gc_tracer_stw->report_yc_type(yc_type());
3991 3991
3992 TraceCPUTime tcpu(G1Log::finer(), true, gclog_or_tty); 3992 TraceCPUTime tcpu(G1Log::finer(), true, gclog_or_tty);
3993 3993
3994 uint active_workers = (G1CollectedHeap::use_parallel_gc_threads() ? 3994 uint active_workers = AdaptiveSizePolicy::calc_active_workers(workers()->total_workers(),
3995 workers()->active_workers() : 1); 3995 workers()->active_workers(),
3996 Threads::number_of_non_daemon_threads());
3997 assert(UseDynamicNumberOfGCThreads ||
3998 active_workers == workers()->total_workers(),
3999 "If not dynamic should be using all the workers");
4000 workers()->set_active_workers(active_workers);
4001
4002
3996 double pause_start_sec = os::elapsedTime(); 4003 double pause_start_sec = os::elapsedTime();
3997 g1_policy()->phase_times()->note_gc_start(active_workers, mark_in_progress()); 4004 g1_policy()->phase_times()->note_gc_start(active_workers, mark_in_progress());
3998 log_gc_header(); 4005 log_gc_header();
3999 4006
4000 TraceCollectorStats tcs(g1mm()->incremental_collection_counters()); 4007 TraceCollectorStats tcs(g1mm()->incremental_collection_counters());
5759 // Disable the hot card cache. 5766 // Disable the hot card cache.
5760 G1HotCardCache* hot_card_cache = _cg1r->hot_card_cache(); 5767 G1HotCardCache* hot_card_cache = _cg1r->hot_card_cache();
5761 hot_card_cache->reset_hot_cache_claimed_index(); 5768 hot_card_cache->reset_hot_cache_claimed_index();
5762 hot_card_cache->set_use_cache(false); 5769 hot_card_cache->set_use_cache(false);
5763 5770
5764 uint n_workers; 5771 const uint n_workers = workers()->active_workers();
5765 if (G1CollectedHeap::use_parallel_gc_threads()) {
5766 n_workers =
5767 AdaptiveSizePolicy::calc_active_workers(workers()->total_workers(),
5768 workers()->active_workers(),
5769 Threads::number_of_non_daemon_threads());
5770 assert(UseDynamicNumberOfGCThreads || 5772 assert(UseDynamicNumberOfGCThreads ||
5771 n_workers == workers()->total_workers(), 5773 n_workers == workers()->total_workers(),
5772 "If not dynamic should be using all the workers"); 5774 "If not dynamic should be using all the workers");
5773 workers()->set_active_workers(n_workers);
5774 set_par_threads(n_workers); 5775 set_par_threads(n_workers);
5775 } else {
5776 assert(n_par_threads() == 0,
5777 "Should be the original non-parallel value");
5778 n_workers = 1;
5779 }
5780
5781 5776
5782 init_for_evac_failure(NULL); 5777 init_for_evac_failure(NULL);
5783 5778
5784 rem_set()->prepare_for_younger_refs_iterate(true); 5779 rem_set()->prepare_for_younger_refs_iterate(true);
5785 5780