Mercurial > hg > graal-compiler
annotate src/share/vm/oops/klass.hpp @ 4844:bf864f701a4a
7066129: GarbageCollectorMXBean#getLastGcInfo leaks native memory
Summary: Make GCStatInfo a resource object
Reviewed-by: phh, coleenp
author | dsamersoff |
---|---|
date | Wed, 25 Jan 2012 02:29:05 +0400 |
parents | 4f3ce9284781 |
children | 34e2e90e7182 |
rev | line source |
---|---|
0 | 1 /* |
2376
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
2177
diff
changeset
|
2 * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. |
0 | 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:
1155
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1155
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:
1155
diff
changeset
|
21 * questions. |
0 | 22 * |
23 */ | |
24 | |
1972 | 25 #ifndef SHARE_VM_OOPS_KLASS_HPP |
26 #define SHARE_VM_OOPS_KLASS_HPP | |
27 | |
28 #include "memory/genOopClosures.hpp" | |
29 #include "memory/iterator.hpp" | |
30 #include "memory/memRegion.hpp" | |
31 #include "memory/specialized_oop_closures.hpp" | |
32 #include "oops/klassOop.hpp" | |
33 #include "oops/klassPS.hpp" | |
34 #include "oops/oop.hpp" | |
35 #include "runtime/orderAccess.hpp" | |
4800
94ec88ca68e2
7115199: Add event tracing hooks and Java Flight Recorder infrastructure
phh
parents:
2376
diff
changeset
|
36 #include "trace/traceMacros.hpp" |
1972 | 37 #include "utilities/accessFlags.hpp" |
38 #ifndef SERIALGC | |
39 #include "gc_implementation/concurrentMarkSweep/cmsOopClosures.hpp" | |
40 #include "gc_implementation/g1/g1OopClosures.hpp" | |
41 #include "gc_implementation/parNew/parOopClosures.hpp" | |
42 #endif | |
43 | |
0 | 44 // A Klass is the part of the klassOop that provides: |
45 // 1: language level class object (method dictionary etc.) | |
46 // 2: provide vm dispatch behavior for the object | |
47 // Both functions are combined into one C++ class. The toplevel class "Klass" | |
48 // implements purpose 1 whereas all subclasses provide extra virtual functions | |
49 // for purpose 2. | |
50 | |
51 // 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, | |
53 // normal oops don't have any virtual functions. Instead, they | |
54 // forward all "virtual" functions to their klass, which does have | |
55 // 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.) | |
57 // ALL FUNCTIONS IMPLEMENTING THIS DISPATCH ARE PREFIXED WITH "oop_"! | |
58 | |
59 // Klass layout: | |
60 // [header ] klassOop | |
61 // [klass pointer ] klassOop | |
62 // [C++ vtbl ptr ] (contained in Klass_vtbl) | |
63 // [layout_helper ] | |
64 // [super_check_offset ] for fast subtype checks | |
65 // [secondary_super_cache] for fast subtype checks | |
66 // [secondary_supers ] array of 2ndary supertypes | |
67 // [primary_supers 0] | |
68 // [primary_supers 1] | |
69 // [primary_supers 2] | |
70 // ... | |
71 // [primary_supers 7] | |
72 // [java_mirror ] | |
73 // [super ] | |
74 // [name ] | |
75 // [first subklass] | |
76 // [next_sibling ] link to chain additional subklasses | |
77 // [modifier_flags] | |
78 // [access_flags ] | |
79 // [verify_count ] - not in product | |
80 // [alloc_count ] | |
81 // [last_biased_lock_bulk_revocation_time] (64 bits) | |
82 // [prototype_header] | |
83 // [biased_lock_revocation_count] | |
4800
94ec88ca68e2
7115199: Add event tracing hooks and Java Flight Recorder infrastructure
phh
parents:
2376
diff
changeset
|
84 // [trace_id] |
0 | 85 |
86 | |
87 // Forward declarations. | |
88 class klassVtable; | |
89 class KlassHandle; | |
90 class OrderAccess; | |
91 | |
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, int size) 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()). | |
342
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
113
diff
changeset
|
157 #define DEFINE_ALLOCATE_PERMANENT(thisKlass) \ |
0 | 158 void* allocate_permanent(KlassHandle& klass_klass, int size, TRAPS) const { \ |
342
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
113
diff
changeset
|
159 void* result = new(klass_klass, size, THREAD) thisKlass(); \ |
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
113
diff
changeset
|
160 if (HAS_PENDING_EXCEPTION) return NULL; \ |
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
113
diff
changeset
|
161 klassOop new_klass = ((Klass*) result)->as_klassOop(); \ |
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
113
diff
changeset
|
162 OrderAccess::storestore(); \ |
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
113
diff
changeset
|
163 post_new_init_klass(klass_klass, new_klass, size); \ |
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
113
diff
changeset
|
164 return result; \ |
0 | 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; | |
176 protected: | |
177 // 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) | |
179 enum { _primary_super_limit = 8 }; | |
180 | |
181 // The "layout helper" is a combined descriptor of object layout. | |
182 // For klasses which are neither instance nor array, the value is zero. | |
183 // | |
184 // For instances, layout helper is a positive number, the instance size. | |
185 // This size is already passed through align_object_size and scaled to bytes. | |
186 // The low order bit is set if instances of this class cannot be | |
187 // allocated using the fastpath. | |
188 // | |
189 // For arrays, layout helper is a negative number, containing four | |
190 // distinct bytes, as follows: | |
191 // MSB:[tag, hsz, ebt, log2(esz)]:LSB | |
192 // where: | |
193 // tag is 0x80 if the elements are oops, 0xC0 if non-oops | |
194 // hsz is array header size in bytes (i.e., offset of first element) | |
195 // ebt is the BasicType of the elements | |
196 // esz is the element size in bytes | |
197 // This packed word is arranged so as to be quickly unpacked by the | |
198 // various fast paths that use the various subfields. | |
199 // | |
200 // The esz bits can be used directly by a SLL instruction, without masking. | |
201 // | |
202 // Note that the array-kind tag looks like 0x00 for instance klasses, | |
203 // since their length in bytes is always less than 24Mb. | |
204 // | |
205 // Final note: This comes first, immediately after Klass_vtbl, | |
206 // because it is frequently queried. | |
207 jint _layout_helper; | |
208 | |
209 // The fields _super_check_offset, _secondary_super_cache, _secondary_supers | |
210 // and _primary_supers all help make fast subtype checks. See big discussion | |
211 // in doc/server_compiler/checktype.txt | |
212 // | |
213 // Where to look to observe a supertype (it is &_secondary_super_cache for | |
214 // secondary supers, else is &_primary_supers[depth()]. | |
215 juint _super_check_offset; | |
216 | |
2177
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
1972
diff
changeset
|
217 // Class name. Instance classes: java/lang/String, etc. Array classes: [I, |
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
1972
diff
changeset
|
218 // [Ljava/lang/String;, etc. Set to zero for all other kinds of classes. |
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
1972
diff
changeset
|
219 Symbol* _name; |
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
1972
diff
changeset
|
220 |
0 | 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 | |
235 klassOop _secondary_super_cache; | |
236 // Array of all secondary supertypes | |
237 objArrayOop _secondary_supers; | |
238 // Ordered list of all primary supertypes | |
239 klassOop _primary_supers[_primary_super_limit]; | |
240 // java/lang/Class instance mirroring this class | |
241 oop _java_mirror; | |
242 // Superclass | |
243 klassOop _super; | |
244 // First subclass (NULL if none); _subklass->next_sibling() is next one | |
245 klassOop _subklass; | |
246 // Sibling link (or NULL); links all subklasses of a klass | |
247 klassOop _next_sibling; | |
248 | |
249 // | |
250 // End of the oop block. | |
251 // | |
252 | |
253 jint _modifier_flags; // Processed access flags, for use by Class.getModifiers. | |
254 AccessFlags _access_flags; // Access flags. The class/interface distinction is stored here. | |
255 | |
256 #ifndef PRODUCT | |
257 int _verify_count; // to avoid redundant verifies | |
258 #endif | |
259 | |
260 juint _alloc_count; // allocation profiling support - update klass_size_in_bytes() if moved/deleted | |
261 | |
262 // Biased locking implementation and statistics | |
263 // (the 64-bit chunk goes first, to avoid some fragmentation) | |
264 jlong _last_biased_lock_bulk_revocation_time; | |
265 markOop _prototype_header; // Used when biased locking is both enabled and disabled for this type | |
266 jint _biased_lock_revocation_count; | |
267 | |
4800
94ec88ca68e2
7115199: Add event tracing hooks and Java Flight Recorder infrastructure
phh
parents:
2376
diff
changeset
|
268 #ifdef TRACE_DEFINE_KLASS_TRACE_ID |
94ec88ca68e2
7115199: Add event tracing hooks and Java Flight Recorder infrastructure
phh
parents:
2376
diff
changeset
|
269 TRACE_DEFINE_KLASS_TRACE_ID; |
94ec88ca68e2
7115199: Add event tracing hooks and Java Flight Recorder infrastructure
phh
parents:
2376
diff
changeset
|
270 #endif |
0 | 271 public: |
272 | |
273 // returns the enclosing klassOop | |
274 klassOop as_klassOop() const { | |
275 // see klassOop.hpp for layout. | |
276 return (klassOop) (((char*) this) - sizeof(klassOopDesc)); | |
277 } | |
278 | |
279 public: | |
280 // Allocation | |
281 const Klass_vtbl& vtbl_value() const { return *this; } // used only on "example instances" | |
282 static KlassHandle base_create_klass(KlassHandle& klass, int size, const Klass_vtbl& vtbl, TRAPS); | |
283 static klassOop base_create_klass_oop(KlassHandle& klass, int size, const Klass_vtbl& vtbl, TRAPS); | |
284 | |
285 // super | |
286 klassOop super() const { return _super; } | |
287 void set_super(klassOop k) { oop_store_without_check((oop*) &_super, (oop) k); } | |
288 | |
289 // initializes _super link, _primary_supers & _secondary_supers arrays | |
290 void initialize_supers(klassOop k, TRAPS); | |
291 void initialize_supers_impl1(klassOop k); | |
292 void initialize_supers_impl2(klassOop k); | |
293 | |
294 // klass-specific helper for initializing _secondary_supers | |
295 virtual objArrayOop compute_secondary_supers(int num_extra_slots, TRAPS); | |
296 | |
297 // java_super is the Java-level super type as specified by Class.getSuperClass. | |
298 virtual klassOop java_super() const { return NULL; } | |
299 | |
300 juint super_check_offset() const { return _super_check_offset; } | |
301 void set_super_check_offset(juint o) { _super_check_offset = o; } | |
302 | |
303 klassOop secondary_super_cache() const { return _secondary_super_cache; } | |
304 void set_secondary_super_cache(klassOop k) { oop_store_without_check((oop*) &_secondary_super_cache, (oop) k); } | |
305 | |
306 objArrayOop secondary_supers() const { return _secondary_supers; } | |
307 void set_secondary_supers(objArrayOop k) { oop_store_without_check((oop*) &_secondary_supers, (oop) k); } | |
308 | |
309 // Return the element of the _super chain of the given depth. | |
310 // If there is no such element, return either NULL or this. | |
311 klassOop primary_super_of_depth(juint i) const { | |
312 assert(i < primary_super_limit(), "oob"); | |
313 klassOop super = _primary_supers[i]; | |
314 assert(super == NULL || super->klass_part()->super_depth() == i, "correct display"); | |
315 return super; | |
316 } | |
317 | |
318 // Can this klass be a primary super? False for interfaces and arrays of | |
319 // interfaces. False also for arrays or classes with long super chains. | |
320 bool can_be_primary_super() const { | |
4762
069ab3f976d3
7118863: Move sizeof(klassOopDesc) into the *Klass::*_offset_in_bytes() functions
stefank
parents:
2376
diff
changeset
|
321 const juint secondary_offset = in_bytes(secondary_super_cache_offset()); |
0 | 322 return super_check_offset() != secondary_offset; |
323 } | |
324 virtual bool can_be_primary_super_slow() const; | |
325 | |
326 // Returns number of primary supers; may be a number in the inclusive range [0, primary_super_limit]. | |
327 juint super_depth() const { | |
328 if (!can_be_primary_super()) { | |
329 return primary_super_limit(); | |
330 } else { | |
4762
069ab3f976d3
7118863: Move sizeof(klassOopDesc) into the *Klass::*_offset_in_bytes() functions
stefank
parents:
2376
diff
changeset
|
331 juint d = (super_check_offset() - in_bytes(primary_supers_offset())) / sizeof(klassOop); |
0 | 332 assert(d < primary_super_limit(), "oob"); |
333 assert(_primary_supers[d] == as_klassOop(), "proper init"); | |
334 return d; | |
335 } | |
336 } | |
337 | |
338 // java mirror | |
339 oop java_mirror() const { return _java_mirror; } | |
340 void set_java_mirror(oop m) { oop_store((oop*) &_java_mirror, m); } | |
341 | |
342 // modifier flags | |
343 jint modifier_flags() const { return _modifier_flags; } | |
344 void set_modifier_flags(jint flags) { _modifier_flags = flags; } | |
345 | |
346 // size helper | |
347 int layout_helper() const { return _layout_helper; } | |
348 void set_layout_helper(int lh) { _layout_helper = lh; } | |
349 | |
350 // Note: for instances layout_helper() may include padding. | |
351 // Use instanceKlass::contains_field_offset to classify field offsets. | |
352 | |
353 // sub/superklass links | |
354 instanceKlass* superklass() const; | |
355 Klass* subklass() const; | |
356 Klass* next_sibling() const; | |
357 void append_to_sibling_list(); // add newly created receiver to superklass' subklass list | |
358 void remove_from_sibling_list(); // remove receiver from sibling list | |
359 protected: // internal accessors | |
360 klassOop subklass_oop() const { return _subklass; } | |
361 klassOop next_sibling_oop() const { return _next_sibling; } | |
362 void set_subklass(klassOop s); | |
363 void set_next_sibling(klassOop s); | |
364 | |
365 oop* adr_super() const { return (oop*)&_super; } | |
366 oop* adr_primary_supers() const { return (oop*)&_primary_supers[0]; } | |
367 oop* adr_secondary_super_cache() const { return (oop*)&_secondary_super_cache; } | |
368 oop* adr_secondary_supers()const { return (oop*)&_secondary_supers; } | |
369 oop* adr_java_mirror() const { return (oop*)&_java_mirror; } | |
370 oop* adr_subklass() const { return (oop*)&_subklass; } | |
371 oop* adr_next_sibling() const { return (oop*)&_next_sibling; } | |
372 | |
373 public: | |
374 // Allocation profiling support | |
375 juint alloc_count() const { return _alloc_count; } | |
376 void set_alloc_count(juint n) { _alloc_count = n; } | |
377 virtual juint alloc_size() const = 0; | |
378 virtual void set_alloc_size(juint n) = 0; | |
379 | |
380 // Compiler support | |
4762
069ab3f976d3
7118863: Move sizeof(klassOopDesc) into the *Klass::*_offset_in_bytes() functions
stefank
parents:
2376
diff
changeset
|
381 static ByteSize super_offset() { return in_ByteSize(sizeof(klassOopDesc) + offset_of(Klass, _super)); } |
069ab3f976d3
7118863: Move sizeof(klassOopDesc) into the *Klass::*_offset_in_bytes() functions
stefank
parents:
2376
diff
changeset
|
382 static ByteSize super_check_offset_offset() { return in_ByteSize(sizeof(klassOopDesc) + offset_of(Klass, _super_check_offset)); } |
069ab3f976d3
7118863: Move sizeof(klassOopDesc) into the *Klass::*_offset_in_bytes() functions
stefank
parents:
2376
diff
changeset
|
383 static ByteSize primary_supers_offset() { return in_ByteSize(sizeof(klassOopDesc) + offset_of(Klass, _primary_supers)); } |
069ab3f976d3
7118863: Move sizeof(klassOopDesc) into the *Klass::*_offset_in_bytes() functions
stefank
parents:
2376
diff
changeset
|
384 static ByteSize secondary_super_cache_offset() { return in_ByteSize(sizeof(klassOopDesc) + offset_of(Klass, _secondary_super_cache)); } |
069ab3f976d3
7118863: Move sizeof(klassOopDesc) into the *Klass::*_offset_in_bytes() functions
stefank
parents:
2376
diff
changeset
|
385 static ByteSize secondary_supers_offset() { return in_ByteSize(sizeof(klassOopDesc) + offset_of(Klass, _secondary_supers)); } |
069ab3f976d3
7118863: Move sizeof(klassOopDesc) into the *Klass::*_offset_in_bytes() functions
stefank
parents:
2376
diff
changeset
|
386 static ByteSize java_mirror_offset() { return in_ByteSize(sizeof(klassOopDesc) + offset_of(Klass, _java_mirror)); } |
069ab3f976d3
7118863: Move sizeof(klassOopDesc) into the *Klass::*_offset_in_bytes() functions
stefank
parents:
2376
diff
changeset
|
387 static ByteSize modifier_flags_offset() { return in_ByteSize(sizeof(klassOopDesc) + offset_of(Klass, _modifier_flags)); } |
069ab3f976d3
7118863: Move sizeof(klassOopDesc) into the *Klass::*_offset_in_bytes() functions
stefank
parents:
2376
diff
changeset
|
388 static ByteSize layout_helper_offset() { return in_ByteSize(sizeof(klassOopDesc) + offset_of(Klass, _layout_helper)); } |
069ab3f976d3
7118863: Move sizeof(klassOopDesc) into the *Klass::*_offset_in_bytes() functions
stefank
parents:
2376
diff
changeset
|
389 static ByteSize access_flags_offset() { return in_ByteSize(sizeof(klassOopDesc) + offset_of(Klass, _access_flags)); } |
0 | 390 |
391 // Unpacking layout_helper: | |
392 enum { | |
393 _lh_neutral_value = 0, // neutral non-array non-instance value | |
394 _lh_instance_slow_path_bit = 0x01, | |
395 _lh_log2_element_size_shift = BitsPerByte*0, | |
396 _lh_log2_element_size_mask = BitsPerLong-1, | |
397 _lh_element_type_shift = BitsPerByte*1, | |
398 _lh_element_type_mask = right_n_bits(BitsPerByte), // shifted mask | |
399 _lh_header_size_shift = BitsPerByte*2, | |
400 _lh_header_size_mask = right_n_bits(BitsPerByte), // shifted mask | |
401 _lh_array_tag_bits = 2, | |
402 _lh_array_tag_shift = BitsPerInt - _lh_array_tag_bits, | |
403 _lh_array_tag_type_value = ~0x00, // 0xC0000000 >> 30 | |
404 _lh_array_tag_obj_value = ~0x01 // 0x80000000 >> 30 | |
405 }; | |
406 | |
407 static int layout_helper_size_in_bytes(jint lh) { | |
408 assert(lh > (jint)_lh_neutral_value, "must be instance"); | |
409 return (int) lh & ~_lh_instance_slow_path_bit; | |
410 } | |
411 static bool layout_helper_needs_slow_path(jint lh) { | |
412 assert(lh > (jint)_lh_neutral_value, "must be instance"); | |
413 return (lh & _lh_instance_slow_path_bit) != 0; | |
414 } | |
415 static bool layout_helper_is_instance(jint lh) { | |
416 return (jint)lh > (jint)_lh_neutral_value; | |
417 } | |
418 static bool layout_helper_is_javaArray(jint lh) { | |
419 return (jint)lh < (jint)_lh_neutral_value; | |
420 } | |
421 static bool layout_helper_is_typeArray(jint lh) { | |
422 // _lh_array_tag_type_value == (lh >> _lh_array_tag_shift); | |
423 return (juint)lh >= (juint)(_lh_array_tag_type_value << _lh_array_tag_shift); | |
424 } | |
425 static bool layout_helper_is_objArray(jint lh) { | |
426 // _lh_array_tag_obj_value == (lh >> _lh_array_tag_shift); | |
427 return (jint)lh < (jint)(_lh_array_tag_type_value << _lh_array_tag_shift); | |
428 } | |
429 static int layout_helper_header_size(jint lh) { | |
430 assert(lh < (jint)_lh_neutral_value, "must be array"); | |
431 int hsize = (lh >> _lh_header_size_shift) & _lh_header_size_mask; | |
432 assert(hsize > 0 && hsize < (int)sizeof(oopDesc)*3, "sanity"); | |
433 return hsize; | |
434 } | |
435 static BasicType layout_helper_element_type(jint lh) { | |
436 assert(lh < (jint)_lh_neutral_value, "must be array"); | |
437 int btvalue = (lh >> _lh_element_type_shift) & _lh_element_type_mask; | |
438 assert(btvalue >= T_BOOLEAN && btvalue <= T_OBJECT, "sanity"); | |
439 return (BasicType) btvalue; | |
440 } | |
441 static int layout_helper_log2_element_size(jint lh) { | |
442 assert(lh < (jint)_lh_neutral_value, "must be array"); | |
443 int l2esz = (lh >> _lh_log2_element_size_shift) & _lh_log2_element_size_mask; | |
444 assert(l2esz <= LogBitsPerLong, "sanity"); | |
445 return l2esz; | |
446 } | |
447 static jint array_layout_helper(jint tag, int hsize, BasicType etype, int log2_esize) { | |
448 return (tag << _lh_array_tag_shift) | |
449 | (hsize << _lh_header_size_shift) | |
450 | ((int)etype << _lh_element_type_shift) | |
451 | (log2_esize << _lh_log2_element_size_shift); | |
452 } | |
453 static jint instance_layout_helper(jint size, bool slow_path_flag) { | |
454 return (size << LogHeapWordSize) | |
455 | (slow_path_flag ? _lh_instance_slow_path_bit : 0); | |
456 } | |
457 static int layout_helper_to_size_helper(jint lh) { | |
458 assert(lh > (jint)_lh_neutral_value, "must be instance"); | |
459 // Note that the following expression discards _lh_instance_slow_path_bit. | |
460 return lh >> LogHeapWordSize; | |
461 } | |
462 // Out-of-line version computes everything based on the etype: | |
463 static jint array_layout_helper(BasicType etype); | |
464 | |
465 // What is the maximum number of primary superclasses any klass can have? | |
466 #ifdef PRODUCT | |
467 static juint primary_super_limit() { return _primary_super_limit; } | |
468 #else | |
469 static juint primary_super_limit() { | |
470 assert(FastSuperclassLimit <= _primary_super_limit, "parameter oob"); | |
471 return FastSuperclassLimit; | |
472 } | |
473 #endif | |
474 | |
475 // vtables | |
476 virtual klassVtable* vtable() const { return NULL; } | |
477 | |
478 static int klass_size_in_bytes() { return offset_of(Klass, _alloc_count) + sizeof(juint); } // all "visible" fields | |
479 | |
480 // subclass check | |
481 bool is_subclass_of(klassOop k) const; | |
482 // subtype check: true if is_subclass_of, or if k is interface and receiver implements it | |
483 bool is_subtype_of(klassOop k) const { | |
484 juint off = k->klass_part()->super_check_offset(); | |
485 klassOop sup = *(klassOop*)( (address)as_klassOop() + off ); | |
4762
069ab3f976d3
7118863: Move sizeof(klassOopDesc) into the *Klass::*_offset_in_bytes() functions
stefank
parents:
2376
diff
changeset
|
486 const juint secondary_offset = in_bytes(secondary_super_cache_offset()); |
0 | 487 if (sup == k) { |
488 return true; | |
489 } else if (off != secondary_offset) { | |
490 return false; | |
491 } else { | |
492 return search_secondary_supers(k); | |
493 } | |
494 } | |
495 bool search_secondary_supers(klassOop k) const; | |
496 | |
605 | 497 // Find LCA in class hierarchy |
0 | 498 Klass *LCA( Klass *k ); |
499 | |
500 // Check whether reflection/jni/jvm code is allowed to instantiate this class; | |
501 // if not, throw either an Error or an Exception. | |
502 virtual void check_valid_for_instantiation(bool throwError, TRAPS); | |
503 | |
504 // Casting | |
505 static Klass* cast(klassOop k) { | |
506 assert(k->is_klass(), "cast to Klass"); | |
507 return k->klass_part(); | |
508 } | |
509 | |
510 // array copying | |
511 virtual void copy_array(arrayOop s, int src_pos, arrayOop d, int dst_pos, int length, TRAPS); | |
512 | |
513 // tells if the class should be initialized | |
514 virtual bool should_be_initialized() const { return false; } | |
515 // initializes the klass | |
516 virtual void initialize(TRAPS); | |
517 // lookup operation for MethodLookupCache | |
518 friend class MethodLookupCache; | |
2177
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
1972
diff
changeset
|
519 virtual methodOop uncached_lookup_method(Symbol* name, Symbol* signature) const; |
0 | 520 public: |
2177
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
1972
diff
changeset
|
521 methodOop lookup_method(Symbol* name, Symbol* signature) const { |
0 | 522 return uncached_lookup_method(name, signature); |
523 } | |
524 | |
525 // array class with specific rank | |
526 klassOop array_klass(int rank, TRAPS) { return array_klass_impl(false, rank, THREAD); } | |
527 | |
528 // array class with this klass as element type | |
529 klassOop array_klass(TRAPS) { return array_klass_impl(false, THREAD); } | |
530 | |
531 // These will return NULL instead of allocating on the heap: | |
532 // NB: these can block for a mutex, like other functions with TRAPS arg. | |
533 klassOop array_klass_or_null(int rank); | |
534 klassOop array_klass_or_null(); | |
535 | |
536 virtual oop protection_domain() { return NULL; } | |
537 virtual oop class_loader() const { return NULL; } | |
538 | |
539 protected: | |
540 virtual klassOop array_klass_impl(bool or_null, int rank, TRAPS); | |
541 virtual klassOop array_klass_impl(bool or_null, TRAPS); | |
542 | |
543 public: | |
544 virtual void remove_unshareable_info(); | |
2177
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
1972
diff
changeset
|
545 virtual void shared_symbols_iterate(SymbolClosure* closure); |
0 | 546 |
547 protected: | |
548 // computes the subtype relationship | |
549 virtual bool compute_is_subtype_of(klassOop k); | |
550 public: | |
551 // subclass accessor (here for convenience; undefined for non-klass objects) | |
552 virtual bool is_leaf_class() const { fatal("not a class"); return false; } | |
553 public: | |
554 // ALL FUNCTIONS BELOW THIS POINT ARE DISPATCHED FROM AN OOP | |
555 // These functions describe behavior for the oop not the KLASS. | |
556 | |
557 // actual oop size of obj in memory | |
558 virtual int oop_size(oop obj) const = 0; | |
559 | |
560 // actual oop size of this klass in memory | |
561 virtual int klass_oop_size() const = 0; | |
562 | |
563 // Returns the Java name for a class (Resource allocated) | |
564 // For arrays, this returns the name of the element with a leading '['. | |
565 // For classes, this returns the name with the package separators | |
566 // turned into '.'s. | |
567 const char* external_name() const; | |
568 // Returns the name for a class (Resource allocated) as the class | |
569 // would appear in a signature. | |
570 // For arrays, this returns the name of the element with a leading '['. | |
571 // For classes, this returns the name with a leading 'L' and a trailing ';' | |
572 // and the package separators as '/'. | |
1039
987e948ebbc8
6815692: method handle code needs some cleanup (post-6655638)
jrose
parents:
628
diff
changeset
|
573 virtual const char* signature_name() const; |
0 | 574 |
575 // garbage collection support | |
576 virtual void oop_follow_contents(oop obj) = 0; | |
577 virtual int oop_adjust_pointers(oop obj) = 0; | |
578 | |
579 // Parallel Scavenge and Parallel Old | |
580 PARALLEL_GC_DECLS_PV | |
581 | |
582 public: | |
583 // type testing operations | |
584 virtual bool oop_is_instance_slow() const { return false; } | |
2376
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
2177
diff
changeset
|
585 virtual bool oop_is_instanceMirror() const { return false; } |
0 | 586 virtual bool oop_is_instanceRef() const { return false; } |
587 virtual bool oop_is_array() const { return false; } | |
588 virtual bool oop_is_objArray_slow() const { return false; } | |
589 virtual bool oop_is_klass() const { return false; } | |
590 virtual bool oop_is_thread() const { return false; } | |
591 virtual bool oop_is_method() const { return false; } | |
592 virtual bool oop_is_constMethod() const { return false; } | |
593 virtual bool oop_is_methodData() const { return false; } | |
594 virtual bool oop_is_constantPool() const { return false; } | |
595 virtual bool oop_is_constantPoolCache() const { return false; } | |
596 virtual bool oop_is_typeArray_slow() const { return false; } | |
597 virtual bool oop_is_arrayKlass() const { return false; } | |
598 virtual bool oop_is_objArrayKlass() const { return false; } | |
599 virtual bool oop_is_typeArrayKlass() const { return false; } | |
600 virtual bool oop_is_compiledICHolder() const { return false; } | |
601 virtual bool oop_is_instanceKlass() const { return false; } | |
602 | |
603 bool oop_is_javaArray_slow() const { | |
604 return oop_is_objArray_slow() || oop_is_typeArray_slow(); | |
605 } | |
606 | |
607 // Fast non-virtual versions, used by oop.inline.hpp and elsewhere: | |
608 #ifndef ASSERT | |
609 #define assert_same_query(xval, xcheck) xval | |
610 #else | |
611 private: | |
612 static bool assert_same_query(bool xval, bool xslow) { | |
613 assert(xval == xslow, "slow and fast queries agree"); | |
614 return xval; | |
615 } | |
616 public: | |
617 #endif | |
618 inline bool oop_is_instance() const { return assert_same_query( | |
619 layout_helper_is_instance(layout_helper()), | |
620 oop_is_instance_slow()); } | |
621 inline bool oop_is_javaArray() const { return assert_same_query( | |
622 layout_helper_is_javaArray(layout_helper()), | |
623 oop_is_javaArray_slow()); } | |
624 inline bool oop_is_objArray() const { return assert_same_query( | |
625 layout_helper_is_objArray(layout_helper()), | |
626 oop_is_objArray_slow()); } | |
627 inline bool oop_is_typeArray() const { return assert_same_query( | |
628 layout_helper_is_typeArray(layout_helper()), | |
629 oop_is_typeArray_slow()); } | |
630 #undef assert_same_query | |
631 | |
632 // Unless overridden, oop is parsable if it has a klass pointer. | |
518
0af8b0718fc9
6692899: CMS: many vm.parallel_class_loading tests fail with assert "missing Printezis mark"
jmasa
parents:
356
diff
changeset
|
633 // Parsability of an object is object specific. |
0 | 634 virtual bool oop_is_parsable(oop obj) const { return true; } |
635 | |
518
0af8b0718fc9
6692899: CMS: many vm.parallel_class_loading tests fail with assert "missing Printezis mark"
jmasa
parents:
356
diff
changeset
|
636 // Unless overridden, oop is safe for concurrent GC processing |
0af8b0718fc9
6692899: CMS: many vm.parallel_class_loading tests fail with assert "missing Printezis mark"
jmasa
parents:
356
diff
changeset
|
637 // after its allocation is complete. The exception to |
0af8b0718fc9
6692899: CMS: many vm.parallel_class_loading tests fail with assert "missing Printezis mark"
jmasa
parents:
356
diff
changeset
|
638 // this is the case where objects are changed after allocation. |
0af8b0718fc9
6692899: CMS: many vm.parallel_class_loading tests fail with assert "missing Printezis mark"
jmasa
parents:
356
diff
changeset
|
639 // Class redefinition is one of the known exceptions. During |
0af8b0718fc9
6692899: CMS: many vm.parallel_class_loading tests fail with assert "missing Printezis mark"
jmasa
parents:
356
diff
changeset
|
640 // class redefinition, an allocated class can changed in order |
0af8b0718fc9
6692899: CMS: many vm.parallel_class_loading tests fail with assert "missing Printezis mark"
jmasa
parents:
356
diff
changeset
|
641 // order to create a merged class (the combiniation of the |
0af8b0718fc9
6692899: CMS: many vm.parallel_class_loading tests fail with assert "missing Printezis mark"
jmasa
parents:
356
diff
changeset
|
642 // old class definition that has to be perserved and the new class |
0af8b0718fc9
6692899: CMS: many vm.parallel_class_loading tests fail with assert "missing Printezis mark"
jmasa
parents:
356
diff
changeset
|
643 // definition which is being created. |
0af8b0718fc9
6692899: CMS: many vm.parallel_class_loading tests fail with assert "missing Printezis mark"
jmasa
parents:
356
diff
changeset
|
644 virtual bool oop_is_conc_safe(oop obj) const { return true; } |
0af8b0718fc9
6692899: CMS: many vm.parallel_class_loading tests fail with assert "missing Printezis mark"
jmasa
parents:
356
diff
changeset
|
645 |
0 | 646 // Access flags |
647 AccessFlags access_flags() const { return _access_flags; } | |
648 void set_access_flags(AccessFlags flags) { _access_flags = flags; } | |
649 | |
650 bool is_public() const { return _access_flags.is_public(); } | |
651 bool is_final() const { return _access_flags.is_final(); } | |
652 bool is_interface() const { return _access_flags.is_interface(); } | |
653 bool is_abstract() const { return _access_flags.is_abstract(); } | |
654 bool is_super() const { return _access_flags.is_super(); } | |
655 bool is_synthetic() const { return _access_flags.is_synthetic(); } | |
656 void set_is_synthetic() { _access_flags.set_is_synthetic(); } | |
657 bool has_finalizer() const { return _access_flags.has_finalizer(); } | |
658 bool has_final_method() const { return _access_flags.has_final_method(); } | |
659 void set_has_finalizer() { _access_flags.set_has_finalizer(); } | |
660 void set_has_final_method() { _access_flags.set_has_final_method(); } | |
661 bool is_cloneable() const { return _access_flags.is_cloneable(); } | |
662 void set_is_cloneable() { _access_flags.set_is_cloneable(); } | |
663 bool has_vanilla_constructor() const { return _access_flags.has_vanilla_constructor(); } | |
664 void set_has_vanilla_constructor() { _access_flags.set_has_vanilla_constructor(); } | |
665 bool has_miranda_methods () const { return access_flags().has_miranda_methods(); } | |
666 void set_has_miranda_methods() { _access_flags.set_has_miranda_methods(); } | |
667 | |
668 // Biased locking support | |
669 // Note: the prototype header is always set up to be at least the | |
670 // prototype markOop. If biased locking is enabled it may further be | |
671 // biasable and have an epoch. | |
672 markOop prototype_header() const { return _prototype_header; } | |
673 // NOTE: once instances of this klass are floating around in the | |
674 // system, this header must only be updated at a safepoint. | |
675 // NOTE 2: currently we only ever set the prototype header to the | |
676 // biasable prototype for instanceKlasses. There is no technical | |
677 // reason why it could not be done for arrayKlasses aside from | |
678 // wanting to reduce the initial scope of this optimization. There | |
679 // are potential problems in setting the bias pattern for | |
680 // JVM-internal oops. | |
681 inline void set_prototype_header(markOop header); | |
4762
069ab3f976d3
7118863: Move sizeof(klassOopDesc) into the *Klass::*_offset_in_bytes() functions
stefank
parents:
2376
diff
changeset
|
682 static ByteSize prototype_header_offset() { return in_ByteSize(sizeof(klassOopDesc) + offset_of(Klass, _prototype_header)); } |
0 | 683 |
684 int biased_lock_revocation_count() const { return (int) _biased_lock_revocation_count; } | |
685 // Atomically increments biased_lock_revocation_count and returns updated value | |
686 int atomic_incr_biased_lock_revocation_count(); | |
687 void set_biased_lock_revocation_count(int val) { _biased_lock_revocation_count = (jint) val; } | |
688 jlong last_biased_lock_bulk_revocation_time() { return _last_biased_lock_bulk_revocation_time; } | |
689 void set_last_biased_lock_bulk_revocation_time(jlong cur_time) { _last_biased_lock_bulk_revocation_time = cur_time; } | |
690 | |
4800
94ec88ca68e2
7115199: Add event tracing hooks and Java Flight Recorder infrastructure
phh
parents:
2376
diff
changeset
|
691 #ifdef TRACE_DEFINE_KLASS_METHODS |
94ec88ca68e2
7115199: Add event tracing hooks and Java Flight Recorder infrastructure
phh
parents:
2376
diff
changeset
|
692 TRACE_DEFINE_KLASS_METHODS; |
94ec88ca68e2
7115199: Add event tracing hooks and Java Flight Recorder infrastructure
phh
parents:
2376
diff
changeset
|
693 #endif |
0 | 694 |
695 // garbage collection support | |
696 virtual void follow_weak_klass_links( | |
697 BoolObjectClosure* is_alive, OopClosure* keep_alive); | |
698 | |
699 // Prefetch within oop iterators. This is a macro because we | |
700 // can't guarantee that the compiler will inline it. In 64-bit | |
701 // it generally doesn't. Signature is | |
702 // | |
703 // static void prefetch_beyond(oop* const start, | |
704 // oop* const end, | |
705 // const intx foffset, | |
706 // const Prefetch::style pstyle); | |
707 #define prefetch_beyond(start, end, foffset, pstyle) { \ | |
708 const intx foffset_ = (foffset); \ | |
709 const Prefetch::style pstyle_ = (pstyle); \ | |
710 assert(foffset_ > 0, "prefetch beyond, not behind"); \ | |
711 if (pstyle_ != Prefetch::do_none) { \ | |
712 oop* ref = (start); \ | |
713 if (ref < (end)) { \ | |
714 switch (pstyle_) { \ | |
715 case Prefetch::do_read: \ | |
716 Prefetch::read(*ref, foffset_); \ | |
717 break; \ | |
718 case Prefetch::do_write: \ | |
719 Prefetch::write(*ref, foffset_); \ | |
720 break; \ | |
721 default: \ | |
722 ShouldNotReachHere(); \ | |
723 break; \ | |
724 } \ | |
725 } \ | |
726 } \ | |
727 } | |
728 | |
729 // iterators | |
730 virtual int oop_oop_iterate(oop obj, OopClosure* blk) = 0; | |
731 virtual int oop_oop_iterate_v(oop obj, OopClosure* blk) { | |
732 return oop_oop_iterate(obj, blk); | |
733 } | |
734 | |
342
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
113
diff
changeset
|
735 #ifndef SERIALGC |
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
113
diff
changeset
|
736 // In case we don't have a specialized backward scanner use forward |
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
113
diff
changeset
|
737 // iteration. |
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
113
diff
changeset
|
738 virtual int oop_oop_iterate_backwards_v(oop obj, OopClosure* blk) { |
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
113
diff
changeset
|
739 return oop_oop_iterate_v(obj, blk); |
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
113
diff
changeset
|
740 } |
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
113
diff
changeset
|
741 #endif // !SERIALGC |
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
113
diff
changeset
|
742 |
0 | 743 // Iterates "blk" over all the oops in "obj" (of type "this") within "mr". |
744 // (I don't see why the _m should be required, but without it the Solaris | |
745 // C++ gives warning messages about overridings of the "oop_oop_iterate" | |
746 // defined above "hiding" this virtual function. (DLD, 6/20/00)) */ | |
747 virtual int oop_oop_iterate_m(oop obj, OopClosure* blk, MemRegion mr) = 0; | |
748 virtual int oop_oop_iterate_v_m(oop obj, OopClosure* blk, MemRegion mr) { | |
749 return oop_oop_iterate_m(obj, blk, mr); | |
750 } | |
751 | |
752 // Versions of the above iterators specialized to particular subtypes | |
753 // of OopClosure, to avoid closure virtual calls. | |
754 #define Klass_OOP_OOP_ITERATE_DECL(OopClosureType, nv_suffix) \ | |
755 virtual int oop_oop_iterate##nv_suffix(oop obj, OopClosureType* blk) { \ | |
756 /* Default implementation reverts to general version. */ \ | |
757 return oop_oop_iterate(obj, blk); \ | |
758 } \ | |
759 \ | |
760 /* Iterates "blk" over all the oops in "obj" (of type "this") within "mr". \ | |
761 (I don't see why the _m should be required, but without it the Solaris \ | |
762 C++ gives warning messages about overridings of the "oop_oop_iterate" \ | |
763 defined above "hiding" this virtual function. (DLD, 6/20/00)) */ \ | |
764 virtual int oop_oop_iterate##nv_suffix##_m(oop obj, \ | |
765 OopClosureType* blk, \ | |
766 MemRegion mr) { \ | |
767 return oop_oop_iterate_m(obj, blk, mr); \ | |
768 } | |
769 | |
770 SPECIALIZED_OOP_OOP_ITERATE_CLOSURES_1(Klass_OOP_OOP_ITERATE_DECL) | |
342
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
113
diff
changeset
|
771 SPECIALIZED_OOP_OOP_ITERATE_CLOSURES_2(Klass_OOP_OOP_ITERATE_DECL) |
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
113
diff
changeset
|
772 |
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
113
diff
changeset
|
773 #ifndef SERIALGC |
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
113
diff
changeset
|
774 #define Klass_OOP_OOP_ITERATE_BACKWARDS_DECL(OopClosureType, nv_suffix) \ |
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
113
diff
changeset
|
775 virtual int oop_oop_iterate_backwards##nv_suffix(oop obj, \ |
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
113
diff
changeset
|
776 OopClosureType* blk) { \ |
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
113
diff
changeset
|
777 /* Default implementation reverts to general version. */ \ |
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
113
diff
changeset
|
778 return oop_oop_iterate_backwards_v(obj, blk); \ |
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
113
diff
changeset
|
779 } |
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
113
diff
changeset
|
780 |
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
113
diff
changeset
|
781 SPECIALIZED_OOP_OOP_ITERATE_CLOSURES_1(Klass_OOP_OOP_ITERATE_BACKWARDS_DECL) |
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
113
diff
changeset
|
782 SPECIALIZED_OOP_OOP_ITERATE_CLOSURES_2(Klass_OOP_OOP_ITERATE_BACKWARDS_DECL) |
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
113
diff
changeset
|
783 #endif // !SERIALGC |
0 | 784 |
785 virtual void array_klasses_do(void f(klassOop k)) {} | |
786 virtual void with_array_klasses_do(void f(klassOop k)); | |
787 | |
788 // Return self, except for abstract classes with exactly 1 | |
789 // implementor. Then return the 1 concrete implementation. | |
790 Klass *up_cast_abstract(); | |
791 | |
792 // klass name | |
2177
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
1972
diff
changeset
|
793 Symbol* name() const { return _name; } |
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
1972
diff
changeset
|
794 void set_name(Symbol* n); |
0 | 795 |
796 friend class klassKlass; | |
797 | |
798 public: | |
799 // jvm support | |
800 virtual jint compute_modifier_flags(TRAPS) const; | |
801 | |
802 // JVMTI support | |
803 virtual jint jvmti_class_status() const; | |
804 | |
805 // Printing | |
1155
4e6abf09f540
6912062: disassembler plugin needs to produce symbolic information in product mode
jrose
parents:
1039
diff
changeset
|
806 virtual void oop_print_value_on(oop obj, outputStream* st); |
0 | 807 virtual void oop_print_on (oop obj, outputStream* st); |
808 | |
809 // Verification | |
810 virtual const char* internal_name() const = 0; | |
811 virtual void oop_verify_on(oop obj, outputStream* st); | |
812 virtual void oop_verify_old_oop(oop obj, oop* p, bool allow_dirty); | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
813 virtual void oop_verify_old_oop(oop obj, narrowOop* p, bool allow_dirty); |
0 | 814 // tells whether obj is partially constructed (gc during class loading) |
815 virtual bool oop_partially_loaded(oop obj) const { return false; } | |
816 virtual void oop_set_partially_loaded(oop obj) {}; | |
817 | |
818 #ifndef PRODUCT | |
819 void verify_vtable_index(int index); | |
820 #endif | |
821 }; | |
1972 | 822 |
2376
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
2177
diff
changeset
|
823 |
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
2177
diff
changeset
|
824 inline oop klassOopDesc::java_mirror() const { return klass_part()->java_mirror(); } |
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
2177
diff
changeset
|
825 |
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
2177
diff
changeset
|
826 |
1972 | 827 #endif // SHARE_VM_OOPS_KLASS_HPP |