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