Fri, 18 Feb 2011 10:07:34 -0800
7020042: G1: Partially remove fix for 6994628
Summary: Disable reference discovery and processing during concurrent marking by disabling fix for 6994628.
Reviewed-by: tonyp, ysr
ysr@777 | 1 | /* |
stefank@2314 | 2 | * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved. |
ysr@777 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
ysr@777 | 4 | * |
ysr@777 | 5 | * This code is free software; you can redistribute it and/or modify it |
ysr@777 | 6 | * under the terms of the GNU General Public License version 2 only, as |
ysr@777 | 7 | * published by the Free Software Foundation. |
ysr@777 | 8 | * |
ysr@777 | 9 | * This code is distributed in the hope that it will be useful, but WITHOUT |
ysr@777 | 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
ysr@777 | 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
ysr@777 | 12 | * version 2 for more details (a copy is included in the LICENSE file that |
ysr@777 | 13 | * accompanied this code). |
ysr@777 | 14 | * |
ysr@777 | 15 | * You should have received a copy of the GNU General Public License version |
ysr@777 | 16 | * 2 along with this work; if not, write to the Free Software Foundation, |
ysr@777 | 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
ysr@777 | 18 | * |
trims@1907 | 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
trims@1907 | 20 | * or visit www.oracle.com if you need additional information or have any |
trims@1907 | 21 | * questions. |
ysr@777 | 22 | * |
ysr@777 | 23 | */ |
ysr@777 | 24 | |
stefank@2314 | 25 | #ifndef SHARE_VM_GC_IMPLEMENTATION_G1_G1OOPCLOSURES_HPP |
stefank@2314 | 26 | #define SHARE_VM_GC_IMPLEMENTATION_G1_G1OOPCLOSURES_HPP |
stefank@2314 | 27 | |
ysr@777 | 28 | class HeapRegion; |
ysr@777 | 29 | class G1CollectedHeap; |
ysr@777 | 30 | class G1RemSet; |
ysr@777 | 31 | class ConcurrentMark; |
ysr@777 | 32 | class DirtyCardToOopClosure; |
ysr@777 | 33 | class CMBitMap; |
ysr@777 | 34 | class CMMarkStack; |
ysr@777 | 35 | class G1ParScanThreadState; |
ysr@777 | 36 | |
ysr@777 | 37 | // A class that scans oops in a given heap region (much as OopsInGenClosure |
ysr@777 | 38 | // scans oops in a generation.) |
ysr@777 | 39 | class OopsInHeapRegionClosure: public OopsInGenClosure { |
ysr@777 | 40 | protected: |
ysr@777 | 41 | HeapRegion* _from; |
ysr@777 | 42 | public: |
ysr@777 | 43 | virtual void set_region(HeapRegion* from) { _from = from; } |
ysr@777 | 44 | }; |
ysr@777 | 45 | |
ysr@777 | 46 | class G1ParClosureSuper : public OopsInHeapRegionClosure { |
ysr@777 | 47 | protected: |
ysr@777 | 48 | G1CollectedHeap* _g1; |
ysr@777 | 49 | G1RemSet* _g1_rem; |
ysr@777 | 50 | ConcurrentMark* _cm; |
ysr@777 | 51 | G1ParScanThreadState* _par_scan_state; |
ysr@777 | 52 | public: |
ysr@777 | 53 | G1ParClosureSuper(G1CollectedHeap* g1, G1ParScanThreadState* par_scan_state); |
ysr@777 | 54 | bool apply_to_weak_ref_discovered_field() { return true; } |
ysr@777 | 55 | }; |
ysr@777 | 56 | |
iveresov@1696 | 57 | class G1ParPushHeapRSClosure : public G1ParClosureSuper { |
iveresov@1696 | 58 | public: |
iveresov@1696 | 59 | G1ParPushHeapRSClosure(G1CollectedHeap* g1, G1ParScanThreadState* par_scan_state) : |
iveresov@1696 | 60 | G1ParClosureSuper(g1, par_scan_state) { } |
iveresov@1696 | 61 | template <class T> void do_oop_nv(T* p); |
iveresov@1696 | 62 | virtual void do_oop(oop* p) { do_oop_nv(p); } |
iveresov@1696 | 63 | virtual void do_oop(narrowOop* p) { do_oop_nv(p); } |
iveresov@1696 | 64 | }; |
iveresov@1696 | 65 | |
ysr@777 | 66 | class G1ParScanClosure : public G1ParClosureSuper { |
ysr@777 | 67 | public: |
ysr@777 | 68 | G1ParScanClosure(G1CollectedHeap* g1, G1ParScanThreadState* par_scan_state) : |
ysr@777 | 69 | G1ParClosureSuper(g1, par_scan_state) { } |
ysr@1280 | 70 | template <class T> void do_oop_nv(T* p); |
ysr@777 | 71 | virtual void do_oop(oop* p) { do_oop_nv(p); } |
ysr@777 | 72 | virtual void do_oop(narrowOop* p) { do_oop_nv(p); } |
ysr@777 | 73 | }; |
ysr@777 | 74 | |
ysr@1280 | 75 | #define G1_PARTIAL_ARRAY_MASK 0x2 |
ysr@777 | 76 | |
ysr@1280 | 77 | template <class T> inline bool has_partial_array_mask(T* ref) { |
ysr@1280 | 78 | return ((uintptr_t)ref & G1_PARTIAL_ARRAY_MASK) == G1_PARTIAL_ARRAY_MASK; |
tonyp@961 | 79 | } |
tonyp@961 | 80 | |
ysr@1280 | 81 | template <class T> inline T* set_partial_array_mask(T obj) { |
ysr@1280 | 82 | assert(((uintptr_t)obj & G1_PARTIAL_ARRAY_MASK) == 0, "Information loss!"); |
ysr@1280 | 83 | return (T*) ((uintptr_t)obj | G1_PARTIAL_ARRAY_MASK); |
tonyp@961 | 84 | } |
tonyp@961 | 85 | |
ysr@1280 | 86 | template <class T> inline oop clear_partial_array_mask(T* ref) { |
ysr@1280 | 87 | return oop((intptr_t)ref & ~G1_PARTIAL_ARRAY_MASK); |
tonyp@961 | 88 | } |
tonyp@961 | 89 | |
ysr@777 | 90 | class G1ParScanPartialArrayClosure : public G1ParClosureSuper { |
ysr@777 | 91 | G1ParScanClosure _scanner; |
ysr@777 | 92 | public: |
ysr@777 | 93 | G1ParScanPartialArrayClosure(G1CollectedHeap* g1, G1ParScanThreadState* par_scan_state) : |
ysr@777 | 94 | G1ParClosureSuper(g1, par_scan_state), _scanner(g1, par_scan_state) { } |
ysr@1280 | 95 | template <class T> void do_oop_nv(T* p); |
ysr@777 | 96 | virtual void do_oop(oop* p) { do_oop_nv(p); } |
ysr@777 | 97 | virtual void do_oop(narrowOop* p) { do_oop_nv(p); } |
ysr@777 | 98 | }; |
ysr@777 | 99 | |
ysr@777 | 100 | |
ysr@777 | 101 | class G1ParCopyHelper : public G1ParClosureSuper { |
ysr@777 | 102 | G1ParScanClosure *_scanner; |
ysr@777 | 103 | protected: |
ysr@1280 | 104 | template <class T> void mark_forwardee(T* p); |
ysr@777 | 105 | oop copy_to_survivor_space(oop obj); |
ysr@777 | 106 | public: |
ysr@777 | 107 | G1ParCopyHelper(G1CollectedHeap* g1, G1ParScanThreadState* par_scan_state, |
ysr@777 | 108 | G1ParScanClosure *scanner) : |
ysr@777 | 109 | G1ParClosureSuper(g1, par_scan_state), _scanner(scanner) { } |
ysr@777 | 110 | }; |
ysr@777 | 111 | |
tonyp@961 | 112 | template<bool do_gen_barrier, G1Barrier barrier, |
iveresov@1696 | 113 | bool do_mark_forwardee> |
ysr@777 | 114 | class G1ParCopyClosure : public G1ParCopyHelper { |
ysr@777 | 115 | G1ParScanClosure _scanner; |
ysr@1280 | 116 | template <class T> void do_oop_work(T* p); |
ysr@777 | 117 | public: |
ysr@777 | 118 | G1ParCopyClosure(G1CollectedHeap* g1, G1ParScanThreadState* par_scan_state) : |
ysr@777 | 119 | _scanner(g1, par_scan_state), G1ParCopyHelper(g1, par_scan_state, &_scanner) { } |
ysr@1280 | 120 | template <class T> void do_oop_nv(T* p) { |
ysr@777 | 121 | do_oop_work(p); |
ysr@777 | 122 | if (do_mark_forwardee) |
ysr@777 | 123 | mark_forwardee(p); |
ysr@777 | 124 | } |
ysr@777 | 125 | virtual void do_oop(oop* p) { do_oop_nv(p); } |
ysr@777 | 126 | virtual void do_oop(narrowOop* p) { do_oop_nv(p); } |
ysr@777 | 127 | }; |
ysr@777 | 128 | |
iveresov@1696 | 129 | typedef G1ParCopyClosure<false, G1BarrierNone, false> G1ParScanExtRootClosure; |
iveresov@1696 | 130 | typedef G1ParCopyClosure<true, G1BarrierNone, false> G1ParScanPermClosure; |
iveresov@1696 | 131 | typedef G1ParCopyClosure<false, G1BarrierRS, false> G1ParScanHeapRSClosure; |
iveresov@1696 | 132 | typedef G1ParCopyClosure<false, G1BarrierNone, true> G1ParScanAndMarkExtRootClosure; |
iveresov@1696 | 133 | typedef G1ParCopyClosure<true, G1BarrierNone, true> G1ParScanAndMarkPermClosure; |
iveresov@1696 | 134 | typedef G1ParCopyClosure<false, G1BarrierRS, true> G1ParScanAndMarkHeapRSClosure; |
iveresov@1696 | 135 | |
tonyp@961 | 136 | // This is the only case when we set skip_cset_test. Basically, this |
tonyp@961 | 137 | // closure is (should?) only be called directly while we're draining |
tonyp@961 | 138 | // the overflow and task queues. In that case we know that the |
tonyp@961 | 139 | // reference in question points into the collection set, otherwise we |
ysr@1280 | 140 | // would not have pushed it on the queue. The following is defined in |
ysr@1280 | 141 | // g1_specialized_oop_closures.hpp. |
ysr@1280 | 142 | // typedef G1ParCopyClosure<false, G1BarrierEvac, false, true> G1ParScanHeapEvacClosure; |
tonyp@961 | 143 | // We need a separate closure to handle references during evacuation |
ysr@1280 | 144 | // failure processing, as we cannot asume that the reference already |
ysr@1280 | 145 | // points into the collection set (like G1ParScanHeapEvacClosure does). |
iveresov@1696 | 146 | typedef G1ParCopyClosure<false, G1BarrierEvac, false> G1ParScanHeapEvacFailureClosure; |
ysr@777 | 147 | |
ysr@777 | 148 | class FilterIntoCSClosure: public OopClosure { |
ysr@777 | 149 | G1CollectedHeap* _g1; |
ysr@777 | 150 | OopClosure* _oc; |
ysr@777 | 151 | DirtyCardToOopClosure* _dcto_cl; |
ysr@777 | 152 | public: |
ysr@777 | 153 | FilterIntoCSClosure( DirtyCardToOopClosure* dcto_cl, |
ysr@777 | 154 | G1CollectedHeap* g1, OopClosure* oc) : |
ysr@777 | 155 | _dcto_cl(dcto_cl), _g1(g1), _oc(oc) |
ysr@777 | 156 | {} |
ysr@1280 | 157 | template <class T> void do_oop_nv(T* p); |
ysr@1280 | 158 | virtual void do_oop(oop* p) { do_oop_nv(p); } |
ysr@1280 | 159 | virtual void do_oop(narrowOop* p) { do_oop_nv(p); } |
ysr@777 | 160 | bool apply_to_weak_ref_discovered_field() { return true; } |
ysr@777 | 161 | bool do_header() { return false; } |
ysr@777 | 162 | }; |
ysr@777 | 163 | |
ysr@777 | 164 | class FilterInHeapRegionAndIntoCSClosure : public OopsInHeapRegionClosure { |
ysr@777 | 165 | G1CollectedHeap* _g1; |
ysr@777 | 166 | OopsInHeapRegionClosure* _oc; |
ysr@777 | 167 | public: |
ysr@777 | 168 | FilterInHeapRegionAndIntoCSClosure(G1CollectedHeap* g1, |
ysr@777 | 169 | OopsInHeapRegionClosure* oc) : |
ysr@777 | 170 | _g1(g1), _oc(oc) |
ysr@777 | 171 | {} |
ysr@1280 | 172 | template <class T> void do_oop_nv(T* p); |
ysr@1280 | 173 | virtual void do_oop(oop* p) { do_oop_nv(p); } |
ysr@1280 | 174 | virtual void do_oop(narrowOop* p) { do_oop_nv(p); } |
ysr@777 | 175 | bool apply_to_weak_ref_discovered_field() { return true; } |
ysr@777 | 176 | bool do_header() { return false; } |
ysr@777 | 177 | void set_region(HeapRegion* from) { |
ysr@777 | 178 | _oc->set_region(from); |
ysr@777 | 179 | } |
ysr@777 | 180 | }; |
ysr@777 | 181 | |
ysr@777 | 182 | class FilterAndMarkInHeapRegionAndIntoCSClosure : public OopsInHeapRegionClosure { |
ysr@777 | 183 | G1CollectedHeap* _g1; |
ysr@777 | 184 | ConcurrentMark* _cm; |
ysr@777 | 185 | OopsInHeapRegionClosure* _oc; |
ysr@777 | 186 | public: |
ysr@777 | 187 | FilterAndMarkInHeapRegionAndIntoCSClosure(G1CollectedHeap* g1, |
ysr@777 | 188 | OopsInHeapRegionClosure* oc, |
ysr@777 | 189 | ConcurrentMark* cm) |
ysr@777 | 190 | : _g1(g1), _oc(oc), _cm(cm) { } |
ysr@777 | 191 | |
ysr@1280 | 192 | template <class T> void do_oop_nv(T* p); |
ysr@1280 | 193 | virtual void do_oop(oop* p) { do_oop_nv(p); } |
ysr@1280 | 194 | virtual void do_oop(narrowOop* p) { do_oop_nv(p); } |
ysr@777 | 195 | bool apply_to_weak_ref_discovered_field() { return true; } |
ysr@777 | 196 | bool do_header() { return false; } |
ysr@777 | 197 | void set_region(HeapRegion* from) { |
ysr@777 | 198 | _oc->set_region(from); |
ysr@777 | 199 | } |
ysr@777 | 200 | }; |
ysr@777 | 201 | |
ysr@777 | 202 | class FilterOutOfRegionClosure: public OopClosure { |
ysr@777 | 203 | HeapWord* _r_bottom; |
ysr@777 | 204 | HeapWord* _r_end; |
ysr@777 | 205 | OopClosure* _oc; |
ysr@777 | 206 | int _out_of_region; |
ysr@777 | 207 | public: |
ysr@777 | 208 | FilterOutOfRegionClosure(HeapRegion* r, OopClosure* oc); |
ysr@1280 | 209 | template <class T> void do_oop_nv(T* p); |
ysr@1280 | 210 | virtual void do_oop(oop* p) { do_oop_nv(p); } |
ysr@1280 | 211 | virtual void do_oop(narrowOop* p) { do_oop_nv(p); } |
ysr@777 | 212 | bool apply_to_weak_ref_discovered_field() { return true; } |
ysr@777 | 213 | bool do_header() { return false; } |
ysr@777 | 214 | int out_of_region() { return _out_of_region; } |
ysr@777 | 215 | }; |
stefank@2314 | 216 | |
stefank@2314 | 217 | #endif // SHARE_VM_GC_IMPLEMENTATION_G1_G1OOPCLOSURES_HPP |