comparison src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp @ 20224:a2328cbebb23

8035401: Fix visibility of G1ParScanThreadState members Summary: After JDK-8035400 there were several opportunities to fix the visibility of several members of the G1ParScanThreadState class. Reviewed-by: brutisso, mgerdin
author tschatzl
date Mon, 21 Jul 2014 09:41:06 +0200
parents b0c374311c4e
children 9fec19bb0659
comparison
equal deleted inserted replaced
20223:b0c374311c4e 20224:a2328cbebb23
4687 pss->end_term_time(); 4687 pss->end_term_time();
4688 return res; 4688 return res;
4689 } 4689 }
4690 4690
4691 void G1ParEvacuateFollowersClosure::do_void() { 4691 void G1ParEvacuateFollowersClosure::do_void() {
4692 StarTask stolen_task;
4693 G1ParScanThreadState* const pss = par_scan_state(); 4692 G1ParScanThreadState* const pss = par_scan_state();
4694 pss->trim_queue(); 4693 pss->trim_queue();
4695
4696 do { 4694 do {
4697 while (queues()->steal(pss->queue_num(), pss->hash_seed(), stolen_task)) { 4695 pss->steal_and_trim_queue(queues());
4698 assert(pss->verify_task(stolen_task), "sanity");
4699 if (stolen_task.is_narrow()) {
4700 pss->deal_with_reference((narrowOop*) stolen_task);
4701 } else {
4702 pss->deal_with_reference((oop*) stolen_task);
4703 }
4704
4705 // We've just processed a reference and we might have made
4706 // available new entries on the queues. So we have to make sure
4707 // we drain the queues as necessary.
4708 pss->trim_queue();
4709 }
4710 } while (!offer_termination()); 4696 } while (!offer_termination());
4711 } 4697 }
4712 4698
4713 class G1KlassScanClosure : public KlassClosure { 4699 class G1KlassScanClosure : public KlassClosure {
4714 G1ParCopyHelper* _closure; 4700 G1ParCopyHelper* _closure;
4750 return (_g1h->capacity() + G1BlockOffsetSharedArray::N_bytes - 1) 4736 return (_g1h->capacity() + G1BlockOffsetSharedArray::N_bytes - 1)
4751 / G1BlockOffsetSharedArray::N_bytes; 4737 / G1BlockOffsetSharedArray::N_bytes;
4752 } 4738 }
4753 4739
4754 public: 4740 public:
4755 G1ParTask(G1CollectedHeap* g1h, 4741 G1ParTask(G1CollectedHeap* g1h, RefToScanQueueSet *task_queues)
4756 RefToScanQueueSet *task_queues)
4757 : AbstractGangTask("G1 collection"), 4742 : AbstractGangTask("G1 collection"),
4758 _g1h(g1h), 4743 _g1h(g1h),
4759 _queues(task_queues), 4744 _queues(task_queues),
4760 _terminator(0, _queues), 4745 _terminator(0, _queues),
4761 _stats_lock(Mutex::leaf, "parallel G1 stats lock", true) 4746 _stats_lock(Mutex::leaf, "parallel G1 stats lock", true)
4849 if (ParallelGCVerbose) { 4834 if (ParallelGCVerbose) {
4850 MutexLocker x(stats_lock()); 4835 MutexLocker x(stats_lock());
4851 pss.print_termination_stats(worker_id); 4836 pss.print_termination_stats(worker_id);
4852 } 4837 }
4853 4838
4854 assert(pss.refs()->is_empty(), "should be empty"); 4839 assert(pss.queue_is_empty(), "should be empty");
4855 4840
4856 // Close the inner scope so that the ResourceMark and HandleMark 4841 // Close the inner scope so that the ResourceMark and HandleMark
4857 // destructors are executed here and are included as part of the 4842 // destructors are executed here and are included as part of the
4858 // "GC Worker Time". 4843 // "GC Worker Time".
4859 } 4844 }
5392 G1ParScanThreadState pss(_g1h, worker_id, NULL); 5377 G1ParScanThreadState pss(_g1h, worker_id, NULL);
5393 G1ParScanHeapEvacFailureClosure evac_failure_cl(_g1h, &pss, NULL); 5378 G1ParScanHeapEvacFailureClosure evac_failure_cl(_g1h, &pss, NULL);
5394 5379
5395 pss.set_evac_failure_closure(&evac_failure_cl); 5380 pss.set_evac_failure_closure(&evac_failure_cl);
5396 5381
5397 assert(pss.refs()->is_empty(), "both queue and overflow should be empty"); 5382 assert(pss.queue_is_empty(), "both queue and overflow should be empty");
5398
5399 5383
5400 G1ParScanExtRootClosure only_copy_non_heap_cl(_g1h, &pss, NULL); 5384 G1ParScanExtRootClosure only_copy_non_heap_cl(_g1h, &pss, NULL);
5401 G1ParScanMetadataClosure only_copy_metadata_cl(_g1h, &pss, NULL); 5385 G1ParScanMetadataClosure only_copy_metadata_cl(_g1h, &pss, NULL);
5402 5386
5403 G1ParScanAndMarkExtRootClosure copy_mark_non_heap_cl(_g1h, &pss, NULL); 5387 G1ParScanAndMarkExtRootClosure copy_mark_non_heap_cl(_g1h, &pss, NULL);
5451 5435
5452 // Drain the queue - which may cause stealing 5436 // Drain the queue - which may cause stealing
5453 G1ParEvacuateFollowersClosure drain_queue(_g1h, &pss, _queues, &_terminator); 5437 G1ParEvacuateFollowersClosure drain_queue(_g1h, &pss, _queues, &_terminator);
5454 drain_queue.do_void(); 5438 drain_queue.do_void();
5455 // Allocation buffers were retired at the end of G1ParEvacuateFollowersClosure 5439 // Allocation buffers were retired at the end of G1ParEvacuateFollowersClosure
5456 assert(pss.refs()->is_empty(), "should be"); 5440 assert(pss.queue_is_empty(), "should be");
5457 } 5441 }
5458 }; 5442 };
5459 5443
5460 // Weak Reference processing during an evacuation pause (part 1). 5444 // Weak Reference processing during an evacuation pause (part 1).
5461 void G1CollectedHeap::process_discovered_references(uint no_of_gc_workers) { 5445 void G1CollectedHeap::process_discovered_references(uint no_of_gc_workers) {
5518 // reference objects. 5502 // reference objects.
5519 G1ParScanHeapEvacFailureClosure evac_failure_cl(this, &pss, NULL); 5503 G1ParScanHeapEvacFailureClosure evac_failure_cl(this, &pss, NULL);
5520 5504
5521 pss.set_evac_failure_closure(&evac_failure_cl); 5505 pss.set_evac_failure_closure(&evac_failure_cl);
5522 5506
5523 assert(pss.refs()->is_empty(), "pre-condition"); 5507 assert(pss.queue_is_empty(), "pre-condition");
5524 5508
5525 G1ParScanExtRootClosure only_copy_non_heap_cl(this, &pss, NULL); 5509 G1ParScanExtRootClosure only_copy_non_heap_cl(this, &pss, NULL);
5526 G1ParScanMetadataClosure only_copy_metadata_cl(this, &pss, NULL); 5510 G1ParScanMetadataClosure only_copy_metadata_cl(this, &pss, NULL);
5527 5511
5528 G1ParScanAndMarkExtRootClosure copy_mark_non_heap_cl(this, &pss, NULL); 5512 G1ParScanAndMarkExtRootClosure copy_mark_non_heap_cl(this, &pss, NULL);
5570 } 5554 }
5571 5555
5572 _gc_tracer_stw->report_gc_reference_stats(stats); 5556 _gc_tracer_stw->report_gc_reference_stats(stats);
5573 5557
5574 // We have completed copying any necessary live referent objects. 5558 // We have completed copying any necessary live referent objects.
5575 assert(pss.refs()->is_empty(), "both queue and overflow should be empty"); 5559 assert(pss.queue_is_empty(), "both queue and overflow should be empty");
5576 5560
5577 double ref_proc_time = os::elapsedTime() - ref_proc_start; 5561 double ref_proc_time = os::elapsedTime() - ref_proc_start;
5578 g1_policy()->phase_times()->record_ref_proc_time(ref_proc_time * 1000.0); 5562 g1_policy()->phase_times()->record_ref_proc_time(ref_proc_time * 1000.0);
5579 } 5563 }
5580 5564