src/share/vm/gc_implementation/g1/g1OopClosures.hpp

Thu, 15 Apr 2010 18:45:30 -0400

author
tonyp
date
Thu, 15 Apr 2010 18:45:30 -0400
changeset 1825
f9ec1e4bbb44
parent 1696
0414c1049f15
child 1907
c18cbe5936b8
permissions
-rw-r--r--

6939027: G1: assertion failure during the concurrent phase of cleanup
Summary: The outgoing region map is not maintained properly and it's causing an assert failure. Given that we don't actually use it, I'm removing it. I'm piggy-backing a small change on this which removes a message that it's printed before a Full GC when DisableExplicitGC is set.
Reviewed-by: apetrusenko, ysr

ysr@777 1 /*
xdono@1014 2 * Copyright 2001-2009 Sun Microsystems, Inc. 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 *
ysr@777 19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
ysr@777 20 * CA 95054 USA or visit www.sun.com if you need additional information or
ysr@777 21 * have any questions.
ysr@777 22 *
ysr@777 23 */
ysr@777 24
ysr@777 25 class HeapRegion;
ysr@777 26 class G1CollectedHeap;
ysr@777 27 class G1RemSet;
ysr@777 28 class HRInto_G1RemSet;
ysr@777 29 class G1RemSet;
ysr@777 30 class ConcurrentMark;
ysr@777 31 class DirtyCardToOopClosure;
ysr@777 32 class CMBitMap;
ysr@777 33 class CMMarkStack;
ysr@777 34 class G1ParScanThreadState;
ysr@777 35
ysr@777 36 // A class that scans oops in a given heap region (much as OopsInGenClosure
ysr@777 37 // scans oops in a generation.)
ysr@777 38 class OopsInHeapRegionClosure: public OopsInGenClosure {
ysr@777 39 protected:
ysr@777 40 HeapRegion* _from;
ysr@777 41 public:
ysr@777 42 virtual void set_region(HeapRegion* from) { _from = from; }
ysr@777 43 };
ysr@777 44
ysr@777 45 class G1ParClosureSuper : public OopsInHeapRegionClosure {
ysr@777 46 protected:
ysr@777 47 G1CollectedHeap* _g1;
ysr@777 48 G1RemSet* _g1_rem;
ysr@777 49 ConcurrentMark* _cm;
ysr@777 50 G1ParScanThreadState* _par_scan_state;
ysr@777 51 public:
ysr@777 52 G1ParClosureSuper(G1CollectedHeap* g1, G1ParScanThreadState* par_scan_state);
ysr@777 53 bool apply_to_weak_ref_discovered_field() { return true; }
ysr@777 54 };
ysr@777 55
iveresov@1696 56 class G1ParPushHeapRSClosure : public G1ParClosureSuper {
iveresov@1696 57 public:
iveresov@1696 58 G1ParPushHeapRSClosure(G1CollectedHeap* g1, G1ParScanThreadState* par_scan_state) :
iveresov@1696 59 G1ParClosureSuper(g1, par_scan_state) { }
iveresov@1696 60 template <class T> void do_oop_nv(T* p);
iveresov@1696 61 virtual void do_oop(oop* p) { do_oop_nv(p); }
iveresov@1696 62 virtual void do_oop(narrowOop* p) { do_oop_nv(p); }
iveresov@1696 63 };
iveresov@1696 64
ysr@777 65 class G1ParScanClosure : public G1ParClosureSuper {
ysr@777 66 public:
ysr@777 67 G1ParScanClosure(G1CollectedHeap* g1, G1ParScanThreadState* par_scan_state) :
ysr@777 68 G1ParClosureSuper(g1, par_scan_state) { }
ysr@1280 69 template <class T> void do_oop_nv(T* p);
ysr@777 70 virtual void do_oop(oop* p) { do_oop_nv(p); }
ysr@777 71 virtual void do_oop(narrowOop* p) { do_oop_nv(p); }
ysr@777 72 };
ysr@777 73
ysr@1280 74 #define G1_PARTIAL_ARRAY_MASK 0x2
ysr@777 75
ysr@1280 76 template <class T> inline bool has_partial_array_mask(T* ref) {
ysr@1280 77 return ((uintptr_t)ref & G1_PARTIAL_ARRAY_MASK) == G1_PARTIAL_ARRAY_MASK;
tonyp@961 78 }
tonyp@961 79
ysr@1280 80 template <class T> inline T* set_partial_array_mask(T obj) {
ysr@1280 81 assert(((uintptr_t)obj & G1_PARTIAL_ARRAY_MASK) == 0, "Information loss!");
ysr@1280 82 return (T*) ((uintptr_t)obj | G1_PARTIAL_ARRAY_MASK);
tonyp@961 83 }
tonyp@961 84
ysr@1280 85 template <class T> inline oop clear_partial_array_mask(T* ref) {
ysr@1280 86 return oop((intptr_t)ref & ~G1_PARTIAL_ARRAY_MASK);
tonyp@961 87 }
tonyp@961 88
ysr@777 89 class G1ParScanPartialArrayClosure : public G1ParClosureSuper {
ysr@777 90 G1ParScanClosure _scanner;
ysr@777 91 public:
ysr@777 92 G1ParScanPartialArrayClosure(G1CollectedHeap* g1, G1ParScanThreadState* par_scan_state) :
ysr@777 93 G1ParClosureSuper(g1, par_scan_state), _scanner(g1, par_scan_state) { }
ysr@1280 94 template <class T> void do_oop_nv(T* p);
ysr@777 95 virtual void do_oop(oop* p) { do_oop_nv(p); }
ysr@777 96 virtual void do_oop(narrowOop* p) { do_oop_nv(p); }
ysr@777 97 };
ysr@777 98
ysr@777 99
ysr@777 100 class G1ParCopyHelper : public G1ParClosureSuper {
ysr@777 101 G1ParScanClosure *_scanner;
ysr@777 102 protected:
ysr@1280 103 template <class T> void mark_forwardee(T* p);
ysr@777 104 oop copy_to_survivor_space(oop obj);
ysr@777 105 public:
ysr@777 106 G1ParCopyHelper(G1CollectedHeap* g1, G1ParScanThreadState* par_scan_state,
ysr@777 107 G1ParScanClosure *scanner) :
ysr@777 108 G1ParClosureSuper(g1, par_scan_state), _scanner(scanner) { }
ysr@777 109 };
ysr@777 110
tonyp@961 111 template<bool do_gen_barrier, G1Barrier barrier,
iveresov@1696 112 bool do_mark_forwardee>
ysr@777 113 class G1ParCopyClosure : public G1ParCopyHelper {
ysr@777 114 G1ParScanClosure _scanner;
ysr@1280 115 template <class T> void do_oop_work(T* p);
ysr@777 116 public:
ysr@777 117 G1ParCopyClosure(G1CollectedHeap* g1, G1ParScanThreadState* par_scan_state) :
ysr@777 118 _scanner(g1, par_scan_state), G1ParCopyHelper(g1, par_scan_state, &_scanner) { }
ysr@1280 119 template <class T> void do_oop_nv(T* p) {
ysr@777 120 do_oop_work(p);
ysr@777 121 if (do_mark_forwardee)
ysr@777 122 mark_forwardee(p);
ysr@777 123 }
ysr@777 124 virtual void do_oop(oop* p) { do_oop_nv(p); }
ysr@777 125 virtual void do_oop(narrowOop* p) { do_oop_nv(p); }
ysr@777 126 };
ysr@777 127
iveresov@1696 128 typedef G1ParCopyClosure<false, G1BarrierNone, false> G1ParScanExtRootClosure;
iveresov@1696 129 typedef G1ParCopyClosure<true, G1BarrierNone, false> G1ParScanPermClosure;
iveresov@1696 130 typedef G1ParCopyClosure<false, G1BarrierRS, false> G1ParScanHeapRSClosure;
iveresov@1696 131 typedef G1ParCopyClosure<false, G1BarrierNone, true> G1ParScanAndMarkExtRootClosure;
iveresov@1696 132 typedef G1ParCopyClosure<true, G1BarrierNone, true> G1ParScanAndMarkPermClosure;
iveresov@1696 133 typedef G1ParCopyClosure<false, G1BarrierRS, true> G1ParScanAndMarkHeapRSClosure;
iveresov@1696 134
tonyp@961 135 // This is the only case when we set skip_cset_test. Basically, this
tonyp@961 136 // closure is (should?) only be called directly while we're draining
tonyp@961 137 // the overflow and task queues. In that case we know that the
tonyp@961 138 // reference in question points into the collection set, otherwise we
ysr@1280 139 // would not have pushed it on the queue. The following is defined in
ysr@1280 140 // g1_specialized_oop_closures.hpp.
ysr@1280 141 // typedef G1ParCopyClosure<false, G1BarrierEvac, false, true> G1ParScanHeapEvacClosure;
tonyp@961 142 // We need a separate closure to handle references during evacuation
ysr@1280 143 // failure processing, as we cannot asume that the reference already
ysr@1280 144 // points into the collection set (like G1ParScanHeapEvacClosure does).
iveresov@1696 145 typedef G1ParCopyClosure<false, G1BarrierEvac, false> G1ParScanHeapEvacFailureClosure;
ysr@777 146
ysr@777 147 class FilterIntoCSClosure: public OopClosure {
ysr@777 148 G1CollectedHeap* _g1;
ysr@777 149 OopClosure* _oc;
ysr@777 150 DirtyCardToOopClosure* _dcto_cl;
ysr@777 151 public:
ysr@777 152 FilterIntoCSClosure( DirtyCardToOopClosure* dcto_cl,
ysr@777 153 G1CollectedHeap* g1, OopClosure* oc) :
ysr@777 154 _dcto_cl(dcto_cl), _g1(g1), _oc(oc)
ysr@777 155 {}
ysr@1280 156 template <class T> void do_oop_nv(T* p);
ysr@1280 157 virtual void do_oop(oop* p) { do_oop_nv(p); }
ysr@1280 158 virtual void do_oop(narrowOop* p) { do_oop_nv(p); }
ysr@777 159 bool apply_to_weak_ref_discovered_field() { return true; }
ysr@777 160 bool do_header() { return false; }
ysr@777 161 };
ysr@777 162
ysr@777 163 class FilterInHeapRegionAndIntoCSClosure : public OopsInHeapRegionClosure {
ysr@777 164 G1CollectedHeap* _g1;
ysr@777 165 OopsInHeapRegionClosure* _oc;
ysr@777 166 public:
ysr@777 167 FilterInHeapRegionAndIntoCSClosure(G1CollectedHeap* g1,
ysr@777 168 OopsInHeapRegionClosure* oc) :
ysr@777 169 _g1(g1), _oc(oc)
ysr@777 170 {}
ysr@1280 171 template <class T> void do_oop_nv(T* p);
ysr@1280 172 virtual void do_oop(oop* p) { do_oop_nv(p); }
ysr@1280 173 virtual void do_oop(narrowOop* p) { do_oop_nv(p); }
ysr@777 174 bool apply_to_weak_ref_discovered_field() { return true; }
ysr@777 175 bool do_header() { return false; }
ysr@777 176 void set_region(HeapRegion* from) {
ysr@777 177 _oc->set_region(from);
ysr@777 178 }
ysr@777 179 };
ysr@777 180
ysr@777 181 class FilterAndMarkInHeapRegionAndIntoCSClosure : public OopsInHeapRegionClosure {
ysr@777 182 G1CollectedHeap* _g1;
ysr@777 183 ConcurrentMark* _cm;
ysr@777 184 OopsInHeapRegionClosure* _oc;
ysr@777 185 public:
ysr@777 186 FilterAndMarkInHeapRegionAndIntoCSClosure(G1CollectedHeap* g1,
ysr@777 187 OopsInHeapRegionClosure* oc,
ysr@777 188 ConcurrentMark* cm)
ysr@777 189 : _g1(g1), _oc(oc), _cm(cm) { }
ysr@777 190
ysr@1280 191 template <class T> void do_oop_nv(T* p);
ysr@1280 192 virtual void do_oop(oop* p) { do_oop_nv(p); }
ysr@1280 193 virtual void do_oop(narrowOop* p) { do_oop_nv(p); }
ysr@777 194 bool apply_to_weak_ref_discovered_field() { return true; }
ysr@777 195 bool do_header() { return false; }
ysr@777 196 void set_region(HeapRegion* from) {
ysr@777 197 _oc->set_region(from);
ysr@777 198 }
ysr@777 199 };
ysr@777 200
ysr@777 201 class FilterOutOfRegionClosure: public OopClosure {
ysr@777 202 HeapWord* _r_bottom;
ysr@777 203 HeapWord* _r_end;
ysr@777 204 OopClosure* _oc;
ysr@777 205 int _out_of_region;
ysr@777 206 public:
ysr@777 207 FilterOutOfRegionClosure(HeapRegion* r, OopClosure* oc);
ysr@1280 208 template <class T> void do_oop_nv(T* p);
ysr@1280 209 virtual void do_oop(oop* p) { do_oop_nv(p); }
ysr@1280 210 virtual void do_oop(narrowOop* p) { do_oop_nv(p); }
ysr@777 211 bool apply_to_weak_ref_discovered_field() { return true; }
ysr@777 212 bool do_header() { return false; }
ysr@777 213 int out_of_region() { return _out_of_region; }
ysr@777 214 };

mercurial