Mercurial > hg > graal-jvmci-8
comparison src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp @ 17759:bc22cbb8b45a
8035330: Remove G1ParScanPartialArrayClosure and G1ParScanHeapEvacClosure
Summary: Mentioned closures are actually wrapped methods. This adds confusion to readers, and in this case also increases code size as G1ParScanHeapEvacClosure is part of the oop_oop_iterate() methods. Move them into G1ParScanThreadState as methods.
Reviewed-by: stefank
author | tschatzl |
---|---|
date | Mon, 24 Mar 2014 15:30:56 +0100 |
parents | ae7336d6337e |
children | 595c0f60d50d 8ee855b4e667 |
comparison
equal
deleted
inserted
replaced
17758:ae7336d6337e | 17759:bc22cbb8b45a |
---|---|
4648 } | 4648 } |
4649 } | 4649 } |
4650 #endif // ASSERT | 4650 #endif // ASSERT |
4651 | 4651 |
4652 void G1ParScanThreadState::trim_queue() { | 4652 void G1ParScanThreadState::trim_queue() { |
4653 assert(_evac_cl != NULL, "not set"); | |
4654 assert(_evac_failure_cl != NULL, "not set"); | 4653 assert(_evac_failure_cl != NULL, "not set"); |
4655 assert(_partial_scan_cl != NULL, "not set"); | |
4656 | 4654 |
4657 StarTask ref; | 4655 StarTask ref; |
4658 do { | 4656 do { |
4659 // Drain the overflow stack first, so other threads can steal. | 4657 // Drain the overflow stack first, so other threads can steal. |
4660 while (refs()->pop_overflow(ref)) { | 4658 while (refs()->pop_overflow(ref)) { |
4852 } | 4850 } |
4853 | 4851 |
4854 template void G1ParCopyClosure<G1BarrierEvac, false>::do_oop_work(oop* p); | 4852 template void G1ParCopyClosure<G1BarrierEvac, false>::do_oop_work(oop* p); |
4855 template void G1ParCopyClosure<G1BarrierEvac, false>::do_oop_work(narrowOop* p); | 4853 template void G1ParCopyClosure<G1BarrierEvac, false>::do_oop_work(narrowOop* p); |
4856 | 4854 |
4857 template <class T> void G1ParScanPartialArrayClosure::do_oop_nv(T* p) { | |
4858 assert(has_partial_array_mask(p), "invariant"); | |
4859 oop from_obj = clear_partial_array_mask(p); | |
4860 | |
4861 assert(Universe::heap()->is_in_reserved(from_obj), "must be in heap."); | |
4862 assert(from_obj->is_objArray(), "must be obj array"); | |
4863 objArrayOop from_obj_array = objArrayOop(from_obj); | |
4864 // The from-space object contains the real length. | |
4865 int length = from_obj_array->length(); | |
4866 | |
4867 assert(from_obj->is_forwarded(), "must be forwarded"); | |
4868 oop to_obj = from_obj->forwardee(); | |
4869 assert(from_obj != to_obj, "should not be chunking self-forwarded objects"); | |
4870 objArrayOop to_obj_array = objArrayOop(to_obj); | |
4871 // We keep track of the next start index in the length field of the | |
4872 // to-space object. | |
4873 int next_index = to_obj_array->length(); | |
4874 assert(0 <= next_index && next_index < length, | |
4875 err_msg("invariant, next index: %d, length: %d", next_index, length)); | |
4876 | |
4877 int start = next_index; | |
4878 int end = length; | |
4879 int remainder = end - start; | |
4880 // We'll try not to push a range that's smaller than ParGCArrayScanChunk. | |
4881 if (remainder > 2 * ParGCArrayScanChunk) { | |
4882 end = start + ParGCArrayScanChunk; | |
4883 to_obj_array->set_length(end); | |
4884 // Push the remainder before we process the range in case another | |
4885 // worker has run out of things to do and can steal it. | |
4886 oop* from_obj_p = set_partial_array_mask(from_obj); | |
4887 _par_scan_state->push_on_queue(from_obj_p); | |
4888 } else { | |
4889 assert(length == end, "sanity"); | |
4890 // We'll process the final range for this object. Restore the length | |
4891 // so that the heap remains parsable in case of evacuation failure. | |
4892 to_obj_array->set_length(end); | |
4893 } | |
4894 _scanner.set_region(_g1->heap_region_containing_raw(to_obj)); | |
4895 // Process indexes [start,end). It will also process the header | |
4896 // along with the first chunk (i.e., the chunk with start == 0). | |
4897 // Note that at this point the length field of to_obj_array is not | |
4898 // correct given that we are using it to keep track of the next | |
4899 // start index. oop_iterate_range() (thankfully!) ignores the length | |
4900 // field and only relies on the start / end parameters. It does | |
4901 // however return the size of the object which will be incorrect. So | |
4902 // we have to ignore it even if we wanted to use it. | |
4903 to_obj_array->oop_iterate_range(&_scanner, start, end); | |
4904 } | |
4905 | |
4906 class G1ParEvacuateFollowersClosure : public VoidClosure { | 4855 class G1ParEvacuateFollowersClosure : public VoidClosure { |
4907 protected: | 4856 protected: |
4908 G1CollectedHeap* _g1h; | 4857 G1CollectedHeap* _g1h; |
4909 G1ParScanThreadState* _par_scan_state; | 4858 G1ParScanThreadState* _par_scan_state; |
4910 RefToScanQueueSet* _queues; | 4859 RefToScanQueueSet* _queues; |
5042 HandleMark hm; | 4991 HandleMark hm; |
5043 | 4992 |
5044 ReferenceProcessor* rp = _g1h->ref_processor_stw(); | 4993 ReferenceProcessor* rp = _g1h->ref_processor_stw(); |
5045 | 4994 |
5046 G1ParScanThreadState pss(_g1h, worker_id, rp); | 4995 G1ParScanThreadState pss(_g1h, worker_id, rp); |
5047 G1ParScanHeapEvacClosure scan_evac_cl(_g1h, &pss, rp); | |
5048 G1ParScanHeapEvacFailureClosure evac_failure_cl(_g1h, &pss, rp); | 4996 G1ParScanHeapEvacFailureClosure evac_failure_cl(_g1h, &pss, rp); |
5049 G1ParScanPartialArrayClosure partial_scan_cl(_g1h, &pss, rp); | 4997 |
5050 | |
5051 pss.set_evac_closure(&scan_evac_cl); | |
5052 pss.set_evac_failure_closure(&evac_failure_cl); | 4998 pss.set_evac_failure_closure(&evac_failure_cl); |
5053 pss.set_partial_scan_closure(&partial_scan_cl); | |
5054 | 4999 |
5055 G1ParScanExtRootClosure only_scan_root_cl(_g1h, &pss, rp); | 5000 G1ParScanExtRootClosure only_scan_root_cl(_g1h, &pss, rp); |
5056 G1ParScanMetadataClosure only_scan_metadata_cl(_g1h, &pss, rp); | 5001 G1ParScanMetadataClosure only_scan_metadata_cl(_g1h, &pss, rp); |
5057 | 5002 |
5058 G1ParScanAndMarkExtRootClosure scan_mark_root_cl(_g1h, &pss, rp); | 5003 G1ParScanAndMarkExtRootClosure scan_mark_root_cl(_g1h, &pss, rp); |
5508 HandleMark hm; | 5453 HandleMark hm; |
5509 | 5454 |
5510 G1STWIsAliveClosure is_alive(_g1h); | 5455 G1STWIsAliveClosure is_alive(_g1h); |
5511 | 5456 |
5512 G1ParScanThreadState pss(_g1h, worker_id, NULL); | 5457 G1ParScanThreadState pss(_g1h, worker_id, NULL); |
5513 | |
5514 G1ParScanHeapEvacClosure scan_evac_cl(_g1h, &pss, NULL); | |
5515 G1ParScanHeapEvacFailureClosure evac_failure_cl(_g1h, &pss, NULL); | 5458 G1ParScanHeapEvacFailureClosure evac_failure_cl(_g1h, &pss, NULL); |
5516 G1ParScanPartialArrayClosure partial_scan_cl(_g1h, &pss, NULL); | 5459 |
5517 | |
5518 pss.set_evac_closure(&scan_evac_cl); | |
5519 pss.set_evac_failure_closure(&evac_failure_cl); | 5460 pss.set_evac_failure_closure(&evac_failure_cl); |
5520 pss.set_partial_scan_closure(&partial_scan_cl); | |
5521 | 5461 |
5522 G1ParScanExtRootClosure only_copy_non_heap_cl(_g1h, &pss, NULL); | 5462 G1ParScanExtRootClosure only_copy_non_heap_cl(_g1h, &pss, NULL); |
5523 G1ParScanMetadataClosure only_copy_metadata_cl(_g1h, &pss, NULL); | 5463 G1ParScanMetadataClosure only_copy_metadata_cl(_g1h, &pss, NULL); |
5524 | 5464 |
5525 G1ParScanAndMarkExtRootClosure copy_mark_non_heap_cl(_g1h, &pss, NULL); | 5465 G1ParScanAndMarkExtRootClosure copy_mark_non_heap_cl(_g1h, &pss, NULL); |
5620 void work(uint worker_id) { | 5560 void work(uint worker_id) { |
5621 ResourceMark rm; | 5561 ResourceMark rm; |
5622 HandleMark hm; | 5562 HandleMark hm; |
5623 | 5563 |
5624 G1ParScanThreadState pss(_g1h, worker_id, NULL); | 5564 G1ParScanThreadState pss(_g1h, worker_id, NULL); |
5625 G1ParScanHeapEvacClosure scan_evac_cl(_g1h, &pss, NULL); | |
5626 G1ParScanHeapEvacFailureClosure evac_failure_cl(_g1h, &pss, NULL); | 5565 G1ParScanHeapEvacFailureClosure evac_failure_cl(_g1h, &pss, NULL); |
5627 G1ParScanPartialArrayClosure partial_scan_cl(_g1h, &pss, NULL); | 5566 |
5628 | |
5629 pss.set_evac_closure(&scan_evac_cl); | |
5630 pss.set_evac_failure_closure(&evac_failure_cl); | 5567 pss.set_evac_failure_closure(&evac_failure_cl); |
5631 pss.set_partial_scan_closure(&partial_scan_cl); | |
5632 | 5568 |
5633 assert(pss.refs()->is_empty(), "both queue and overflow should be empty"); | 5569 assert(pss.refs()->is_empty(), "both queue and overflow should be empty"); |
5634 | 5570 |
5635 | 5571 |
5636 G1ParScanExtRootClosure only_copy_non_heap_cl(_g1h, &pss, NULL); | 5572 G1ParScanExtRootClosure only_copy_non_heap_cl(_g1h, &pss, NULL); |
5750 G1ParScanThreadState pss(this, 0, NULL); | 5686 G1ParScanThreadState pss(this, 0, NULL); |
5751 | 5687 |
5752 // We do not embed a reference processor in the copying/scanning | 5688 // We do not embed a reference processor in the copying/scanning |
5753 // closures while we're actually processing the discovered | 5689 // closures while we're actually processing the discovered |
5754 // reference objects. | 5690 // reference objects. |
5755 G1ParScanHeapEvacClosure scan_evac_cl(this, &pss, NULL); | |
5756 G1ParScanHeapEvacFailureClosure evac_failure_cl(this, &pss, NULL); | 5691 G1ParScanHeapEvacFailureClosure evac_failure_cl(this, &pss, NULL); |
5757 G1ParScanPartialArrayClosure partial_scan_cl(this, &pss, NULL); | 5692 |
5758 | |
5759 pss.set_evac_closure(&scan_evac_cl); | |
5760 pss.set_evac_failure_closure(&evac_failure_cl); | 5693 pss.set_evac_failure_closure(&evac_failure_cl); |
5761 pss.set_partial_scan_closure(&partial_scan_cl); | |
5762 | 5694 |
5763 assert(pss.refs()->is_empty(), "pre-condition"); | 5695 assert(pss.refs()->is_empty(), "pre-condition"); |
5764 | 5696 |
5765 G1ParScanExtRootClosure only_copy_non_heap_cl(this, &pss, NULL); | 5697 G1ParScanExtRootClosure only_copy_non_heap_cl(this, &pss, NULL); |
5766 G1ParScanMetadataClosure only_copy_metadata_cl(this, &pss, NULL); | 5698 G1ParScanMetadataClosure only_copy_metadata_cl(this, &pss, NULL); |