< prev index next >
src/share/vm/gc/g1/g1CollectedHeap.cpp
Print this page
*** 1327,1353 ****
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);
- // Set parallel threads in the heap (_n_par_threads) only
- // before a parallel phase and always reset it to 0 after
- // the phase so that the number of parallel threads does
- // no get carried forward to a serial phase where there
- // may be code that is "possibly_parallel".
- set_par_threads(n_workers);
ParRebuildRSTask rebuild_rs_task(this);
assert(UseDynamicNumberOfGCThreads ||
workers()->active_workers() == workers()->total_workers(),
"Unless dynamic should use total workers");
- // Use the most recent number of active workers
- assert(workers()->active_workers() > 0,
- "Active workers not properly set");
- set_par_threads(workers()->active_workers());
workers()->run_task(&rebuild_rs_task);
- set_par_threads(0);
// Rebuild the strong code root lists for each region
rebuild_strong_code_roots();
if (true) { // FIXME
--- 1327,1342 ----
*** 3018,3028 ****
// and the nmethods in the code cache.
G1VerifyCodeRootOopClosure codeRootsCl(this, &rootsCl, vo);
G1VerifyCodeRootBlobClosure blobsCl(&codeRootsCl);
{
! G1RootProcessor root_processor(this);
root_processor.process_all_roots(&rootsCl,
&cldCl,
&blobsCl);
}
--- 3007,3017 ----
// and the nmethods in the code cache.
G1VerifyCodeRootOopClosure codeRootsCl(this, &rootsCl, vo);
G1VerifyCodeRootBlobClosure blobsCl(&codeRootsCl);
{
! G1RootProcessor root_processor(this, 1);
root_processor.process_all_roots(&rootsCl,
&cldCl,
&blobsCl);
}
*** 3042,3055 ****
G1ParVerifyTask task(this, vo);
assert(UseDynamicNumberOfGCThreads ||
workers()->active_workers() == workers()->total_workers(),
"If not dynamic should be using all the workers");
- uint n_workers = workers()->active_workers();
- set_par_threads(n_workers);
workers()->run_task(&task);
- set_par_threads(0);
if (task.failures()) {
failures = true;
}
} else {
--- 3031,3041 ----
*** 4038,4051 ****
}
void G1CollectedHeap::remove_self_forwarding_pointers() {
double remove_self_forwards_start = os::elapsedTime();
- set_par_threads();
G1ParRemoveSelfForwardPtrsTask rsfp_task(this);
workers()->run_task(&rsfp_task);
- set_par_threads(0);
// Now restore saved marks, if any.
assert(_objs_with_preserved_marks.size() ==
_preserved_marks_of_objs.size(), "Both or none.");
while (!_objs_with_preserved_marks.is_empty()) {
--- 4024,4035 ----
*** 4323,4333 ****
}
ParallelTaskTerminator* terminator() { return &_terminator; }
virtual void set_for_termination(uint active_workers) {
- _root_processor->set_num_workers(active_workers);
terminator()->reset_for_reuse(active_workers);
_n_workers = active_workers;
}
// Helps out with CLD processing.
--- 4307,4316 ----
*** 4808,4830 ****
bool class_unloading_occurred) {
uint n_workers = workers()->active_workers();
G1ParallelCleaningTask g1_unlink_task(is_alive, process_strings, process_symbols,
n_workers, class_unloading_occurred);
- set_par_threads(n_workers);
workers()->run_task(&g1_unlink_task);
- set_par_threads(0);
}
void G1CollectedHeap::unlink_string_and_symbol_table(BoolObjectClosure* is_alive,
bool process_strings, bool process_symbols) {
{
- uint n_workers = workers()->active_workers();
G1StringSymbolTableUnlinkTask g1_unlink_task(is_alive, process_strings, process_symbols);
- set_par_threads(n_workers);
workers()->run_task(&g1_unlink_task);
- set_par_threads(0);
}
if (G1StringDedup::is_enabled()) {
G1StringDedup::unlink(is_alive);
}
--- 4791,4808 ----
*** 4848,4864 ****
};
void G1CollectedHeap::redirty_logged_cards() {
double redirty_logged_cards_start = os::elapsedTime();
- uint n_workers = workers()->active_workers();
-
G1RedirtyLoggedCardsTask redirty_task(&dirty_card_queue_set());
dirty_card_queue_set().reset_for_par_iteration();
- set_par_threads(n_workers);
workers()->run_task(&redirty_task);
- set_par_threads(0);
DirtyCardQueueSet& dcq = JavaThread::dirty_card_queue_set();
dcq.merge_bufferlists(&dirty_card_queue_set());
assert(dirty_card_queue_set().completed_buffers_num() == 0, "All should be consumed");
--- 4826,4838 ----
*** 5090,5102 ****
assert(_workers != NULL, "Need parallel worker threads.");
ParallelTaskTerminator terminator(_active_workers, _queues);
G1STWRefProcTaskProxy proc_task_proxy(proc_task, _g1h, _queues, &terminator);
- _g1h->set_par_threads(_active_workers);
_workers->run_task(&proc_task_proxy);
- _g1h->set_par_threads(0);
}
// Gang task for parallel reference enqueueing.
class G1STWRefEnqueueTaskProxy: public AbstractGangTask {
--- 5064,5074 ----
*** 5121,5133 ****
void G1STWRefProcTaskExecutor::execute(EnqueueTask& enq_task) {
assert(_workers != NULL, "Need parallel worker threads.");
G1STWRefEnqueueTaskProxy enq_task_proxy(enq_task);
- _g1h->set_par_threads(_active_workers);
_workers->run_task(&enq_task_proxy);
- _g1h->set_par_threads(0);
}
// End of weak reference support closures
// Abstract task used to preserve (i.e. copy) any referent objects
--- 5093,5103 ----
*** 5245,5263 ****
// 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");
- set_par_threads(no_of_gc_workers);
G1ParPreserveCMReferentsTask keep_cm_referents(this,
no_of_gc_workers,
_task_queues);
workers()->run_task(&keep_cm_referents);
- set_par_threads(0);
-
// Closure to test whether a referent is alive.
G1STWIsAliveClosure is_alive(this);
// Even when parallel reference processing is enabled, the processing
// of JNI refs is serial and performed serially by the current thread
--- 5215,5230 ----
*** 5380,5400 ****
const uint n_workers = workers()->active_workers();
assert(UseDynamicNumberOfGCThreads ||
n_workers == workers()->total_workers(),
"If not dynamic should be using all the workers");
- set_par_threads(n_workers);
-
init_for_evac_failure(NULL);
assert(dirty_card_queue_set().completed_buffers_num() == 0, "Should be empty");
double start_par_time_sec = os::elapsedTime();
double end_par_time_sec;
{
! G1RootProcessor root_processor(this);
G1ParTask g1_par_task(this, _task_queues, &root_processor);
// InitialMark needs claim bits to keep track of the marked-through CLDs.
if (g1_policy()->during_initial_mark_pause()) {
ClassLoaderDataGraph::clear_claimed_marks();
}
--- 5347,5365 ----
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);
assert(dirty_card_queue_set().completed_buffers_num() == 0, "Should be empty");
double start_par_time_sec = os::elapsedTime();
double end_par_time_sec;
{
! G1RootProcessor root_processor(this, n_workers);
G1ParTask g1_par_task(this, _task_queues, &root_processor);
// InitialMark needs claim bits to keep track of the marked-through CLDs.
if (g1_policy()->during_initial_mark_pause()) {
ClassLoaderDataGraph::clear_claimed_marks();
}
*** 5422,5433 ****
double code_root_fixup_time_ms =
(os::elapsedTime() - end_par_time_sec) * 1000.0;
phase_times->record_code_root_fixup_time(code_root_fixup_time_ms);
- set_par_threads(0);
-
// Process any discovered reference objects - we have
// to do this _before_ we retire the GC alloc regions
// as we may have to copy some 'reachable' referent
// objects (and their reachable sub-graphs) that were
// not copied during the pause.
--- 5387,5396 ----
*** 5776,5788 ****
{
// Iterate over the dirty cards region list.
G1ParCleanupCTTask cleanup_task(ct_bs, this);
- set_par_threads();
workers()->run_task(&cleanup_task);
- set_par_threads(0);
#ifndef PRODUCT
if (G1VerifyCTCleanup || VerifyAfterGC) {
G1VerifyCardTableCleanup cleanup_verifier(this, ct_bs);
heap_region_iterate(&cleanup_verifier);
}
--- 5739,5749 ----
*** 6311,6335 ****
// instead of when it's allocated, since this is the point that its
// used space has been recored in _summary_bytes_used.
g1mm()->update_eden_size();
}
- void G1CollectedHeap::set_par_threads() {
- // Don't change the number of workers. Use the value previously set
- // in the workgroup.
- uint n_workers = workers()->active_workers();
- assert(UseDynamicNumberOfGCThreads ||
- n_workers == workers()->total_workers(),
- "Otherwise should be using the total number of workers");
- if (n_workers == 0) {
- assert(false, "Should have been set in prior evacuation pause.");
- n_workers = ParallelGCThreads;
- workers()->set_active_workers(n_workers);
- }
- set_par_threads(n_workers);
- }
-
// Methods for the GC alloc regions
HeapRegion* G1CollectedHeap::new_gc_alloc_region(size_t word_size,
uint count,
InCSetState dest) {
--- 6272,6281 ----
< prev index next >