author | goetz |
Mon, 18 Jan 2016 10:25:41 +0100 | |
changeset 35862 | 411842d0c882 |
parent 33226 | 19cb9b844190 |
permissions | -rw-r--r-- |
1 | 1 |
/* |
35862
411842d0c882
8146395: Add inline qualifier in oop.hpp and fix inlining in gc files
goetz
parents:
33226
diff
changeset
|
2 |
* Copyright (c) 2001, 2016, 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 |
||
30764 | 25 |
#ifndef SHARE_VM_GC_SHARED_GENOOPCLOSURES_HPP |
26 |
#define SHARE_VM_GC_SHARED_GENOOPCLOSURES_HPP |
|
7397 | 27 |
|
28 |
#include "memory/iterator.hpp" |
|
29 |
#include "oops/oop.hpp" |
|
30 |
||
1 | 31 |
class Generation; |
32 |
class HeapWord; |
|
33 |
class CardTableRS; |
|
34 |
class CardTableModRefBS; |
|
35 |
class DefNewGeneration; |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
36 |
class KlassRemSet; |
1 | 37 |
|
38 |
// Closure for iterating roots from a particular generation |
|
39 |
// Note: all classes deriving from this MUST call this do_barrier |
|
40 |
// method at the end of their own do_oop method! |
|
41 |
// Note: no do_oop defined, this is an abstract class. |
|
42 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
43 |
class OopsInGenClosure : public ExtendedOopClosure { |
1 | 44 |
private: |
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
45 |
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
|
46 |
Generation* _gen; // generation being scanned |
1 | 47 |
|
48 |
protected: |
|
49 |
// Some subtypes need access. |
|
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
50 |
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
|
51 |
CardTableRS* _rs; // remembered set |
1 | 52 |
|
53 |
// For assertions |
|
54 |
Generation* generation() { return _gen; } |
|
55 |
CardTableRS* rs() { return _rs; } |
|
56 |
||
57 |
// Derived classes that modify oops so that they might be old-to-young |
|
58 |
// 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
|
59 |
template <class T> void do_barrier(T* p); |
1 | 60 |
|
1374
4c24294029a9
6711316: Open source the Garbage-First garbage collector
ysr
parents:
360
diff
changeset
|
61 |
// 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
|
62 |
template <class T> void par_do_barrier(T* p); |
1374
4c24294029a9
6711316: Open source the Garbage-First garbage collector
ysr
parents:
360
diff
changeset
|
63 |
|
1 | 64 |
public: |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
65 |
OopsInGenClosure() : ExtendedOopClosure(NULL), |
1 | 66 |
_orig_gen(NULL), _gen(NULL), _gen_boundary(NULL), _rs(NULL) {}; |
67 |
||
68 |
OopsInGenClosure(Generation* gen); |
|
69 |
void set_generation(Generation* gen); |
|
70 |
||
71 |
void reset_generation() { _gen = _orig_gen; } |
|
72 |
||
73 |
// Problem with static closures: must have _gen_boundary set at some point, |
|
74 |
// but cannot do this until after the heap is initialized. |
|
75 |
void set_orig_generation(Generation* gen) { |
|
76 |
_orig_gen = gen; |
|
77 |
set_generation(gen); |
|
78 |
} |
|
79 |
||
80 |
HeapWord* gen_boundary() { return _gen_boundary; } |
|
13728
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 |
}; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
83 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
84 |
// Super class for scan closures. It contains code to dirty scanned Klasses. |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
85 |
class OopsInKlassOrGenClosure: public OopsInGenClosure { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
86 |
Klass* _scanned_klass; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
87 |
public: |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
88 |
OopsInKlassOrGenClosure(Generation* g) : OopsInGenClosure(g), _scanned_klass(NULL) {} |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
89 |
void set_scanned_klass(Klass* k) { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
90 |
assert(k == NULL || _scanned_klass == NULL, "Must be"); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
91 |
_scanned_klass = k; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
92 |
} |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
93 |
bool is_scanning_a_klass() { return _scanned_klass != NULL; } |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
94 |
void do_klass_barrier(); |
1 | 95 |
}; |
96 |
||
97 |
// Closure for scanning DefNewGeneration. |
|
98 |
// |
|
99 |
// This closure will perform barrier store calls for ALL |
|
100 |
// pointers in scanned oops. |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
101 |
class ScanClosure: public OopsInKlassOrGenClosure { |
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
102 |
protected: |
1 | 103 |
DefNewGeneration* _g; |
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
104 |
HeapWord* _boundary; |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
105 |
bool _gc_barrier; |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
106 |
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
|
107 |
public: |
1 | 108 |
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
|
109 |
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
|
110 |
virtual void do_oop(narrowOop* p); |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
111 |
inline void do_oop_nv(oop* p); |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
112 |
inline void do_oop_nv(narrowOop* p); |
1 | 113 |
}; |
114 |
||
115 |
// Closure for scanning DefNewGeneration. |
|
116 |
// |
|
117 |
// This closure only performs barrier store calls on |
|
118 |
// pointers into the DefNewGeneration. This is less |
|
119 |
// precise, but faster, than a ScanClosure |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
120 |
class FastScanClosure: public OopsInKlassOrGenClosure { |
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
121 |
protected: |
1 | 122 |
DefNewGeneration* _g; |
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
123 |
HeapWord* _boundary; |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
124 |
bool _gc_barrier; |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
125 |
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
|
126 |
public: |
1 | 127 |
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
|
128 |
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
|
129 |
virtual void do_oop(narrowOop* p); |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
130 |
inline void do_oop_nv(oop* p); |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
131 |
inline void do_oop_nv(narrowOop* p); |
1 | 132 |
}; |
133 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
134 |
class KlassScanClosure: public KlassClosure { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
135 |
OopsInKlassOrGenClosure* _scavenge_closure; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
136 |
// true if the the modified oops state should be saved. |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
137 |
bool _accumulate_modified_oops; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
138 |
public: |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
139 |
KlassScanClosure(OopsInKlassOrGenClosure* scavenge_closure, |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
140 |
KlassRemSet* klass_rem_set_policy); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
141 |
void do_klass(Klass* k); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
142 |
}; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
143 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
144 |
class FilteringClosure: public ExtendedOopClosure { |
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
145 |
private: |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
146 |
HeapWord* _boundary; |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
147 |
ExtendedOopClosure* _cl; |
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
148 |
protected: |
35862
411842d0c882
8146395: Add inline qualifier in oop.hpp and fix inlining in gc files
goetz
parents:
33226
diff
changeset
|
149 |
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
|
150 |
public: |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
151 |
FilteringClosure(HeapWord* boundary, ExtendedOopClosure* cl) : |
33226
19cb9b844190
8139341: Hide ExtendedOopClosure::_ref_processor
kbarrett
parents:
30878
diff
changeset
|
152 |
ExtendedOopClosure(cl->ref_processor()), _boundary(boundary), |
1 | 153 |
_cl(cl) {} |
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
154 |
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
|
155 |
virtual void do_oop(narrowOop* p); |
35862
411842d0c882
8146395: Add inline qualifier in oop.hpp and fix inlining in gc files
goetz
parents:
33226
diff
changeset
|
156 |
inline void do_oop_nv(oop* p); |
411842d0c882
8146395: Add inline qualifier in oop.hpp and fix inlining in gc files
goetz
parents:
33226
diff
changeset
|
157 |
inline void do_oop_nv(narrowOop* p); |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
158 |
virtual bool do_metadata() { return do_metadata_nv(); } |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
159 |
inline bool do_metadata_nv() { assert(!_cl->do_metadata(), "assumption broken, must change to 'return _cl->do_metadata()'"); return false; } |
1 | 160 |
}; |
161 |
||
162 |
// Closure for scanning DefNewGeneration's weak references. |
|
163 |
// NOTE: very much like ScanClosure but not derived from |
|
164 |
// OopsInGenClosure -- weak references are processed all |
|
165 |
// at once, with no notion of which generation they were in. |
|
166 |
class ScanWeakRefClosure: public OopClosure { |
|
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
167 |
protected: |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
168 |
DefNewGeneration* _g; |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
169 |
HeapWord* _boundary; |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
170 |
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
|
171 |
public: |
1 | 172 |
ScanWeakRefClosure(DefNewGeneration* g); |
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
173 |
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
|
174 |
virtual void do_oop(narrowOop* p); |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
175 |
inline void do_oop_nv(oop* p); |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
176 |
inline void do_oop_nv(narrowOop* p); |
1 | 177 |
}; |
178 |
||
30764 | 179 |
#endif // SHARE_VM_GC_SHARED_GENOOPCLOSURES_HPP |