mirror of
https://github.com/openjdk/jdk.git
synced 2026-03-23 22:29:55 +00:00
8080840: Clean up active_workers() asserts
Reviewed-by: kbarrett, jmasa
This commit is contained in:
parent
5d81ec2082
commit
21bb8edbba
@ -5072,14 +5072,9 @@ void CMSCollector::do_remark_parallel() {
|
||||
FlexibleWorkGang* workers = gch->workers();
|
||||
assert(workers != NULL, "Need parallel worker threads.");
|
||||
// Choose to use the number of GC workers most recently set
|
||||
// into "active_workers". If active_workers is not set, set it
|
||||
// to ParallelGCThreads.
|
||||
// into "active_workers".
|
||||
uint n_workers = workers->active_workers();
|
||||
if (n_workers == 0) {
|
||||
assert(n_workers > 0, "Should have been set during scavenge");
|
||||
n_workers = ParallelGCThreads;
|
||||
workers->set_active_workers(n_workers);
|
||||
}
|
||||
|
||||
CompactibleFreeListSpace* cms_space = _cmsGen->cmsSpace();
|
||||
|
||||
StrongRootsScope srs(n_workers);
|
||||
|
||||
@ -1218,15 +1218,13 @@ void ConcurrentMark::markFromRoots() {
|
||||
"Maximum number of marking threads exceeded");
|
||||
|
||||
uint active_workers = MAX2(1U, parallel_marking_threads());
|
||||
assert(active_workers > 0, "Should have been set");
|
||||
|
||||
// Parallel task terminator is set in "set_concurrency_and_phase()"
|
||||
set_concurrency_and_phase(active_workers, true /* concurrent */);
|
||||
|
||||
CMConcurrentMarkingTask markingTask(this, cmThread());
|
||||
_parallel_workers->set_active_workers(active_workers);
|
||||
// Don't set _n_par_threads because it affects MT in process_roots()
|
||||
// and the decisions on that MT processing is made elsewhere.
|
||||
assert(_parallel_workers->active_workers() > 0, "Should have been set");
|
||||
_parallel_workers->run_task(&markingTask);
|
||||
print_stats();
|
||||
}
|
||||
@ -2593,11 +2591,6 @@ void ConcurrentMark::checkpointRootsFinalWork() {
|
||||
|
||||
// this is remark, so we'll use up all active threads
|
||||
uint active_workers = g1h->workers()->active_workers();
|
||||
if (active_workers == 0) {
|
||||
assert(active_workers > 0, "Should have been set earlier");
|
||||
active_workers = (uint) ParallelGCThreads;
|
||||
g1h->workers()->set_active_workers(active_workers);
|
||||
}
|
||||
set_concurrency_and_phase(active_workers, false /* concurrent */);
|
||||
// Leave _parallel_marking_threads at it's
|
||||
// value originally calculated in the ConcurrentMark
|
||||
|
||||
@ -1326,15 +1326,9 @@ bool G1CollectedHeap::do_collection(bool explicit_gc,
|
||||
AdaptiveSizePolicy::calc_active_workers(workers()->total_workers(),
|
||||
workers()->active_workers(),
|
||||
Threads::number_of_non_daemon_threads());
|
||||
assert(UseDynamicNumberOfGCThreads ||
|
||||
n_workers == workers()->total_workers(),
|
||||
"If not dynamic should be using all the workers");
|
||||
workers()->set_active_workers(n_workers);
|
||||
|
||||
ParRebuildRSTask rebuild_rs_task(this);
|
||||
assert(UseDynamicNumberOfGCThreads ||
|
||||
workers()->active_workers() == workers()->total_workers(),
|
||||
"Unless dynamic should use total workers");
|
||||
workers()->run_task(&rebuild_rs_task);
|
||||
|
||||
// Rebuild the strong code root lists for each region
|
||||
@ -2530,9 +2524,6 @@ HeapRegion* G1CollectedHeap::start_cset_region_for_worker(uint worker_i) {
|
||||
result = g1_policy()->collection_set();
|
||||
uint cs_size = g1_policy()->cset_region_length();
|
||||
uint active_workers = workers()->active_workers();
|
||||
assert(UseDynamicNumberOfGCThreads ||
|
||||
active_workers == workers()->total_workers(),
|
||||
"Unless dynamic should use total workers");
|
||||
|
||||
uint end_ind = (cs_size * worker_i) / active_workers;
|
||||
uint start_ind = 0;
|
||||
@ -3031,9 +3022,6 @@ void G1CollectedHeap::verify(bool silent, VerifyOption vo) {
|
||||
if (GCParallelVerificationEnabled && ParallelGCThreads > 1) {
|
||||
|
||||
G1ParVerifyTask task(this, vo);
|
||||
assert(UseDynamicNumberOfGCThreads ||
|
||||
workers()->active_workers() == workers()->total_workers(),
|
||||
"If not dynamic should be using all the workers");
|
||||
workers()->run_task(&task);
|
||||
if (task.failures()) {
|
||||
failures = true;
|
||||
@ -3682,9 +3670,6 @@ G1CollectedHeap::do_collection_pause_at_safepoint(double target_pause_time_ms) {
|
||||
uint active_workers = AdaptiveSizePolicy::calc_active_workers(workers()->total_workers(),
|
||||
workers()->active_workers(),
|
||||
Threads::number_of_non_daemon_threads());
|
||||
assert(UseDynamicNumberOfGCThreads ||
|
||||
active_workers == workers()->total_workers(),
|
||||
"If not dynamic should be using all the workers");
|
||||
workers()->set_active_workers(active_workers);
|
||||
|
||||
double pause_start_sec = os::elapsedTime();
|
||||
@ -5189,7 +5174,7 @@ public:
|
||||
};
|
||||
|
||||
// Weak Reference processing during an evacuation pause (part 1).
|
||||
void G1CollectedHeap::process_discovered_references(uint no_of_gc_workers) {
|
||||
void G1CollectedHeap::process_discovered_references() {
|
||||
double ref_proc_start = os::elapsedTime();
|
||||
|
||||
ReferenceProcessor* rp = _ref_processor_stw;
|
||||
@ -5216,7 +5201,7 @@ void G1CollectedHeap::process_discovered_references(uint no_of_gc_workers) {
|
||||
// referents points to another object which is also referenced by an
|
||||
// object discovered by the STW ref processor.
|
||||
|
||||
assert(no_of_gc_workers == workers()->active_workers(), "Need to reset active GC workers");
|
||||
uint no_of_gc_workers = workers()->active_workers();
|
||||
|
||||
G1ParPreserveCMReferentsTask keep_cm_referents(this,
|
||||
no_of_gc_workers,
|
||||
@ -5297,7 +5282,7 @@ void G1CollectedHeap::process_discovered_references(uint no_of_gc_workers) {
|
||||
}
|
||||
|
||||
// Weak Reference processing during an evacuation pause (part 2).
|
||||
void G1CollectedHeap::enqueue_discovered_references(uint no_of_gc_workers) {
|
||||
void G1CollectedHeap::enqueue_discovered_references() {
|
||||
double ref_enq_start = os::elapsedTime();
|
||||
|
||||
ReferenceProcessor* rp = _ref_processor_stw;
|
||||
@ -5311,12 +5296,12 @@ void G1CollectedHeap::enqueue_discovered_references(uint no_of_gc_workers) {
|
||||
} else {
|
||||
// Parallel reference enqueueing
|
||||
|
||||
assert(no_of_gc_workers == workers()->active_workers(),
|
||||
"Need to reset active workers");
|
||||
assert(rp->num_q() == no_of_gc_workers, "sanity");
|
||||
assert(no_of_gc_workers <= rp->max_num_q(), "sanity");
|
||||
uint n_workers = workers()->active_workers();
|
||||
|
||||
G1STWRefProcTaskExecutor par_task_executor(this, workers(), _task_queues, no_of_gc_workers);
|
||||
assert(rp->num_q() == n_workers, "sanity");
|
||||
assert(n_workers <= rp->max_num_q(), "sanity");
|
||||
|
||||
G1STWRefProcTaskExecutor par_task_executor(this, workers(), _task_queues, n_workers);
|
||||
rp->enqueue_discovered_references(&par_task_executor);
|
||||
}
|
||||
|
||||
@ -5347,9 +5332,6 @@ void G1CollectedHeap::evacuate_collection_set(EvacuationInfo& evacuation_info) {
|
||||
hot_card_cache->set_use_cache(false);
|
||||
|
||||
const uint n_workers = workers()->active_workers();
|
||||
assert(UseDynamicNumberOfGCThreads ||
|
||||
n_workers == workers()->total_workers(),
|
||||
"If not dynamic should be using all the workers");
|
||||
|
||||
init_for_evac_failure(NULL);
|
||||
|
||||
@ -5365,12 +5347,9 @@ void G1CollectedHeap::evacuate_collection_set(EvacuationInfo& evacuation_info) {
|
||||
ClassLoaderDataGraph::clear_claimed_marks();
|
||||
}
|
||||
|
||||
// The individual threads will set their evac-failure closures.
|
||||
if (PrintTerminationStats) G1ParScanThreadState::print_termination_stats_hdr();
|
||||
// These tasks use ShareHeap::_process_strong_tasks
|
||||
assert(UseDynamicNumberOfGCThreads ||
|
||||
workers()->active_workers() == workers()->total_workers(),
|
||||
"If not dynamic should be using all the workers");
|
||||
// The individual threads will set their evac-failure closures.
|
||||
if (PrintTerminationStats) G1ParScanThreadState::print_termination_stats_hdr();
|
||||
|
||||
workers()->run_task(&g1_par_task);
|
||||
end_par_time_sec = os::elapsedTime();
|
||||
|
||||
@ -5395,7 +5374,7 @@ void G1CollectedHeap::evacuate_collection_set(EvacuationInfo& evacuation_info) {
|
||||
// as we may have to copy some 'reachable' referent
|
||||
// objects (and their reachable sub-graphs) that were
|
||||
// not copied during the pause.
|
||||
process_discovered_references(n_workers);
|
||||
process_discovered_references();
|
||||
|
||||
if (G1StringDedup::is_enabled()) {
|
||||
double fixup_start = os::elapsedTime();
|
||||
@ -5437,7 +5416,7 @@ void G1CollectedHeap::evacuate_collection_set(EvacuationInfo& evacuation_info) {
|
||||
// will log these updates (and dirty their associated
|
||||
// cards). We need these updates logged to update any
|
||||
// RSets.
|
||||
enqueue_discovered_references(n_workers);
|
||||
enqueue_discovered_references();
|
||||
|
||||
redirty_logged_cards();
|
||||
COMPILER2_PRESENT(DerivedPointerTable::update_pointers());
|
||||
|
||||
@ -606,11 +606,11 @@ protected:
|
||||
|
||||
// Process any reference objects discovered during
|
||||
// an incremental evacuation pause.
|
||||
void process_discovered_references(uint no_of_gc_workers);
|
||||
void process_discovered_references();
|
||||
|
||||
// Enqueue any remaining discovered references
|
||||
// after processing.
|
||||
void enqueue_discovered_references(uint no_of_gc_workers);
|
||||
void enqueue_discovered_references();
|
||||
|
||||
public:
|
||||
FlexibleWorkGang* workers() const { return _workers; }
|
||||
|
||||
@ -322,7 +322,13 @@ class FlexibleWorkGang: public WorkGang {
|
||||
_active_workers(UseDynamicNumberOfGCThreads ? 1U : workers) {}
|
||||
|
||||
// Accessors for fields.
|
||||
virtual uint active_workers() const { return _active_workers; }
|
||||
virtual uint active_workers() const {
|
||||
assert(_active_workers <= _total_workers,
|
||||
err_msg("_active_workers: %u > _total_workers: %u", _active_workers, _total_workers));
|
||||
assert(UseDynamicNumberOfGCThreads || _active_workers == _total_workers,
|
||||
"Unless dynamic should use total workers");
|
||||
return _active_workers;
|
||||
}
|
||||
void set_active_workers(uint v) {
|
||||
assert(v <= _total_workers,
|
||||
"Trying to set more workers active than there are");
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user