equal
deleted
inserted
replaced
4396 _terminator(workers, _queues), |
4396 _terminator(workers, _queues), |
4397 _n_workers(workers) |
4397 _n_workers(workers) |
4398 { } |
4398 { } |
4399 |
4399 |
4400 void work(uint worker_id) { |
4400 void work(uint worker_id) { |
|
4401 G1GCParPhaseTimesTracker x(_g1h->g1_policy()->phase_times(), G1GCPhaseTimes::PreserveCMReferents, worker_id); |
|
4402 |
4401 ResourceMark rm; |
4403 ResourceMark rm; |
4402 HandleMark hm; |
4404 HandleMark hm; |
4403 |
4405 |
4404 G1ParScanThreadState* pss = _pss->state_for_worker(worker_id); |
4406 G1ParScanThreadState* pss = _pss->state_for_worker(worker_id); |
4405 pss->set_ref_processor(NULL); |
4407 pss->set_ref_processor(NULL); |
4459 |
4461 |
4460 double ref_proc_time = os::elapsedTime() - ref_proc_start; |
4462 double ref_proc_time = os::elapsedTime() - ref_proc_start; |
4461 g1_policy()->phase_times()->record_ref_proc_time(ref_proc_time * 1000.0); |
4463 g1_policy()->phase_times()->record_ref_proc_time(ref_proc_time * 1000.0); |
4462 } |
4464 } |
4463 |
4465 |
4464 // Weak Reference processing during an evacuation pause (part 1). |
4466 void G1CollectedHeap::preserve_cm_referents(G1ParScanThreadStateSet* per_thread_states) { |
4465 void G1CollectedHeap::process_discovered_references(G1ParScanThreadStateSet* per_thread_states) { |
4467 double preserve_cm_referents_start = os::elapsedTime(); |
4466 double ref_proc_start = os::elapsedTime(); |
|
4467 |
|
4468 ReferenceProcessor* rp = _ref_processor_stw; |
|
4469 assert(rp->discovery_enabled(), "should have been enabled"); |
|
4470 |
|
4471 // Any reference objects, in the collection set, that were 'discovered' |
4468 // Any reference objects, in the collection set, that were 'discovered' |
4472 // by the CM ref processor should have already been copied (either by |
4469 // by the CM ref processor should have already been copied (either by |
4473 // applying the external root copy closure to the discovered lists, or |
4470 // applying the external root copy closure to the discovered lists, or |
4474 // by following an RSet entry). |
4471 // by following an RSet entry). |
4475 // |
4472 // |
4493 |
4490 |
4494 G1ParPreserveCMReferentsTask keep_cm_referents(this, |
4491 G1ParPreserveCMReferentsTask keep_cm_referents(this, |
4495 per_thread_states, |
4492 per_thread_states, |
4496 no_of_gc_workers, |
4493 no_of_gc_workers, |
4497 _task_queues); |
4494 _task_queues); |
4498 |
|
4499 workers()->run_task(&keep_cm_referents); |
4495 workers()->run_task(&keep_cm_referents); |
|
4496 |
|
4497 g1_policy()->phase_times()->record_preserve_cm_referents_time_ms((os::elapsedTime() - preserve_cm_referents_start) * 1000.0); |
|
4498 } |
|
4499 |
|
4500 // Weak Reference processing during an evacuation pause (part 1). |
|
4501 void G1CollectedHeap::process_discovered_references(G1ParScanThreadStateSet* per_thread_states) { |
|
4502 double ref_proc_start = os::elapsedTime(); |
|
4503 |
|
4504 ReferenceProcessor* rp = _ref_processor_stw; |
|
4505 assert(rp->discovery_enabled(), "should have been enabled"); |
4500 |
4506 |
4501 // Closure to test whether a referent is alive. |
4507 // Closure to test whether a referent is alive. |
4502 G1STWIsAliveClosure is_alive(this); |
4508 G1STWIsAliveClosure is_alive(this); |
4503 |
4509 |
4504 // Even when parallel reference processing is enabled, the processing |
4510 // Even when parallel reference processing is enabled, the processing |
4527 &keep_alive, |
4533 &keep_alive, |
4528 &drain_queue, |
4534 &drain_queue, |
4529 NULL, |
4535 NULL, |
4530 _gc_timer_stw); |
4536 _gc_timer_stw); |
4531 } else { |
4537 } else { |
|
4538 uint no_of_gc_workers = workers()->active_workers(); |
|
4539 |
4532 // Parallel reference processing |
4540 // Parallel reference processing |
4533 assert(rp->num_q() == no_of_gc_workers, "sanity"); |
4541 assert(rp->num_q() == no_of_gc_workers, "sanity"); |
4534 assert(no_of_gc_workers <= rp->max_num_q(), "sanity"); |
4542 assert(no_of_gc_workers <= rp->max_num_q(), "sanity"); |
4535 |
4543 |
4536 G1STWRefProcTaskExecutor par_task_executor(this, per_thread_states, workers(), _task_queues, no_of_gc_workers); |
4544 G1STWRefProcTaskExecutor par_task_executor(this, per_thread_states, workers(), _task_queues, no_of_gc_workers); |
4642 // to do this _before_ we retire the GC alloc regions |
4650 // to do this _before_ we retire the GC alloc regions |
4643 // as we may have to copy some 'reachable' referent |
4651 // as we may have to copy some 'reachable' referent |
4644 // objects (and their reachable sub-graphs) that were |
4652 // objects (and their reachable sub-graphs) that were |
4645 // not copied during the pause. |
4653 // not copied during the pause. |
4646 if (g1_policy()->should_process_references()) { |
4654 if (g1_policy()->should_process_references()) { |
|
4655 preserve_cm_referents(per_thread_states); |
4647 process_discovered_references(per_thread_states); |
4656 process_discovered_references(per_thread_states); |
4648 } else { |
4657 } else { |
4649 ref_processor_stw()->verify_no_references_recorded(); |
4658 ref_processor_stw()->verify_no_references_recorded(); |
4650 process_weak_jni_handles(); |
4659 process_weak_jni_handles(); |
4651 } |
4660 } |