Mercurial > hg > graal-compiler
comparison src/share/vm/oops/klass.hpp @ 6725:da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
Summary: Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
Contributed-by: jmasa <jon.masamitsu@oracle.com>, stefank <stefan.karlsson@oracle.com>, mgerdin <mikael.gerdin@oracle.com>, never <tom.rodriguez@oracle.com>
author | coleenp |
---|---|
date | Sat, 01 Sep 2012 13:25:18 -0400 |
parents | b632e80fc9dc |
children | e522a00b91aa 070d523b96a7 |
comparison
equal
deleted
inserted
replaced
6724:36d1d483d5d6 | 6725:da91efe96a93 |
---|---|
27 | 27 |
28 #include "memory/genOopClosures.hpp" | 28 #include "memory/genOopClosures.hpp" |
29 #include "memory/iterator.hpp" | 29 #include "memory/iterator.hpp" |
30 #include "memory/memRegion.hpp" | 30 #include "memory/memRegion.hpp" |
31 #include "memory/specialized_oop_closures.hpp" | 31 #include "memory/specialized_oop_closures.hpp" |
32 #include "oops/klassOop.hpp" | |
33 #include "oops/klassPS.hpp" | 32 #include "oops/klassPS.hpp" |
33 #include "oops/metadata.hpp" | |
34 #include "oops/oop.hpp" | 34 #include "oops/oop.hpp" |
35 #include "runtime/orderAccess.hpp" | 35 #include "runtime/orderAccess.hpp" |
36 #include "trace/traceMacros.hpp" | 36 #include "trace/traceMacros.hpp" |
37 #include "utilities/accessFlags.hpp" | 37 #include "utilities/accessFlags.hpp" |
38 #ifndef SERIALGC | 38 #ifndef SERIALGC |
39 #include "gc_implementation/concurrentMarkSweep/cmsOopClosures.hpp" | 39 #include "gc_implementation/concurrentMarkSweep/cmsOopClosures.hpp" |
40 #include "gc_implementation/g1/g1OopClosures.hpp" | 40 #include "gc_implementation/g1/g1OopClosures.hpp" |
41 #include "gc_implementation/parNew/parOopClosures.hpp" | 41 #include "gc_implementation/parNew/parOopClosures.hpp" |
42 #endif | 42 #endif |
43 | 43 |
44 // A Klass is the part of the klassOop that provides: | 44 // |
45 // A Klass provides: | |
45 // 1: language level class object (method dictionary etc.) | 46 // 1: language level class object (method dictionary etc.) |
46 // 2: provide vm dispatch behavior for the object | 47 // 2: provide vm dispatch behavior for the object |
47 // Both functions are combined into one C++ class. The toplevel class "Klass" | 48 // Both functions are combined into one C++ class. |
48 // implements purpose 1 whereas all subclasses provide extra virtual functions | |
49 // for purpose 2. | |
50 | 49 |
51 // One reason for the oop/klass dichotomy in the implementation is | 50 // One reason for the oop/klass dichotomy in the implementation is |
52 // that we don't want a C++ vtbl pointer in every object. Thus, | 51 // that we don't want a C++ vtbl pointer in every object. Thus, |
53 // normal oops don't have any virtual functions. Instead, they | 52 // normal oops don't have any virtual functions. Instead, they |
54 // forward all "virtual" functions to their klass, which does have | 53 // forward all "virtual" functions to their klass, which does have |
55 // a vtbl and does the C++ dispatch depending on the object's | 54 // a vtbl and does the C++ dispatch depending on the object's |
56 // actual type. (See oop.inline.hpp for some of the forwarding code.) | 55 // actual type. (See oop.inline.hpp for some of the forwarding code.) |
57 // ALL FUNCTIONS IMPLEMENTING THIS DISPATCH ARE PREFIXED WITH "oop_"! | 56 // ALL FUNCTIONS IMPLEMENTING THIS DISPATCH ARE PREFIXED WITH "oop_"! |
58 | 57 |
59 // Klass layout: | 58 // Klass layout: |
60 // [header ] klassOop | 59 // [C++ vtbl ptr ] (contained in Metadata) |
61 // [klass pointer ] klassOop | |
62 // [C++ vtbl ptr ] (contained in Klass_vtbl) | |
63 // [layout_helper ] | 60 // [layout_helper ] |
64 // [super_check_offset ] for fast subtype checks | 61 // [super_check_offset ] for fast subtype checks |
62 // [name ] | |
65 // [secondary_super_cache] for fast subtype checks | 63 // [secondary_super_cache] for fast subtype checks |
66 // [secondary_supers ] array of 2ndary supertypes | 64 // [secondary_supers ] array of 2ndary supertypes |
67 // [primary_supers 0] | 65 // [primary_supers 0] |
68 // [primary_supers 1] | 66 // [primary_supers 1] |
69 // [primary_supers 2] | 67 // [primary_supers 2] |
70 // ... | 68 // ... |
71 // [primary_supers 7] | 69 // [primary_supers 7] |
72 // [java_mirror ] | 70 // [java_mirror ] |
73 // [super ] | 71 // [super ] |
74 // [name ] | 72 // [subklass ] first subclass |
75 // [first subklass] | |
76 // [next_sibling ] link to chain additional subklasses | 73 // [next_sibling ] link to chain additional subklasses |
74 // [next_link ] | |
75 // [class_loader_data] | |
77 // [modifier_flags] | 76 // [modifier_flags] |
78 // [access_flags ] | 77 // [access_flags ] |
79 // [verify_count ] - not in product | 78 // [verify_count ] - not in product |
80 // [alloc_count ] | 79 // [alloc_count ] |
81 // [last_biased_lock_bulk_revocation_time] (64 bits) | 80 // [last_biased_lock_bulk_revocation_time] (64 bits) |
82 // [prototype_header] | 81 // [prototype_header] |
83 // [biased_lock_revocation_count] | 82 // [biased_lock_revocation_count] |
83 // [_modified_oops] | |
84 // [_accumulated_modified_oops] | |
84 // [trace_id] | 85 // [trace_id] |
85 | 86 |
86 | 87 |
87 // Forward declarations. | 88 // Forward declarations. |
89 template <class T> class Array; | |
90 template <class T> class GrowableArray; | |
91 class ClassLoaderData; | |
88 class klassVtable; | 92 class klassVtable; |
89 class KlassHandle; | 93 class ParCompactionManager; |
90 class OrderAccess; | 94 |
91 | 95 class Klass : public Metadata { |
92 // Holder (or cage) for the C++ vtable of each kind of Klass. | |
93 // We want to tightly constrain the location of the C++ vtable in the overall layout. | |
94 class Klass_vtbl { | |
95 protected: | |
96 // The following virtual exists only to force creation of a C++ vtable, | |
97 // so that this class truly is the location of the vtable of all Klasses. | |
98 virtual void unused_initial_virtual() { } | |
99 | |
100 public: | |
101 // The following virtual makes Klass_vtbl play a second role as a | |
102 // factory protocol for subclasses of Klass ("sub-Klasses"). | |
103 // Here's how it works.... | |
104 // | |
105 // This VM uses metaobjects as factories for their instances. | |
106 // | |
107 // In order to initialize the C++ vtable of a new instance, its | |
108 // metaobject is forced to use the C++ placed new operator to | |
109 // allocate the instance. In a typical C++-based system, each | |
110 // sub-class would have its own factory routine which | |
111 // directly uses the placed new operator on the desired class, | |
112 // and then calls the appropriate chain of C++ constructors. | |
113 // | |
114 // However, this system uses shared code to performs the first | |
115 // allocation and initialization steps for all sub-Klasses. | |
116 // (See base_create_klass() and base_create_array_klass().) | |
117 // This does not factor neatly into a hierarchy of C++ constructors. | |
118 // Each caller of these shared "base_create" routines knows | |
119 // exactly which sub-Klass it is creating, but the shared routine | |
120 // does not, even though it must perform the actual allocation. | |
121 // | |
122 // Therefore, the caller of the shared "base_create" must wrap | |
123 // the specific placed new call in a virtual function which | |
124 // performs the actual allocation and vtable set-up. That | |
125 // virtual function is here, Klass_vtbl::allocate_permanent. | |
126 // | |
127 // The arguments to Universe::allocate_permanent() are passed | |
128 // straight through the placed new operator, which in turn | |
129 // obtains them directly from this virtual call. | |
130 // | |
131 // This virtual is called on a temporary "example instance" of the | |
132 // sub-Klass being instantiated, a C++ auto variable. The "real" | |
133 // instance created by this virtual is on the VM heap, where it is | |
134 // equipped with a klassOopDesc header. | |
135 // | |
136 // It is merely an accident of implementation that we use "example | |
137 // instances", but that is why the virtual function which implements | |
138 // each sub-Klass factory happens to be defined by the same sub-Klass | |
139 // for which it creates instances. | |
140 // | |
141 // The vtbl_value() call (see below) is used to strip away the | |
142 // accidental Klass-ness from an "example instance" and present it as | |
143 // a factory. Think of each factory object as a mere container of the | |
144 // C++ vtable for the desired sub-Klass. Since C++ does not allow | |
145 // direct references to vtables, the factory must also be delegated | |
146 // the task of allocating the instance, but the essential point is | |
147 // that the factory knows how to initialize the C++ vtable with the | |
148 // right pointer value. All other common initializations are handled | |
149 // by the shared "base_create" subroutines. | |
150 // | |
151 virtual void* allocate_permanent(KlassHandle& klass, int size, TRAPS) const = 0; | |
152 void post_new_init_klass(KlassHandle& klass, klassOop obj) const; | |
153 | |
154 // Every subclass on which vtbl_value is called must include this macro. | |
155 // Delay the installation of the klassKlass pointer until after the | |
156 // the vtable for a new klass has been installed (after the call to new()). | |
157 #define DEFINE_ALLOCATE_PERMANENT(thisKlass) \ | |
158 void* allocate_permanent(KlassHandle& klass_klass, int size, TRAPS) const { \ | |
159 void* result = new(klass_klass, size, THREAD) thisKlass(); \ | |
160 if (HAS_PENDING_EXCEPTION) return NULL; \ | |
161 klassOop new_klass = ((Klass*) result)->as_klassOop(); \ | |
162 OrderAccess::storestore(); \ | |
163 post_new_init_klass(klass_klass, new_klass); \ | |
164 return result; \ | |
165 } | |
166 | |
167 bool null_vtbl() { return *(intptr_t*)this == 0; } | |
168 | |
169 protected: | |
170 void* operator new(size_t ignored, KlassHandle& klass, int size, TRAPS); | |
171 }; | |
172 | |
173 | |
174 class Klass : public Klass_vtbl { | |
175 friend class VMStructs; | 96 friend class VMStructs; |
176 protected: | 97 protected: |
177 // note: put frequently-used fields together at start of klass structure | 98 // note: put frequently-used fields together at start of klass structure |
178 // for better cache behavior (may not make much of a difference but sure won't hurt) | 99 // for better cache behavior (may not make much of a difference but sure won't hurt) |
179 enum { _primary_super_limit = 8 }; | 100 enum { _primary_super_limit = 8 }; |
200 // The esz bits can be used directly by a SLL instruction, without masking. | 121 // The esz bits can be used directly by a SLL instruction, without masking. |
201 // | 122 // |
202 // Note that the array-kind tag looks like 0x00 for instance klasses, | 123 // Note that the array-kind tag looks like 0x00 for instance klasses, |
203 // since their length in bytes is always less than 24Mb. | 124 // since their length in bytes is always less than 24Mb. |
204 // | 125 // |
205 // Final note: This comes first, immediately after Klass_vtbl, | 126 // Final note: This comes first, immediately after C++ vtable, |
206 // because it is frequently queried. | 127 // because it is frequently queried. |
207 jint _layout_helper; | 128 jint _layout_helper; |
208 | 129 |
209 // The fields _super_check_offset, _secondary_super_cache, _secondary_supers | 130 // The fields _super_check_offset, _secondary_super_cache, _secondary_supers |
210 // and _primary_supers all help make fast subtype checks. See big discussion | 131 // and _primary_supers all help make fast subtype checks. See big discussion |
216 | 137 |
217 // Class name. Instance classes: java/lang/String, etc. Array classes: [I, | 138 // Class name. Instance classes: java/lang/String, etc. Array classes: [I, |
218 // [Ljava/lang/String;, etc. Set to zero for all other kinds of classes. | 139 // [Ljava/lang/String;, etc. Set to zero for all other kinds of classes. |
219 Symbol* _name; | 140 Symbol* _name; |
220 | 141 |
221 public: | |
222 oop* oop_block_beg() const { return adr_secondary_super_cache(); } | |
223 oop* oop_block_end() const { return adr_next_sibling() + 1; } | |
224 | |
225 protected: | |
226 // | |
227 // The oop block. All oop fields must be declared here and only oop fields | |
228 // may be declared here. In addition, the first and last fields in this block | |
229 // must remain first and last, unless oop_block_beg() and/or oop_block_end() | |
230 // are updated. Grouping the oop fields in a single block simplifies oop | |
231 // iteration. | |
232 // | |
233 | |
234 // Cache of last observed secondary supertype | 142 // Cache of last observed secondary supertype |
235 klassOop _secondary_super_cache; | 143 Klass* _secondary_super_cache; |
236 // Array of all secondary supertypes | 144 // Array of all secondary supertypes |
237 objArrayOop _secondary_supers; | 145 Array<Klass*>* _secondary_supers; |
238 // Ordered list of all primary supertypes | 146 // Ordered list of all primary supertypes |
239 klassOop _primary_supers[_primary_super_limit]; | 147 Klass* _primary_supers[_primary_super_limit]; |
240 // java/lang/Class instance mirroring this class | 148 // java/lang/Class instance mirroring this class |
241 oop _java_mirror; | 149 oop _java_mirror; |
242 // Superclass | 150 // Superclass |
243 klassOop _super; | 151 Klass* _super; |
244 // First subclass (NULL if none); _subklass->next_sibling() is next one | 152 // First subclass (NULL if none); _subklass->next_sibling() is next one |
245 klassOop _subklass; | 153 Klass* _subklass; |
246 // Sibling link (or NULL); links all subklasses of a klass | 154 // Sibling link (or NULL); links all subklasses of a klass |
247 klassOop _next_sibling; | 155 Klass* _next_sibling; |
248 | 156 |
249 // | 157 // All klasses loaded by a class loader are chained through these links |
250 // End of the oop block. | 158 Klass* _next_link; |
251 // | 159 |
160 // The VM's representation of the ClassLoader used to load this class. | |
161 // Provide access the corresponding instance java.lang.ClassLoader. | |
162 ClassLoaderData* _class_loader_data; | |
252 | 163 |
253 jint _modifier_flags; // Processed access flags, for use by Class.getModifiers. | 164 jint _modifier_flags; // Processed access flags, for use by Class.getModifiers. |
254 AccessFlags _access_flags; // Access flags. The class/interface distinction is stored here. | 165 AccessFlags _access_flags; // Access flags. The class/interface distinction is stored here. |
255 | 166 |
256 #ifndef PRODUCT | 167 #ifndef PRODUCT |
257 int _verify_count; // to avoid redundant verifies | 168 int _verify_count; // to avoid redundant verifies |
258 #endif | 169 #endif |
259 | 170 |
260 juint _alloc_count; // allocation profiling support - update klass_size_in_bytes() if moved/deleted | 171 juint _alloc_count; // allocation profiling support |
261 | 172 |
262 // Biased locking implementation and statistics | 173 // Biased locking implementation and statistics |
263 // (the 64-bit chunk goes first, to avoid some fragmentation) | 174 // (the 64-bit chunk goes first, to avoid some fragmentation) |
264 jlong _last_biased_lock_bulk_revocation_time; | 175 jlong _last_biased_lock_bulk_revocation_time; |
265 markOop _prototype_header; // Used when biased locking is both enabled and disabled for this type | 176 markOop _prototype_header; // Used when biased locking is both enabled and disabled for this type |
266 jint _biased_lock_revocation_count; | 177 jint _biased_lock_revocation_count; |
267 | 178 |
268 TRACE_DEFINE_KLASS_TRACE_ID; | 179 TRACE_DEFINE_KLASS_TRACE_ID; |
269 public: | 180 |
270 | 181 // Remembered sets support for the oops in the klasses. |
271 // returns the enclosing klassOop | 182 jbyte _modified_oops; // Card Table Equivalent (YC/CMS support) |
272 klassOop as_klassOop() const { | 183 jbyte _accumulated_modified_oops; // Mod Union Equivalent (CMS support) |
273 // see klassOop.hpp for layout. | 184 |
274 return (klassOop) (((char*) this) - sizeof(klassOopDesc)); | 185 // Constructor |
275 } | 186 Klass(); |
276 | 187 |
277 public: | 188 void* operator new(size_t size, ClassLoaderData* loader_data, size_t word_size, TRAPS); |
278 // Allocation | 189 |
279 const Klass_vtbl& vtbl_value() const { return *this; } // used only on "example instances" | 190 public: |
280 static KlassHandle base_create_klass(KlassHandle& klass, int size, const Klass_vtbl& vtbl, TRAPS); | 191 bool is_klass() const volatile { return true; } |
281 static klassOop base_create_klass_oop(KlassHandle& klass, int size, const Klass_vtbl& vtbl, TRAPS); | |
282 | 192 |
283 // super | 193 // super |
284 klassOop super() const { return _super; } | 194 Klass* super() const { return _super; } |
285 void set_super(klassOop k) { oop_store_without_check((oop*) &_super, (oop) k); } | 195 void set_super(Klass* k) { _super = k; } |
286 | 196 |
287 // initializes _super link, _primary_supers & _secondary_supers arrays | 197 // initializes _super link, _primary_supers & _secondary_supers arrays |
288 void initialize_supers(klassOop k, TRAPS); | 198 void initialize_supers(Klass* k, TRAPS); |
289 void initialize_supers_impl1(klassOop k); | 199 void initialize_supers_impl1(Klass* k); |
290 void initialize_supers_impl2(klassOop k); | 200 void initialize_supers_impl2(Klass* k); |
291 | 201 |
292 // klass-specific helper for initializing _secondary_supers | 202 // klass-specific helper for initializing _secondary_supers |
293 virtual objArrayOop compute_secondary_supers(int num_extra_slots, TRAPS); | 203 virtual GrowableArray<Klass*>* compute_secondary_supers(int num_extra_slots); |
294 | 204 |
295 // java_super is the Java-level super type as specified by Class.getSuperClass. | 205 // java_super is the Java-level super type as specified by Class.getSuperClass. |
296 virtual klassOop java_super() const { return NULL; } | 206 virtual Klass* java_super() const { return NULL; } |
297 | 207 |
298 juint super_check_offset() const { return _super_check_offset; } | 208 juint super_check_offset() const { return _super_check_offset; } |
299 void set_super_check_offset(juint o) { _super_check_offset = o; } | 209 void set_super_check_offset(juint o) { _super_check_offset = o; } |
300 | 210 |
301 klassOop secondary_super_cache() const { return _secondary_super_cache; } | 211 Klass* secondary_super_cache() const { return _secondary_super_cache; } |
302 void set_secondary_super_cache(klassOop k) { oop_store_without_check((oop*) &_secondary_super_cache, (oop) k); } | 212 void set_secondary_super_cache(Klass* k) { _secondary_super_cache = k; } |
303 | 213 |
304 objArrayOop secondary_supers() const { return _secondary_supers; } | 214 Array<Klass*>* secondary_supers() const { return _secondary_supers; } |
305 void set_secondary_supers(objArrayOop k) { oop_store_without_check((oop*) &_secondary_supers, (oop) k); } | 215 void set_secondary_supers(Array<Klass*>* k) { _secondary_supers = k; } |
306 | 216 |
307 // Return the element of the _super chain of the given depth. | 217 // Return the element of the _super chain of the given depth. |
308 // If there is no such element, return either NULL or this. | 218 // If there is no such element, return either NULL or this. |
309 klassOop primary_super_of_depth(juint i) const { | 219 Klass* primary_super_of_depth(juint i) const { |
310 assert(i < primary_super_limit(), "oob"); | 220 assert(i < primary_super_limit(), "oob"); |
311 klassOop super = _primary_supers[i]; | 221 Klass* super = _primary_supers[i]; |
312 assert(super == NULL || super->klass_part()->super_depth() == i, "correct display"); | 222 assert(super == NULL || super->super_depth() == i, "correct display"); |
313 return super; | 223 return super; |
314 } | 224 } |
315 | 225 |
316 // Can this klass be a primary super? False for interfaces and arrays of | 226 // Can this klass be a primary super? False for interfaces and arrays of |
317 // interfaces. False also for arrays or classes with long super chains. | 227 // interfaces. False also for arrays or classes with long super chains. |
324 // Returns number of primary supers; may be a number in the inclusive range [0, primary_super_limit]. | 234 // Returns number of primary supers; may be a number in the inclusive range [0, primary_super_limit]. |
325 juint super_depth() const { | 235 juint super_depth() const { |
326 if (!can_be_primary_super()) { | 236 if (!can_be_primary_super()) { |
327 return primary_super_limit(); | 237 return primary_super_limit(); |
328 } else { | 238 } else { |
329 juint d = (super_check_offset() - in_bytes(primary_supers_offset())) / sizeof(klassOop); | 239 juint d = (super_check_offset() - in_bytes(primary_supers_offset())) / sizeof(Klass*); |
330 assert(d < primary_super_limit(), "oob"); | 240 assert(d < primary_super_limit(), "oob"); |
331 assert(_primary_supers[d] == as_klassOop(), "proper init"); | 241 assert(_primary_supers[d] == this, "proper init"); |
332 return d; | 242 return d; |
333 } | 243 } |
334 } | 244 } |
335 | 245 |
246 // store an oop into a field of a Klass | |
247 void klass_oop_store(oop* p, oop v); | |
248 void klass_oop_store(volatile oop* p, oop v); | |
249 | |
336 // java mirror | 250 // java mirror |
337 oop java_mirror() const { return _java_mirror; } | 251 oop java_mirror() const { return _java_mirror; } |
338 void set_java_mirror(oop m) { oop_store((oop*) &_java_mirror, m); } | 252 void set_java_mirror(oop m) { klass_oop_store(&_java_mirror, m); } |
339 | 253 |
340 // modifier flags | 254 // modifier flags |
341 jint modifier_flags() const { return _modifier_flags; } | 255 jint modifier_flags() const { return _modifier_flags; } |
342 void set_modifier_flags(jint flags) { _modifier_flags = flags; } | 256 void set_modifier_flags(jint flags) { _modifier_flags = flags; } |
343 | 257 |
344 // size helper | 258 // size helper |
345 int layout_helper() const { return _layout_helper; } | 259 int layout_helper() const { return _layout_helper; } |
346 void set_layout_helper(int lh) { _layout_helper = lh; } | 260 void set_layout_helper(int lh) { _layout_helper = lh; } |
347 | 261 |
348 // Note: for instances layout_helper() may include padding. | 262 // Note: for instances layout_helper() may include padding. |
349 // Use instanceKlass::contains_field_offset to classify field offsets. | 263 // Use InstanceKlass::contains_field_offset to classify field offsets. |
350 | 264 |
351 // sub/superklass links | 265 // sub/superklass links |
352 instanceKlass* superklass() const; | 266 InstanceKlass* superklass() const; |
353 Klass* subklass() const; | 267 Klass* subklass() const; |
354 Klass* next_sibling() const; | 268 Klass* next_sibling() const; |
355 void append_to_sibling_list(); // add newly created receiver to superklass' subklass list | 269 void append_to_sibling_list(); // add newly created receiver to superklass' subklass list |
356 void remove_from_sibling_list(); // remove receiver from sibling list | 270 void remove_from_sibling_list(); // remove receiver from sibling list |
271 | |
272 void set_next_link(Klass* k) { _next_link = k; } | |
273 Klass* next_link() const { return _next_link; } // The next klass defined by the class loader. | |
274 | |
275 // class loader data | |
276 ClassLoaderData* class_loader_data() const { return _class_loader_data; } | |
277 void set_class_loader_data(ClassLoaderData* loader_data) { _class_loader_data = loader_data; } | |
278 | |
279 // The Klasses are not placed in the Heap, so the Card Table or | |
280 // the Mod Union Table can't be used to mark when klasses have modified oops. | |
281 // The CT and MUT bits saves this information for the individual Klasses. | |
282 void record_modified_oops() { _modified_oops = 1; } | |
283 void clear_modified_oops() { _modified_oops = 0; } | |
284 bool has_modified_oops() { return _modified_oops == 1; } | |
285 | |
286 void accumulate_modified_oops() { if (has_modified_oops()) _accumulated_modified_oops = 1; } | |
287 void clear_accumulated_modified_oops() { _accumulated_modified_oops = 0; } | |
288 bool has_accumulated_modified_oops() { return _accumulated_modified_oops == 1; } | |
289 | |
357 protected: // internal accessors | 290 protected: // internal accessors |
358 klassOop subklass_oop() const { return _subklass; } | 291 Klass* subklass_oop() const { return _subklass; } |
359 klassOop next_sibling_oop() const { return _next_sibling; } | 292 Klass* next_sibling_oop() const { return _next_sibling; } |
360 void set_subklass(klassOop s); | 293 void set_subklass(Klass* s); |
361 void set_next_sibling(klassOop s); | 294 void set_next_sibling(Klass* s); |
362 | |
363 oop* adr_super() const { return (oop*)&_super; } | |
364 oop* adr_primary_supers() const { return (oop*)&_primary_supers[0]; } | |
365 oop* adr_secondary_super_cache() const { return (oop*)&_secondary_super_cache; } | |
366 oop* adr_secondary_supers()const { return (oop*)&_secondary_supers; } | |
367 oop* adr_java_mirror() const { return (oop*)&_java_mirror; } | |
368 oop* adr_subklass() const { return (oop*)&_subklass; } | |
369 oop* adr_next_sibling() const { return (oop*)&_next_sibling; } | |
370 | 295 |
371 public: | 296 public: |
372 // Allocation profiling support | 297 // Allocation profiling support |
373 juint alloc_count() const { return _alloc_count; } | 298 juint alloc_count() const { return _alloc_count; } |
374 void set_alloc_count(juint n) { _alloc_count = n; } | 299 void set_alloc_count(juint n) { _alloc_count = n; } |
375 virtual juint alloc_size() const = 0; | 300 virtual juint alloc_size() const = 0; |
376 virtual void set_alloc_size(juint n) = 0; | 301 virtual void set_alloc_size(juint n) = 0; |
377 | 302 |
378 // Compiler support | 303 // Compiler support |
379 static ByteSize super_offset() { return in_ByteSize(sizeof(klassOopDesc) + offset_of(Klass, _super)); } | 304 static ByteSize super_offset() { return in_ByteSize(offset_of(Klass, _super)); } |
380 static ByteSize super_check_offset_offset() { return in_ByteSize(sizeof(klassOopDesc) + offset_of(Klass, _super_check_offset)); } | 305 static ByteSize super_check_offset_offset() { return in_ByteSize(offset_of(Klass, _super_check_offset)); } |
381 static ByteSize primary_supers_offset() { return in_ByteSize(sizeof(klassOopDesc) + offset_of(Klass, _primary_supers)); } | 306 static ByteSize primary_supers_offset() { return in_ByteSize(offset_of(Klass, _primary_supers)); } |
382 static ByteSize secondary_super_cache_offset() { return in_ByteSize(sizeof(klassOopDesc) + offset_of(Klass, _secondary_super_cache)); } | 307 static ByteSize secondary_super_cache_offset() { return in_ByteSize(offset_of(Klass, _secondary_super_cache)); } |
383 static ByteSize secondary_supers_offset() { return in_ByteSize(sizeof(klassOopDesc) + offset_of(Klass, _secondary_supers)); } | 308 static ByteSize secondary_supers_offset() { return in_ByteSize(offset_of(Klass, _secondary_supers)); } |
384 static ByteSize java_mirror_offset() { return in_ByteSize(sizeof(klassOopDesc) + offset_of(Klass, _java_mirror)); } | 309 static ByteSize java_mirror_offset() { return in_ByteSize(offset_of(Klass, _java_mirror)); } |
385 static ByteSize modifier_flags_offset() { return in_ByteSize(sizeof(klassOopDesc) + offset_of(Klass, _modifier_flags)); } | 310 static ByteSize modifier_flags_offset() { return in_ByteSize(offset_of(Klass, _modifier_flags)); } |
386 static ByteSize layout_helper_offset() { return in_ByteSize(sizeof(klassOopDesc) + offset_of(Klass, _layout_helper)); } | 311 static ByteSize layout_helper_offset() { return in_ByteSize(offset_of(Klass, _layout_helper)); } |
387 static ByteSize access_flags_offset() { return in_ByteSize(sizeof(klassOopDesc) + offset_of(Klass, _access_flags)); } | 312 static ByteSize access_flags_offset() { return in_ByteSize(offset_of(Klass, _access_flags)); } |
388 | 313 |
389 // Unpacking layout_helper: | 314 // Unpacking layout_helper: |
390 enum { | 315 enum { |
391 _lh_neutral_value = 0, // neutral non-array non-instance value | 316 _lh_neutral_value = 0, // neutral non-array non-instance value |
392 _lh_instance_slow_path_bit = 0x01, | 317 _lh_instance_slow_path_bit = 0x01, |
411 return (lh & _lh_instance_slow_path_bit) != 0; | 336 return (lh & _lh_instance_slow_path_bit) != 0; |
412 } | 337 } |
413 static bool layout_helper_is_instance(jint lh) { | 338 static bool layout_helper_is_instance(jint lh) { |
414 return (jint)lh > (jint)_lh_neutral_value; | 339 return (jint)lh > (jint)_lh_neutral_value; |
415 } | 340 } |
416 static bool layout_helper_is_javaArray(jint lh) { | 341 static bool layout_helper_is_array(jint lh) { |
417 return (jint)lh < (jint)_lh_neutral_value; | 342 return (jint)lh < (jint)_lh_neutral_value; |
418 } | 343 } |
419 static bool layout_helper_is_typeArray(jint lh) { | 344 static bool layout_helper_is_typeArray(jint lh) { |
420 // _lh_array_tag_type_value == (lh >> _lh_array_tag_shift); | 345 // _lh_array_tag_type_value == (lh >> _lh_array_tag_shift); |
421 return (juint)lh >= (juint)(_lh_array_tag_type_value << _lh_array_tag_shift); | 346 return (juint)lh >= (juint)(_lh_array_tag_type_value << _lh_array_tag_shift); |
471 #endif | 396 #endif |
472 | 397 |
473 // vtables | 398 // vtables |
474 virtual klassVtable* vtable() const { return NULL; } | 399 virtual klassVtable* vtable() const { return NULL; } |
475 | 400 |
476 static int klass_size_in_bytes() { return offset_of(Klass, _alloc_count) + sizeof(juint); } // all "visible" fields | |
477 | |
478 // subclass check | 401 // subclass check |
479 bool is_subclass_of(klassOop k) const; | 402 bool is_subclass_of(Klass* k) const; |
480 // subtype check: true if is_subclass_of, or if k is interface and receiver implements it | 403 // subtype check: true if is_subclass_of, or if k is interface and receiver implements it |
481 bool is_subtype_of(klassOop k) const { | 404 bool is_subtype_of(Klass* k) const { |
482 juint off = k->klass_part()->super_check_offset(); | 405 juint off = k->super_check_offset(); |
483 klassOop sup = *(klassOop*)( (address)as_klassOop() + off ); | 406 Klass* sup = *(Klass**)( (address)this + off ); |
484 const juint secondary_offset = in_bytes(secondary_super_cache_offset()); | 407 const juint secondary_offset = in_bytes(secondary_super_cache_offset()); |
485 if (sup == k) { | 408 if (sup == k) { |
486 return true; | 409 return true; |
487 } else if (off != secondary_offset) { | 410 } else if (off != secondary_offset) { |
488 return false; | 411 return false; |
489 } else { | 412 } else { |
490 return search_secondary_supers(k); | 413 return search_secondary_supers(k); |
491 } | 414 } |
492 } | 415 } |
493 bool search_secondary_supers(klassOop k) const; | 416 bool search_secondary_supers(Klass* k) const; |
494 | 417 |
495 // Find LCA in class hierarchy | 418 // Find LCA in class hierarchy |
496 Klass *LCA( Klass *k ); | 419 Klass *LCA( Klass *k ); |
497 | 420 |
498 // Check whether reflection/jni/jvm code is allowed to instantiate this class; | 421 // Check whether reflection/jni/jvm code is allowed to instantiate this class; |
499 // if not, throw either an Error or an Exception. | 422 // if not, throw either an Error or an Exception. |
500 virtual void check_valid_for_instantiation(bool throwError, TRAPS); | 423 virtual void check_valid_for_instantiation(bool throwError, TRAPS); |
501 | 424 |
502 // Casting | 425 // Casting |
503 static Klass* cast(klassOop k) { | 426 static Klass* cast(Klass* k) { |
504 assert(k->is_klass(), "cast to Klass"); | 427 assert(k->is_klass(), "cast to Klass"); |
505 return k->klass_part(); | 428 return k; |
506 } | 429 } |
507 | 430 |
508 // array copying | 431 // array copying |
509 virtual void copy_array(arrayOop s, int src_pos, arrayOop d, int dst_pos, int length, TRAPS); | 432 virtual void copy_array(arrayOop s, int src_pos, arrayOop d, int dst_pos, int length, TRAPS); |
510 | 433 |
512 virtual bool should_be_initialized() const { return false; } | 435 virtual bool should_be_initialized() const { return false; } |
513 // initializes the klass | 436 // initializes the klass |
514 virtual void initialize(TRAPS); | 437 virtual void initialize(TRAPS); |
515 // lookup operation for MethodLookupCache | 438 // lookup operation for MethodLookupCache |
516 friend class MethodLookupCache; | 439 friend class MethodLookupCache; |
517 virtual methodOop uncached_lookup_method(Symbol* name, Symbol* signature) const; | 440 virtual Method* uncached_lookup_method(Symbol* name, Symbol* signature) const; |
518 public: | 441 public: |
519 methodOop lookup_method(Symbol* name, Symbol* signature) const { | 442 Method* lookup_method(Symbol* name, Symbol* signature) const { |
520 return uncached_lookup_method(name, signature); | 443 return uncached_lookup_method(name, signature); |
521 } | 444 } |
522 | 445 |
523 // array class with specific rank | 446 // array class with specific rank |
524 klassOop array_klass(int rank, TRAPS) { return array_klass_impl(false, rank, THREAD); } | 447 Klass* array_klass(int rank, TRAPS) { return array_klass_impl(false, rank, THREAD); } |
525 | 448 |
526 // array class with this klass as element type | 449 // array class with this klass as element type |
527 klassOop array_klass(TRAPS) { return array_klass_impl(false, THREAD); } | 450 Klass* array_klass(TRAPS) { return array_klass_impl(false, THREAD); } |
528 | 451 |
529 // These will return NULL instead of allocating on the heap: | 452 // These will return NULL instead of allocating on the heap: |
530 // NB: these can block for a mutex, like other functions with TRAPS arg. | 453 // NB: these can block for a mutex, like other functions with TRAPS arg. |
531 klassOop array_klass_or_null(int rank); | 454 Klass* array_klass_or_null(int rank); |
532 klassOop array_klass_or_null(); | 455 Klass* array_klass_or_null(); |
533 | 456 |
534 virtual oop protection_domain() { return NULL; } | 457 virtual oop protection_domain() { return NULL; } |
535 virtual oop class_loader() const { return NULL; } | 458 |
459 oop class_loader() const; | |
536 | 460 |
537 protected: | 461 protected: |
538 virtual klassOop array_klass_impl(bool or_null, int rank, TRAPS); | 462 virtual Klass* array_klass_impl(bool or_null, int rank, TRAPS); |
539 virtual klassOop array_klass_impl(bool or_null, TRAPS); | 463 virtual Klass* array_klass_impl(bool or_null, TRAPS); |
540 | 464 |
541 public: | 465 public: |
466 // CDS support - remove and restore oops from metadata. Oops are not shared. | |
542 virtual void remove_unshareable_info(); | 467 virtual void remove_unshareable_info(); |
543 virtual void shared_symbols_iterate(SymbolClosure* closure); | 468 virtual void restore_unshareable_info(TRAPS); |
544 | 469 |
545 protected: | 470 protected: |
546 // computes the subtype relationship | 471 // computes the subtype relationship |
547 virtual bool compute_is_subtype_of(klassOop k); | 472 virtual bool compute_is_subtype_of(Klass* k); |
548 public: | 473 public: |
549 // subclass accessor (here for convenience; undefined for non-klass objects) | 474 // subclass accessor (here for convenience; undefined for non-klass objects) |
550 virtual bool is_leaf_class() const { fatal("not a class"); return false; } | 475 virtual bool is_leaf_class() const { fatal("not a class"); return false; } |
551 public: | 476 public: |
552 // ALL FUNCTIONS BELOW THIS POINT ARE DISPATCHED FROM AN OOP | 477 // ALL FUNCTIONS BELOW THIS POINT ARE DISPATCHED FROM AN OOP |
553 // These functions describe behavior for the oop not the KLASS. | 478 // These functions describe behavior for the oop not the KLASS. |
554 | 479 |
555 // actual oop size of obj in memory | 480 // actual oop size of obj in memory |
556 virtual int oop_size(oop obj) const = 0; | 481 virtual int oop_size(oop obj) const = 0; |
557 | 482 |
558 // actual oop size of this klass in memory | 483 // Size of klass in word size. |
559 virtual int klass_oop_size() const = 0; | 484 virtual int size() const = 0; |
560 | 485 |
561 // Returns the Java name for a class (Resource allocated) | 486 // Returns the Java name for a class (Resource allocated) |
562 // For arrays, this returns the name of the element with a leading '['. | 487 // For arrays, this returns the name of the element with a leading '['. |
563 // For classes, this returns the name with the package separators | 488 // For classes, this returns the name with the package separators |
564 // turned into '.'s. | 489 // turned into '.'s. |
575 virtual int oop_adjust_pointers(oop obj) = 0; | 500 virtual int oop_adjust_pointers(oop obj) = 0; |
576 | 501 |
577 // Parallel Scavenge and Parallel Old | 502 // Parallel Scavenge and Parallel Old |
578 PARALLEL_GC_DECLS_PV | 503 PARALLEL_GC_DECLS_PV |
579 | 504 |
580 public: | |
581 // type testing operations | 505 // type testing operations |
506 protected: | |
582 virtual bool oop_is_instance_slow() const { return false; } | 507 virtual bool oop_is_instance_slow() const { return false; } |
508 virtual bool oop_is_array_slow() const { return false; } | |
509 virtual bool oop_is_objArray_slow() const { return false; } | |
510 virtual bool oop_is_typeArray_slow() const { return false; } | |
511 public: | |
583 virtual bool oop_is_instanceMirror() const { return false; } | 512 virtual bool oop_is_instanceMirror() const { return false; } |
584 virtual bool oop_is_instanceRef() const { return false; } | 513 virtual bool oop_is_instanceRef() const { return false; } |
585 virtual bool oop_is_array() const { return false; } | 514 |
586 virtual bool oop_is_objArray_slow() const { return false; } | 515 // Fast non-virtual versions |
587 virtual bool oop_is_klass() const { return false; } | |
588 virtual bool oop_is_thread() const { return false; } | |
589 virtual bool oop_is_method() const { return false; } | |
590 virtual bool oop_is_constMethod() const { return false; } | |
591 virtual bool oop_is_methodData() const { return false; } | |
592 virtual bool oop_is_constantPool() const { return false; } | |
593 virtual bool oop_is_constantPoolCache() const { return false; } | |
594 virtual bool oop_is_typeArray_slow() const { return false; } | |
595 virtual bool oop_is_arrayKlass() const { return false; } | |
596 virtual bool oop_is_objArrayKlass() const { return false; } | |
597 virtual bool oop_is_typeArrayKlass() const { return false; } | |
598 virtual bool oop_is_compiledICHolder() const { return false; } | |
599 virtual bool oop_is_instanceKlass() const { return false; } | |
600 | |
601 bool oop_is_javaArray_slow() const { | |
602 return oop_is_objArray_slow() || oop_is_typeArray_slow(); | |
603 } | |
604 | |
605 // Fast non-virtual versions, used by oop.inline.hpp and elsewhere: | |
606 #ifndef ASSERT | 516 #ifndef ASSERT |
607 #define assert_same_query(xval, xcheck) xval | 517 #define assert_same_query(xval, xcheck) xval |
608 #else | 518 #else |
609 private: | 519 private: |
610 static bool assert_same_query(bool xval, bool xslow) { | 520 static bool assert_same_query(bool xval, bool xslow) { |
614 public: | 524 public: |
615 #endif | 525 #endif |
616 inline bool oop_is_instance() const { return assert_same_query( | 526 inline bool oop_is_instance() const { return assert_same_query( |
617 layout_helper_is_instance(layout_helper()), | 527 layout_helper_is_instance(layout_helper()), |
618 oop_is_instance_slow()); } | 528 oop_is_instance_slow()); } |
619 inline bool oop_is_javaArray() const { return assert_same_query( | 529 inline bool oop_is_array() const { return assert_same_query( |
620 layout_helper_is_javaArray(layout_helper()), | 530 layout_helper_is_array(layout_helper()), |
621 oop_is_javaArray_slow()); } | 531 oop_is_array_slow()); } |
622 inline bool oop_is_objArray() const { return assert_same_query( | 532 inline bool oop_is_objArray() const { return assert_same_query( |
623 layout_helper_is_objArray(layout_helper()), | 533 layout_helper_is_objArray(layout_helper()), |
624 oop_is_objArray_slow()); } | 534 oop_is_objArray_slow()); } |
625 inline bool oop_is_typeArray() const { return assert_same_query( | 535 inline bool oop_is_typeArray() const { return assert_same_query( |
626 layout_helper_is_typeArray(layout_helper()), | 536 layout_helper_is_typeArray(layout_helper()), |
627 oop_is_typeArray_slow()); } | 537 oop_is_typeArray_slow()); } |
628 #undef assert_same_query | 538 #undef assert_same_query |
629 | |
630 // Unless overridden, oop is parsable if it has a klass pointer. | |
631 // Parsability of an object is object specific. | |
632 virtual bool oop_is_parsable(oop obj) const { return true; } | |
633 | |
634 // Unless overridden, oop is safe for concurrent GC processing | |
635 // after its allocation is complete. The exception to | |
636 // this is the case where objects are changed after allocation. | |
637 // Class redefinition is one of the known exceptions. During | |
638 // class redefinition, an allocated class can changed in order | |
639 // order to create a merged class (the combiniation of the | |
640 // old class definition that has to be perserved and the new class | |
641 // definition which is being created. | |
642 virtual bool oop_is_conc_safe(oop obj) const { return true; } | |
643 | 539 |
644 // Access flags | 540 // Access flags |
645 AccessFlags access_flags() const { return _access_flags; } | 541 AccessFlags access_flags() const { return _access_flags; } |
646 void set_access_flags(AccessFlags flags) { _access_flags = flags; } | 542 void set_access_flags(AccessFlags flags) { _access_flags = flags; } |
647 | 543 |
675 // reason why it could not be done for arrayKlasses aside from | 571 // reason why it could not be done for arrayKlasses aside from |
676 // wanting to reduce the initial scope of this optimization. There | 572 // wanting to reduce the initial scope of this optimization. There |
677 // are potential problems in setting the bias pattern for | 573 // are potential problems in setting the bias pattern for |
678 // JVM-internal oops. | 574 // JVM-internal oops. |
679 inline void set_prototype_header(markOop header); | 575 inline void set_prototype_header(markOop header); |
680 static ByteSize prototype_header_offset() { return in_ByteSize(sizeof(klassOopDesc) + offset_of(Klass, _prototype_header)); } | 576 static ByteSize prototype_header_offset() { return in_ByteSize(offset_of(Klass, _prototype_header)); } |
681 | 577 |
682 int biased_lock_revocation_count() const { return (int) _biased_lock_revocation_count; } | 578 int biased_lock_revocation_count() const { return (int) _biased_lock_revocation_count; } |
683 // Atomically increments biased_lock_revocation_count and returns updated value | 579 // Atomically increments biased_lock_revocation_count and returns updated value |
684 int atomic_incr_biased_lock_revocation_count(); | 580 int atomic_incr_biased_lock_revocation_count(); |
685 void set_biased_lock_revocation_count(int val) { _biased_lock_revocation_count = (jint) val; } | 581 void set_biased_lock_revocation_count(int val) { _biased_lock_revocation_count = (jint) val; } |
687 void set_last_biased_lock_bulk_revocation_time(jlong cur_time) { _last_biased_lock_bulk_revocation_time = cur_time; } | 583 void set_last_biased_lock_bulk_revocation_time(jlong cur_time) { _last_biased_lock_bulk_revocation_time = cur_time; } |
688 | 584 |
689 TRACE_DEFINE_KLASS_METHODS; | 585 TRACE_DEFINE_KLASS_METHODS; |
690 | 586 |
691 // garbage collection support | 587 // garbage collection support |
692 virtual void follow_weak_klass_links( | 588 virtual void oops_do(OopClosure* cl); |
693 BoolObjectClosure* is_alive, OopClosure* keep_alive); | 589 |
590 // Checks if the class loader is alive. | |
591 // Iff the class loader is alive the Klass is considered alive. | |
592 // The is_alive closure passed in depends on the Garbage Collector used. | |
593 bool is_loader_alive(BoolObjectClosure* is_alive); | |
594 | |
595 static void clean_weak_klass_links(BoolObjectClosure* is_alive); | |
694 | 596 |
695 // Prefetch within oop iterators. This is a macro because we | 597 // Prefetch within oop iterators. This is a macro because we |
696 // can't guarantee that the compiler will inline it. In 64-bit | 598 // can't guarantee that the compiler will inline it. In 64-bit |
697 // it generally doesn't. Signature is | 599 // it generally doesn't. Signature is |
698 // | 600 // |
721 } \ | 623 } \ |
722 } \ | 624 } \ |
723 } | 625 } |
724 | 626 |
725 // iterators | 627 // iterators |
726 virtual int oop_oop_iterate(oop obj, OopClosure* blk) = 0; | 628 virtual int oop_oop_iterate(oop obj, ExtendedOopClosure* blk) = 0; |
727 virtual int oop_oop_iterate_v(oop obj, OopClosure* blk) { | 629 virtual int oop_oop_iterate_v(oop obj, ExtendedOopClosure* blk) { |
728 return oop_oop_iterate(obj, blk); | 630 return oop_oop_iterate(obj, blk); |
729 } | 631 } |
730 | 632 |
731 #ifndef SERIALGC | 633 #ifndef SERIALGC |
732 // In case we don't have a specialized backward scanner use forward | 634 // In case we don't have a specialized backward scanner use forward |
733 // iteration. | 635 // iteration. |
734 virtual int oop_oop_iterate_backwards_v(oop obj, OopClosure* blk) { | 636 virtual int oop_oop_iterate_backwards_v(oop obj, ExtendedOopClosure* blk) { |
735 return oop_oop_iterate_v(obj, blk); | 637 return oop_oop_iterate_v(obj, blk); |
736 } | 638 } |
737 #endif // !SERIALGC | 639 #endif // !SERIALGC |
738 | 640 |
739 // Iterates "blk" over all the oops in "obj" (of type "this") within "mr". | 641 // Iterates "blk" over all the oops in "obj" (of type "this") within "mr". |
740 // (I don't see why the _m should be required, but without it the Solaris | 642 // (I don't see why the _m should be required, but without it the Solaris |
741 // C++ gives warning messages about overridings of the "oop_oop_iterate" | 643 // C++ gives warning messages about overridings of the "oop_oop_iterate" |
742 // defined above "hiding" this virtual function. (DLD, 6/20/00)) */ | 644 // defined above "hiding" this virtual function. (DLD, 6/20/00)) */ |
743 virtual int oop_oop_iterate_m(oop obj, OopClosure* blk, MemRegion mr) = 0; | 645 virtual int oop_oop_iterate_m(oop obj, ExtendedOopClosure* blk, MemRegion mr) = 0; |
744 virtual int oop_oop_iterate_v_m(oop obj, OopClosure* blk, MemRegion mr) { | 646 virtual int oop_oop_iterate_v_m(oop obj, ExtendedOopClosure* blk, MemRegion mr) { |
745 return oop_oop_iterate_m(obj, blk, mr); | 647 return oop_oop_iterate_m(obj, blk, mr); |
746 } | 648 } |
747 | 649 |
748 // Versions of the above iterators specialized to particular subtypes | 650 // Versions of the above iterators specialized to particular subtypes |
749 // of OopClosure, to avoid closure virtual calls. | 651 // of OopClosure, to avoid closure virtual calls. |
776 | 678 |
777 SPECIALIZED_OOP_OOP_ITERATE_CLOSURES_1(Klass_OOP_OOP_ITERATE_BACKWARDS_DECL) | 679 SPECIALIZED_OOP_OOP_ITERATE_CLOSURES_1(Klass_OOP_OOP_ITERATE_BACKWARDS_DECL) |
778 SPECIALIZED_OOP_OOP_ITERATE_CLOSURES_2(Klass_OOP_OOP_ITERATE_BACKWARDS_DECL) | 680 SPECIALIZED_OOP_OOP_ITERATE_CLOSURES_2(Klass_OOP_OOP_ITERATE_BACKWARDS_DECL) |
779 #endif // !SERIALGC | 681 #endif // !SERIALGC |
780 | 682 |
781 virtual void array_klasses_do(void f(klassOop k)) {} | 683 virtual void array_klasses_do(void f(Klass* k)) {} |
782 virtual void with_array_klasses_do(void f(klassOop k)); | 684 virtual void with_array_klasses_do(void f(Klass* k)); |
783 | 685 |
784 // Return self, except for abstract classes with exactly 1 | 686 // Return self, except for abstract classes with exactly 1 |
785 // implementor. Then return the 1 concrete implementation. | 687 // implementor. Then return the 1 concrete implementation. |
786 Klass *up_cast_abstract(); | 688 Klass *up_cast_abstract(); |
787 | 689 |
788 // klass name | 690 // klass name |
789 Symbol* name() const { return _name; } | 691 Symbol* name() const { return _name; } |
790 void set_name(Symbol* n); | 692 void set_name(Symbol* n); |
791 | 693 |
792 friend class klassKlass; | |
793 | |
794 public: | 694 public: |
795 // jvm support | 695 // jvm support |
796 virtual jint compute_modifier_flags(TRAPS) const; | 696 virtual jint compute_modifier_flags(TRAPS) const; |
797 | 697 |
798 // JVMTI support | 698 // JVMTI support |
799 virtual jint jvmti_class_status() const; | 699 virtual jint jvmti_class_status() const; |
800 | 700 |
801 // Printing | 701 // Printing |
702 virtual void print_on(outputStream* st) const; | |
703 | |
802 virtual void oop_print_value_on(oop obj, outputStream* st); | 704 virtual void oop_print_value_on(oop obj, outputStream* st); |
803 virtual void oop_print_on (oop obj, outputStream* st); | 705 virtual void oop_print_on (oop obj, outputStream* st); |
804 | 706 |
707 virtual const char* internal_name() const = 0; | |
708 | |
805 // Verification | 709 // Verification |
806 virtual const char* internal_name() const = 0; | 710 virtual void verify_on(outputStream* st); |
807 virtual void oop_verify_on(oop obj, outputStream* st); | 711 void verify() { verify_on(tty); } |
808 // tells whether obj is partially constructed (gc during class loading) | |
809 virtual bool oop_partially_loaded(oop obj) const { return false; } | |
810 virtual void oop_set_partially_loaded(oop obj) {}; | |
811 | 712 |
812 #ifndef PRODUCT | 713 #ifndef PRODUCT |
813 void verify_vtable_index(int index); | 714 void verify_vtable_index(int index); |
814 #endif | 715 #endif |
716 | |
717 virtual void oop_verify_on(oop obj, outputStream* st); | |
718 | |
719 private: | |
720 // barriers used by klass_oop_store | |
721 void klass_update_barrier_set(oop v); | |
722 void klass_update_barrier_set_pre(void* p, oop v); | |
815 }; | 723 }; |
816 | 724 |
817 | |
818 inline oop klassOopDesc::java_mirror() const { return klass_part()->java_mirror(); } | |
819 | |
820 | |
821 #endif // SHARE_VM_OOPS_KLASS_HPP | 725 #endif // SHARE_VM_OOPS_KLASS_HPP |