author | tschatzl |
Wed, 13 Mar 2019 21:01:56 +0100 | |
changeset 54110 | f4f0dce5d0bb |
parent 53792 | 6fb43030a1b4 |
permissions | -rw-r--r-- |
1 | 1 |
/* |
53244
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
50752
diff
changeset
|
2 |
* Copyright (c) 2001, 2019, Oracle and/or its affiliates. All rights reserved. |
1 | 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 |
* |
|
5547
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
5076
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
5076
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
5076
diff
changeset
|
21 |
* questions. |
1 | 22 |
* |
23 |
*/ |
|
24 |
||
53244
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
50752
diff
changeset
|
25 |
#ifndef SHARE_GC_SHARED_GENOOPCLOSURES_HPP |
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
50752
diff
changeset
|
26 |
#define SHARE_GC_SHARED_GENOOPCLOSURES_HPP |
7397 | 27 |
|
28 |
#include "memory/iterator.hpp" |
|
29 |
#include "oops/oop.hpp" |
|
30 |
||
1 | 31 |
class Generation; |
32 |
class CardTableRS; |
|
49455
848864ed9b17
8199604: Rename CardTableModRefBS to CardTableBarrierSet
eosterlund
parents:
47580
diff
changeset
|
33 |
class CardTableBarrierSet; |
1 | 34 |
class DefNewGeneration; |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
35 |
class KlassRemSet; |
1 | 36 |
|
37 |
// Closure for iterating roots from a particular generation |
|
38 |
// Note: all classes deriving from this MUST call this do_barrier |
|
39 |
// method at the end of their own do_oop method! |
|
40 |
// Note: no do_oop defined, this is an abstract class. |
|
41 |
||
50752 | 42 |
class OopsInGenClosure : public OopIterateClosure { |
1 | 43 |
private: |
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
44 |
Generation* _orig_gen; // generation originally set in ctor |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
45 |
Generation* _gen; // generation being scanned |
1 | 46 |
|
47 |
protected: |
|
48 |
// Some subtypes need access. |
|
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
49 |
HeapWord* _gen_boundary; // start of generation |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
50 |
CardTableRS* _rs; // remembered set |
1 | 51 |
|
52 |
// For assertions |
|
53 |
Generation* generation() { return _gen; } |
|
54 |
CardTableRS* rs() { return _rs; } |
|
55 |
||
56 |
// Derived classes that modify oops so that they might be old-to-young |
|
57 |
// pointers must call the method below. |
|
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
58 |
template <class T> void do_barrier(T* p); |
1 | 59 |
|
1374
4c24294029a9
6711316: Open source the Garbage-First garbage collector
ysr
parents:
360
diff
changeset
|
60 |
// Version for use by closures that may be called in parallel code. |
3262
30d1c247fc25
6700789: G1: Enable use of compressed oops with G1 heaps
ysr
parents:
1388
diff
changeset
|
61 |
template <class T> void par_do_barrier(T* p); |
1374
4c24294029a9
6711316: Open source the Garbage-First garbage collector
ysr
parents:
360
diff
changeset
|
62 |
|
1 | 63 |
public: |
50752 | 64 |
OopsInGenClosure() : OopIterateClosure(NULL), |
1 | 65 |
_orig_gen(NULL), _gen(NULL), _gen_boundary(NULL), _rs(NULL) {}; |
66 |
||
67 |
OopsInGenClosure(Generation* gen); |
|
68 |
void set_generation(Generation* gen); |
|
69 |
||
70 |
void reset_generation() { _gen = _orig_gen; } |
|
71 |
||
72 |
// Problem with static closures: must have _gen_boundary set at some point, |
|
73 |
// but cannot do this until after the heap is initialized. |
|
74 |
void set_orig_generation(Generation* gen) { |
|
75 |
_orig_gen = gen; |
|
76 |
set_generation(gen); |
|
77 |
} |
|
78 |
||
79 |
HeapWord* gen_boundary() { return _gen_boundary; } |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
80 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
81 |
}; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
82 |
|
50752 | 83 |
class BasicOopsInGenClosure: public OopsInGenClosure { |
84 |
public: |
|
85 |
BasicOopsInGenClosure() : OopsInGenClosure() {} |
|
86 |
BasicOopsInGenClosure(Generation* gen); |
|
87 |
||
88 |
virtual bool do_metadata() { return false; } |
|
89 |
virtual void do_klass(Klass* k) { ShouldNotReachHere(); } |
|
90 |
virtual void do_cld(ClassLoaderData* cld) { ShouldNotReachHere(); } |
|
91 |
}; |
|
92 |
||
47580 | 93 |
// Super class for scan closures. It contains code to dirty scanned class loader data. |
50752 | 94 |
class OopsInClassLoaderDataOrGenClosure: public BasicOopsInGenClosure { |
47580 | 95 |
ClassLoaderData* _scanned_cld; |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
96 |
public: |
50752 | 97 |
OopsInClassLoaderDataOrGenClosure(Generation* g) : BasicOopsInGenClosure(g), _scanned_cld(NULL) {} |
47580 | 98 |
void set_scanned_cld(ClassLoaderData* cld) { |
99 |
assert(cld == NULL || _scanned_cld == NULL, "Must be"); |
|
100 |
_scanned_cld = cld; |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
101 |
} |
47580 | 102 |
bool is_scanning_a_cld() { return _scanned_cld != NULL; } |
103 |
void do_cld_barrier(); |
|
1 | 104 |
}; |
105 |
||
49982 | 106 |
#if INCLUDE_SERIALGC |
47580 | 107 |
|
1 | 108 |
// Closure for scanning DefNewGeneration. |
109 |
// |
|
110 |
// This closure will perform barrier store calls for ALL |
|
111 |
// pointers in scanned oops. |
|
47580 | 112 |
class ScanClosure: public OopsInClassLoaderDataOrGenClosure { |
50621
4216de02077e
8204538: Split ScanClosure and ScanClosureWithParBarrier
stefank
parents:
49982
diff
changeset
|
113 |
private: |
1 | 114 |
DefNewGeneration* _g; |
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
115 |
HeapWord* _boundary; |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
116 |
bool _gc_barrier; |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
117 |
template <class T> inline void do_oop_work(T* p); |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
118 |
public: |
1 | 119 |
ScanClosure(DefNewGeneration* g, bool gc_barrier); |
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
120 |
virtual void do_oop(oop* p); |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
121 |
virtual void do_oop(narrowOop* p); |
1 | 122 |
}; |
123 |
||
124 |
// Closure for scanning DefNewGeneration. |
|
125 |
// |
|
126 |
// This closure only performs barrier store calls on |
|
127 |
// pointers into the DefNewGeneration. This is less |
|
128 |
// precise, but faster, than a ScanClosure |
|
47580 | 129 |
class FastScanClosure: public OopsInClassLoaderDataOrGenClosure { |
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
130 |
protected: |
1 | 131 |
DefNewGeneration* _g; |
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
132 |
HeapWord* _boundary; |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
133 |
bool _gc_barrier; |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
134 |
template <class T> inline void do_oop_work(T* p); |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
135 |
public: |
1 | 136 |
FastScanClosure(DefNewGeneration* g, bool gc_barrier); |
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
137 |
virtual void do_oop(oop* p); |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
138 |
virtual void do_oop(narrowOop* p); |
1 | 139 |
}; |
140 |
||
49982 | 141 |
#endif // INCLUDE_SERIALGC |
142 |
||
47580 | 143 |
class CLDScanClosure: public CLDClosure { |
144 |
OopsInClassLoaderDataOrGenClosure* _scavenge_closure; |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
145 |
// true if the the modified oops state should be saved. |
47580 | 146 |
bool _accumulate_modified_oops; |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
147 |
public: |
47580 | 148 |
CLDScanClosure(OopsInClassLoaderDataOrGenClosure* scavenge_closure, |
149 |
bool accumulate_modified_oops) : |
|
150 |
_scavenge_closure(scavenge_closure), _accumulate_modified_oops(accumulate_modified_oops) {} |
|
151 |
void do_cld(ClassLoaderData* cld); |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
152 |
}; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
153 |
|
50752 | 154 |
class FilteringClosure: public OopIterateClosure { |
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
155 |
private: |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
156 |
HeapWord* _boundary; |
50752 | 157 |
OopIterateClosure* _cl; |
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
158 |
protected: |
35862
411842d0c882
8146395: Add inline qualifier in oop.hpp and fix inlining in gc files
goetz
parents:
33226
diff
changeset
|
159 |
template <class T> inline void do_oop_work(T* p); |
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
160 |
public: |
50752 | 161 |
FilteringClosure(HeapWord* boundary, OopIterateClosure* cl) : |
162 |
OopIterateClosure(cl->ref_discoverer()), _boundary(boundary), |
|
1 | 163 |
_cl(cl) {} |
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
164 |
virtual void do_oop(oop* p); |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
165 |
virtual void do_oop(narrowOop* p); |
50752 | 166 |
virtual bool do_metadata() { assert(!_cl->do_metadata(), "assumption broken, must change to 'return _cl->do_metadata()'"); return false; } |
167 |
virtual void do_klass(Klass*) { ShouldNotReachHere(); } |
|
168 |
virtual void do_cld(ClassLoaderData*) { ShouldNotReachHere(); } |
|
1 | 169 |
}; |
170 |
||
49982 | 171 |
#if INCLUDE_SERIALGC |
172 |
||
1 | 173 |
// Closure for scanning DefNewGeneration's weak references. |
174 |
// NOTE: very much like ScanClosure but not derived from |
|
175 |
// OopsInGenClosure -- weak references are processed all |
|
176 |
// at once, with no notion of which generation they were in. |
|
177 |
class ScanWeakRefClosure: public OopClosure { |
|
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
178 |
protected: |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
179 |
DefNewGeneration* _g; |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
180 |
HeapWord* _boundary; |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
181 |
template <class T> inline void do_oop_work(T* p); |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
182 |
public: |
1 | 183 |
ScanWeakRefClosure(DefNewGeneration* g); |
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
184 |
virtual void do_oop(oop* p); |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
185 |
virtual void do_oop(narrowOop* p); |
1 | 186 |
}; |
187 |
||
49982 | 188 |
#endif // INCLUDE_SERIALGC |
189 |
||
53244
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
50752
diff
changeset
|
190 |
#endif // SHARE_GC_SHARED_GENOOPCLOSURES_HPP |