Mercurial > hg > truffle
annotate src/share/vm/oops/klass.hpp @ 5274:e72dd6533eb9
documented importance of nmethod::_graal_compiled_method wrt code unloading and GC
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Mon, 23 Apr 2012 15:42:30 +0200 |
parents | 5e9f38419819 |
children | 70f715dfbb41 |
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; | |
5062
5e9f38419819
Adjust C++ part according to the renaming.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4970
diff
changeset
|
242 // com/oracle/graal/hotspot/HotSpotTypeResolved mirroring this class |
2891
75a99b4f1c98
Rebranded C++ part from C1X to Graal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2874
diff
changeset
|
243 oop _graal_mirror; |
0 | 244 // Superclass |
245 klassOop _super; | |
246 // First subclass (NULL if none); _subklass->next_sibling() is next one | |
247 klassOop _subklass; | |
248 // Sibling link (or NULL); links all subklasses of a klass | |
249 klassOop _next_sibling; | |
250 | |
251 // | |
252 // End of the oop block. | |
253 // | |
254 | |
255 jint _modifier_flags; // Processed access flags, for use by Class.getModifiers. | |
256 AccessFlags _access_flags; // Access flags. The class/interface distinction is stored here. | |
257 | |
258 #ifndef PRODUCT | |
259 int _verify_count; // to avoid redundant verifies | |
260 #endif | |
261 | |
262 juint _alloc_count; // allocation profiling support - update klass_size_in_bytes() if moved/deleted | |
263 | |
264 // Biased locking implementation and statistics | |
265 // (the 64-bit chunk goes first, to avoid some fragmentation) | |
266 jlong _last_biased_lock_bulk_revocation_time; | |
267 markOop _prototype_header; // Used when biased locking is both enabled and disabled for this type | |
268 jint _biased_lock_revocation_count; | |
269 | |
4800
94ec88ca68e2
7115199: Add event tracing hooks and Java Flight Recorder infrastructure
phh
parents:
2376
diff
changeset
|
270 TRACE_DEFINE_KLASS_TRACE_ID; |
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 | |
2891
75a99b4f1c98
Rebranded C++ part from C1X to Graal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2874
diff
changeset
|
342 // graal mirror |
75a99b4f1c98
Rebranded C++ part from C1X to Graal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2874
diff
changeset
|
343 oop graal_mirror() const { return _graal_mirror; } |
75a99b4f1c98
Rebranded C++ part from C1X to Graal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2874
diff
changeset
|
344 void set_graal_mirror(oop m) { oop_store((oop*) &_graal_mirror, m); } |
1941
79d04223b8a5
Added caching for resolved types and resolved fields.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1681
diff
changeset
|
345 |
0 | 346 // modifier flags |
347 jint modifier_flags() const { return _modifier_flags; } | |
348 void set_modifier_flags(jint flags) { _modifier_flags = flags; } | |
349 | |
350 // size helper | |
351 int layout_helper() const { return _layout_helper; } | |
352 void set_layout_helper(int lh) { _layout_helper = lh; } | |
353 | |
354 // Note: for instances layout_helper() may include padding. | |
355 // Use instanceKlass::contains_field_offset to classify field offsets. | |
356 | |
357 // sub/superklass links | |
358 instanceKlass* superklass() const; | |
359 Klass* subklass() const; | |
360 Klass* next_sibling() const; | |
361 void append_to_sibling_list(); // add newly created receiver to superklass' subklass list | |
362 void remove_from_sibling_list(); // remove receiver from sibling list | |
363 protected: // internal accessors | |
364 klassOop subklass_oop() const { return _subklass; } | |
365 klassOop next_sibling_oop() const { return _next_sibling; } | |
366 void set_subklass(klassOop s); | |
367 void set_next_sibling(klassOop s); | |
368 | |
369 oop* adr_super() const { return (oop*)&_super; } | |
370 oop* adr_primary_supers() const { return (oop*)&_primary_supers[0]; } | |
371 oop* adr_secondary_super_cache() const { return (oop*)&_secondary_super_cache; } | |
372 oop* adr_secondary_supers()const { return (oop*)&_secondary_supers; } | |
373 oop* adr_java_mirror() const { return (oop*)&_java_mirror; } | |
3011
f00918f35c7f
inlining and runtime interface related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2891
diff
changeset
|
374 oop* adr_graal_mirror() const { return (oop*)&_graal_mirror; } |
0 | 375 oop* adr_subklass() const { return (oop*)&_subklass; } |
376 oop* adr_next_sibling() const { return (oop*)&_next_sibling; } | |
377 | |
378 public: | |
379 // Allocation profiling support | |
380 juint alloc_count() const { return _alloc_count; } | |
381 void set_alloc_count(juint n) { _alloc_count = n; } | |
382 virtual juint alloc_size() const = 0; | |
383 virtual void set_alloc_size(juint n) = 0; | |
384 | |
385 // Compiler support | |
4762
069ab3f976d3
7118863: Move sizeof(klassOopDesc) into the *Klass::*_offset_in_bytes() functions
stefank
parents:
2376
diff
changeset
|
386 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
|
387 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
|
388 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
|
389 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
|
390 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
|
391 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
|
392 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
|
393 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
|
394 static ByteSize access_flags_offset() { return in_ByteSize(sizeof(klassOopDesc) + offset_of(Klass, _access_flags)); } |
4970
33df1aeaebbf
Merge with http://hg.openjdk.java.net/hsx/hsx24/hotspot/
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
diff
changeset
|
395 static ByteSize graal_mirror_offset() { return in_ByteSize(sizeof(klassOopDesc) + offset_of(Klass, _graal_mirror)); } |
0 | 396 |
397 // Unpacking layout_helper: | |
398 enum { | |
399 _lh_neutral_value = 0, // neutral non-array non-instance value | |
400 _lh_instance_slow_path_bit = 0x01, | |
401 _lh_log2_element_size_shift = BitsPerByte*0, | |
402 _lh_log2_element_size_mask = BitsPerLong-1, | |
403 _lh_element_type_shift = BitsPerByte*1, | |
404 _lh_element_type_mask = right_n_bits(BitsPerByte), // shifted mask | |
405 _lh_header_size_shift = BitsPerByte*2, | |
406 _lh_header_size_mask = right_n_bits(BitsPerByte), // shifted mask | |
407 _lh_array_tag_bits = 2, | |
408 _lh_array_tag_shift = BitsPerInt - _lh_array_tag_bits, | |
409 _lh_array_tag_type_value = ~0x00, // 0xC0000000 >> 30 | |
410 _lh_array_tag_obj_value = ~0x01 // 0x80000000 >> 30 | |
411 }; | |
412 | |
413 static int layout_helper_size_in_bytes(jint lh) { | |
414 assert(lh > (jint)_lh_neutral_value, "must be instance"); | |
415 return (int) lh & ~_lh_instance_slow_path_bit; | |
416 } | |
417 static bool layout_helper_needs_slow_path(jint lh) { | |
418 assert(lh > (jint)_lh_neutral_value, "must be instance"); | |
419 return (lh & _lh_instance_slow_path_bit) != 0; | |
420 } | |
421 static bool layout_helper_is_instance(jint lh) { | |
422 return (jint)lh > (jint)_lh_neutral_value; | |
423 } | |
424 static bool layout_helper_is_javaArray(jint lh) { | |
425 return (jint)lh < (jint)_lh_neutral_value; | |
426 } | |
427 static bool layout_helper_is_typeArray(jint lh) { | |
428 // _lh_array_tag_type_value == (lh >> _lh_array_tag_shift); | |
429 return (juint)lh >= (juint)(_lh_array_tag_type_value << _lh_array_tag_shift); | |
430 } | |
431 static bool layout_helper_is_objArray(jint lh) { | |
432 // _lh_array_tag_obj_value == (lh >> _lh_array_tag_shift); | |
433 return (jint)lh < (jint)(_lh_array_tag_type_value << _lh_array_tag_shift); | |
434 } | |
435 static int layout_helper_header_size(jint lh) { | |
436 assert(lh < (jint)_lh_neutral_value, "must be array"); | |
437 int hsize = (lh >> _lh_header_size_shift) & _lh_header_size_mask; | |
438 assert(hsize > 0 && hsize < (int)sizeof(oopDesc)*3, "sanity"); | |
439 return hsize; | |
440 } | |
441 static BasicType layout_helper_element_type(jint lh) { | |
442 assert(lh < (jint)_lh_neutral_value, "must be array"); | |
443 int btvalue = (lh >> _lh_element_type_shift) & _lh_element_type_mask; | |
444 assert(btvalue >= T_BOOLEAN && btvalue <= T_OBJECT, "sanity"); | |
445 return (BasicType) btvalue; | |
446 } | |
447 static int layout_helper_log2_element_size(jint lh) { | |
448 assert(lh < (jint)_lh_neutral_value, "must be array"); | |
449 int l2esz = (lh >> _lh_log2_element_size_shift) & _lh_log2_element_size_mask; | |
450 assert(l2esz <= LogBitsPerLong, "sanity"); | |
451 return l2esz; | |
452 } | |
453 static jint array_layout_helper(jint tag, int hsize, BasicType etype, int log2_esize) { | |
454 return (tag << _lh_array_tag_shift) | |
455 | (hsize << _lh_header_size_shift) | |
456 | ((int)etype << _lh_element_type_shift) | |
457 | (log2_esize << _lh_log2_element_size_shift); | |
458 } | |
459 static jint instance_layout_helper(jint size, bool slow_path_flag) { | |
460 return (size << LogHeapWordSize) | |
461 | (slow_path_flag ? _lh_instance_slow_path_bit : 0); | |
462 } | |
463 static int layout_helper_to_size_helper(jint lh) { | |
464 assert(lh > (jint)_lh_neutral_value, "must be instance"); | |
465 // Note that the following expression discards _lh_instance_slow_path_bit. | |
466 return lh >> LogHeapWordSize; | |
467 } | |
468 // Out-of-line version computes everything based on the etype: | |
469 static jint array_layout_helper(BasicType etype); | |
470 | |
471 // What is the maximum number of primary superclasses any klass can have? | |
472 #ifdef PRODUCT | |
473 static juint primary_super_limit() { return _primary_super_limit; } | |
474 #else | |
475 static juint primary_super_limit() { | |
476 assert(FastSuperclassLimit <= _primary_super_limit, "parameter oob"); | |
477 return FastSuperclassLimit; | |
478 } | |
479 #endif | |
480 | |
481 // vtables | |
482 virtual klassVtable* vtable() const { return NULL; } | |
483 | |
484 static int klass_size_in_bytes() { return offset_of(Klass, _alloc_count) + sizeof(juint); } // all "visible" fields | |
485 | |
486 // subclass check | |
487 bool is_subclass_of(klassOop k) const; | |
488 // subtype check: true if is_subclass_of, or if k is interface and receiver implements it | |
489 bool is_subtype_of(klassOop k) const { | |
490 juint off = k->klass_part()->super_check_offset(); | |
491 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
|
492 const juint secondary_offset = in_bytes(secondary_super_cache_offset()); |
0 | 493 if (sup == k) { |
494 return true; | |
495 } else if (off != secondary_offset) { | |
496 return false; | |
497 } else { | |
498 return search_secondary_supers(k); | |
499 } | |
500 } | |
501 bool search_secondary_supers(klassOop k) const; | |
502 | |
605 | 503 // Find LCA in class hierarchy |
0 | 504 Klass *LCA( Klass *k ); |
505 | |
506 // Check whether reflection/jni/jvm code is allowed to instantiate this class; | |
507 // if not, throw either an Error or an Exception. | |
508 virtual void check_valid_for_instantiation(bool throwError, TRAPS); | |
509 | |
510 // Casting | |
511 static Klass* cast(klassOop k) { | |
512 assert(k->is_klass(), "cast to Klass"); | |
513 return k->klass_part(); | |
514 } | |
515 | |
516 // array copying | |
517 virtual void copy_array(arrayOop s, int src_pos, arrayOop d, int dst_pos, int length, TRAPS); | |
518 | |
519 // tells if the class should be initialized | |
520 virtual bool should_be_initialized() const { return false; } | |
521 // initializes the klass | |
522 virtual void initialize(TRAPS); | |
523 // lookup operation for MethodLookupCache | |
524 friend class MethodLookupCache; | |
2177
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
1972
diff
changeset
|
525 virtual methodOop uncached_lookup_method(Symbol* name, Symbol* signature) const; |
0 | 526 public: |
2177
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
1972
diff
changeset
|
527 methodOop lookup_method(Symbol* name, Symbol* signature) const { |
0 | 528 return uncached_lookup_method(name, signature); |
529 } | |
530 | |
531 // array class with specific rank | |
532 klassOop array_klass(int rank, TRAPS) { return array_klass_impl(false, rank, THREAD); } | |
533 | |
534 // array class with this klass as element type | |
535 klassOop array_klass(TRAPS) { return array_klass_impl(false, THREAD); } | |
536 | |
537 // These will return NULL instead of allocating on the heap: | |
538 // NB: these can block for a mutex, like other functions with TRAPS arg. | |
539 klassOop array_klass_or_null(int rank); | |
540 klassOop array_klass_or_null(); | |
541 | |
542 virtual oop protection_domain() { return NULL; } | |
543 virtual oop class_loader() const { return NULL; } | |
544 | |
545 protected: | |
546 virtual klassOop array_klass_impl(bool or_null, int rank, TRAPS); | |
547 virtual klassOop array_klass_impl(bool or_null, TRAPS); | |
548 | |
549 public: | |
550 virtual void remove_unshareable_info(); | |
2177
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
1972
diff
changeset
|
551 virtual void shared_symbols_iterate(SymbolClosure* closure); |
0 | 552 |
553 protected: | |
554 // computes the subtype relationship | |
555 virtual bool compute_is_subtype_of(klassOop k); | |
556 public: | |
557 // subclass accessor (here for convenience; undefined for non-klass objects) | |
558 virtual bool is_leaf_class() const { fatal("not a class"); return false; } | |
559 public: | |
560 // ALL FUNCTIONS BELOW THIS POINT ARE DISPATCHED FROM AN OOP | |
561 // These functions describe behavior for the oop not the KLASS. | |
562 | |
563 // actual oop size of obj in memory | |
564 virtual int oop_size(oop obj) const = 0; | |
565 | |
566 // actual oop size of this klass in memory | |
567 virtual int klass_oop_size() const = 0; | |
568 | |
569 // Returns the Java name for a class (Resource allocated) | |
570 // For arrays, this returns the name of the element with a leading '['. | |
571 // For classes, this returns the name with the package separators | |
572 // turned into '.'s. | |
573 const char* external_name() const; | |
574 // Returns the name for a class (Resource allocated) as the class | |
575 // would appear in a signature. | |
576 // For arrays, this returns the name of the element with a leading '['. | |
577 // For classes, this returns the name with a leading 'L' and a trailing ';' | |
578 // and the package separators as '/'. | |
1039
987e948ebbc8
6815692: method handle code needs some cleanup (post-6655638)
jrose
parents:
628
diff
changeset
|
579 virtual const char* signature_name() const; |
0 | 580 |
581 // garbage collection support | |
582 virtual void oop_follow_contents(oop obj) = 0; | |
583 virtual int oop_adjust_pointers(oop obj) = 0; | |
584 | |
585 // Parallel Scavenge and Parallel Old | |
586 PARALLEL_GC_DECLS_PV | |
587 | |
588 public: | |
589 // type testing operations | |
590 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
|
591 virtual bool oop_is_instanceMirror() const { return false; } |
0 | 592 virtual bool oop_is_instanceRef() const { return false; } |
593 virtual bool oop_is_array() const { return false; } | |
594 virtual bool oop_is_objArray_slow() const { return false; } | |
595 virtual bool oop_is_klass() const { return false; } | |
596 virtual bool oop_is_thread() const { return false; } | |
597 virtual bool oop_is_method() const { return false; } | |
598 virtual bool oop_is_constMethod() const { return false; } | |
599 virtual bool oop_is_methodData() const { return false; } | |
600 virtual bool oop_is_constantPool() const { return false; } | |
601 virtual bool oop_is_constantPoolCache() const { return false; } | |
602 virtual bool oop_is_typeArray_slow() const { return false; } | |
603 virtual bool oop_is_arrayKlass() const { return false; } | |
604 virtual bool oop_is_objArrayKlass() const { return false; } | |
605 virtual bool oop_is_typeArrayKlass() const { return false; } | |
606 virtual bool oop_is_compiledICHolder() const { return false; } | |
607 virtual bool oop_is_instanceKlass() const { return false; } | |
608 | |
609 bool oop_is_javaArray_slow() const { | |
610 return oop_is_objArray_slow() || oop_is_typeArray_slow(); | |
611 } | |
612 | |
613 // Fast non-virtual versions, used by oop.inline.hpp and elsewhere: | |
614 #ifndef ASSERT | |
615 #define assert_same_query(xval, xcheck) xval | |
616 #else | |
617 private: | |
618 static bool assert_same_query(bool xval, bool xslow) { | |
619 assert(xval == xslow, "slow and fast queries agree"); | |
620 return xval; | |
621 } | |
622 public: | |
623 #endif | |
624 inline bool oop_is_instance() const { return assert_same_query( | |
625 layout_helper_is_instance(layout_helper()), | |
626 oop_is_instance_slow()); } | |
627 inline bool oop_is_javaArray() const { return assert_same_query( | |
628 layout_helper_is_javaArray(layout_helper()), | |
629 oop_is_javaArray_slow()); } | |
630 inline bool oop_is_objArray() const { return assert_same_query( | |
631 layout_helper_is_objArray(layout_helper()), | |
632 oop_is_objArray_slow()); } | |
633 inline bool oop_is_typeArray() const { return assert_same_query( | |
634 layout_helper_is_typeArray(layout_helper()), | |
635 oop_is_typeArray_slow()); } | |
636 #undef assert_same_query | |
637 | |
638 // 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
|
639 // Parsability of an object is object specific. |
0 | 640 virtual bool oop_is_parsable(oop obj) const { return true; } |
641 | |
518
0af8b0718fc9
6692899: CMS: many vm.parallel_class_loading tests fail with assert "missing Printezis mark"
jmasa
parents:
356
diff
changeset
|
642 // 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
|
643 // 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
|
644 // 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
|
645 // 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
|
646 // 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
|
647 // 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
|
648 // 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
|
649 // 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
|
650 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
|
651 |
0 | 652 // Access flags |
653 AccessFlags access_flags() const { return _access_flags; } | |
654 void set_access_flags(AccessFlags flags) { _access_flags = flags; } | |
655 | |
656 bool is_public() const { return _access_flags.is_public(); } | |
657 bool is_final() const { return _access_flags.is_final(); } | |
658 bool is_interface() const { return _access_flags.is_interface(); } | |
659 bool is_abstract() const { return _access_flags.is_abstract(); } | |
660 bool is_super() const { return _access_flags.is_super(); } | |
661 bool is_synthetic() const { return _access_flags.is_synthetic(); } | |
662 void set_is_synthetic() { _access_flags.set_is_synthetic(); } | |
663 bool has_finalizer() const { return _access_flags.has_finalizer(); } | |
664 bool has_final_method() const { return _access_flags.has_final_method(); } | |
665 void set_has_finalizer() { _access_flags.set_has_finalizer(); } | |
666 void set_has_final_method() { _access_flags.set_has_final_method(); } | |
667 bool is_cloneable() const { return _access_flags.is_cloneable(); } | |
668 void set_is_cloneable() { _access_flags.set_is_cloneable(); } | |
669 bool has_vanilla_constructor() const { return _access_flags.has_vanilla_constructor(); } | |
670 void set_has_vanilla_constructor() { _access_flags.set_has_vanilla_constructor(); } | |
671 bool has_miranda_methods () const { return access_flags().has_miranda_methods(); } | |
672 void set_has_miranda_methods() { _access_flags.set_has_miranda_methods(); } | |
673 | |
674 // Biased locking support | |
675 // Note: the prototype header is always set up to be at least the | |
676 // prototype markOop. If biased locking is enabled it may further be | |
677 // biasable and have an epoch. | |
678 markOop prototype_header() const { return _prototype_header; } | |
679 // NOTE: once instances of this klass are floating around in the | |
680 // system, this header must only be updated at a safepoint. | |
681 // NOTE 2: currently we only ever set the prototype header to the | |
682 // biasable prototype for instanceKlasses. There is no technical | |
683 // reason why it could not be done for arrayKlasses aside from | |
684 // wanting to reduce the initial scope of this optimization. There | |
685 // are potential problems in setting the bias pattern for | |
686 // JVM-internal oops. | |
687 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
|
688 static ByteSize prototype_header_offset() { return in_ByteSize(sizeof(klassOopDesc) + offset_of(Klass, _prototype_header)); } |
0 | 689 |
690 int biased_lock_revocation_count() const { return (int) _biased_lock_revocation_count; } | |
691 // Atomically increments biased_lock_revocation_count and returns updated value | |
692 int atomic_incr_biased_lock_revocation_count(); | |
693 void set_biased_lock_revocation_count(int val) { _biased_lock_revocation_count = (jint) val; } | |
694 jlong last_biased_lock_bulk_revocation_time() { return _last_biased_lock_bulk_revocation_time; } | |
695 void set_last_biased_lock_bulk_revocation_time(jlong cur_time) { _last_biased_lock_bulk_revocation_time = cur_time; } | |
696 | |
4800
94ec88ca68e2
7115199: Add event tracing hooks and Java Flight Recorder infrastructure
phh
parents:
2376
diff
changeset
|
697 TRACE_DEFINE_KLASS_METHODS; |
0 | 698 |
699 // garbage collection support | |
700 virtual void follow_weak_klass_links( | |
701 BoolObjectClosure* is_alive, OopClosure* keep_alive); | |
702 | |
703 // Prefetch within oop iterators. This is a macro because we | |
704 // can't guarantee that the compiler will inline it. In 64-bit | |
705 // it generally doesn't. Signature is | |
706 // | |
707 // static void prefetch_beyond(oop* const start, | |
708 // oop* const end, | |
709 // const intx foffset, | |
710 // const Prefetch::style pstyle); | |
711 #define prefetch_beyond(start, end, foffset, pstyle) { \ | |
712 const intx foffset_ = (foffset); \ | |
713 const Prefetch::style pstyle_ = (pstyle); \ | |
714 assert(foffset_ > 0, "prefetch beyond, not behind"); \ | |
715 if (pstyle_ != Prefetch::do_none) { \ | |
716 oop* ref = (start); \ | |
717 if (ref < (end)) { \ | |
718 switch (pstyle_) { \ | |
719 case Prefetch::do_read: \ | |
720 Prefetch::read(*ref, foffset_); \ | |
721 break; \ | |
722 case Prefetch::do_write: \ | |
723 Prefetch::write(*ref, foffset_); \ | |
724 break; \ | |
725 default: \ | |
726 ShouldNotReachHere(); \ | |
727 break; \ | |
728 } \ | |
729 } \ | |
730 } \ | |
731 } | |
732 | |
733 // iterators | |
734 virtual int oop_oop_iterate(oop obj, OopClosure* blk) = 0; | |
735 virtual int oop_oop_iterate_v(oop obj, OopClosure* blk) { | |
736 return oop_oop_iterate(obj, blk); | |
737 } | |
738 | |
342
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
113
diff
changeset
|
739 #ifndef SERIALGC |
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
113
diff
changeset
|
740 // 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
|
741 // iteration. |
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
113
diff
changeset
|
742 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
|
743 return oop_oop_iterate_v(obj, blk); |
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
113
diff
changeset
|
744 } |
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
113
diff
changeset
|
745 #endif // !SERIALGC |
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
113
diff
changeset
|
746 |
0 | 747 // Iterates "blk" over all the oops in "obj" (of type "this") within "mr". |
748 // (I don't see why the _m should be required, but without it the Solaris | |
749 // C++ gives warning messages about overridings of the "oop_oop_iterate" | |
750 // defined above "hiding" this virtual function. (DLD, 6/20/00)) */ | |
751 virtual int oop_oop_iterate_m(oop obj, OopClosure* blk, MemRegion mr) = 0; | |
752 virtual int oop_oop_iterate_v_m(oop obj, OopClosure* blk, MemRegion mr) { | |
753 return oop_oop_iterate_m(obj, blk, mr); | |
754 } | |
755 | |
756 // Versions of the above iterators specialized to particular subtypes | |
757 // of OopClosure, to avoid closure virtual calls. | |
758 #define Klass_OOP_OOP_ITERATE_DECL(OopClosureType, nv_suffix) \ | |
759 virtual int oop_oop_iterate##nv_suffix(oop obj, OopClosureType* blk) { \ | |
760 /* Default implementation reverts to general version. */ \ | |
761 return oop_oop_iterate(obj, blk); \ | |
762 } \ | |
763 \ | |
764 /* Iterates "blk" over all the oops in "obj" (of type "this") within "mr". \ | |
765 (I don't see why the _m should be required, but without it the Solaris \ | |
766 C++ gives warning messages about overridings of the "oop_oop_iterate" \ | |
767 defined above "hiding" this virtual function. (DLD, 6/20/00)) */ \ | |
768 virtual int oop_oop_iterate##nv_suffix##_m(oop obj, \ | |
769 OopClosureType* blk, \ | |
770 MemRegion mr) { \ | |
771 return oop_oop_iterate_m(obj, blk, mr); \ | |
772 } | |
773 | |
774 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
|
775 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
|
776 |
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
113
diff
changeset
|
777 #ifndef SERIALGC |
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
113
diff
changeset
|
778 #define Klass_OOP_OOP_ITERATE_BACKWARDS_DECL(OopClosureType, nv_suffix) \ |
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
113
diff
changeset
|
779 virtual int oop_oop_iterate_backwards##nv_suffix(oop obj, \ |
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
113
diff
changeset
|
780 OopClosureType* blk) { \ |
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
113
diff
changeset
|
781 /* Default implementation reverts to general version. */ \ |
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
113
diff
changeset
|
782 return oop_oop_iterate_backwards_v(obj, blk); \ |
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
113
diff
changeset
|
783 } |
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
113
diff
changeset
|
784 |
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
113
diff
changeset
|
785 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
|
786 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
|
787 #endif // !SERIALGC |
0 | 788 |
789 virtual void array_klasses_do(void f(klassOop k)) {} | |
790 virtual void with_array_klasses_do(void f(klassOop k)); | |
791 | |
792 // Return self, except for abstract classes with exactly 1 | |
793 // implementor. Then return the 1 concrete implementation. | |
794 Klass *up_cast_abstract(); | |
795 | |
796 // klass name | |
2177
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
1972
diff
changeset
|
797 Symbol* name() const { return _name; } |
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
1972
diff
changeset
|
798 void set_name(Symbol* n); |
0 | 799 |
800 friend class klassKlass; | |
801 | |
802 public: | |
803 // jvm support | |
804 virtual jint compute_modifier_flags(TRAPS) const; | |
805 | |
806 // JVMTI support | |
807 virtual jint jvmti_class_status() const; | |
808 | |
809 // Printing | |
1155
4e6abf09f540
6912062: disassembler plugin needs to produce symbolic information in product mode
jrose
parents:
1039
diff
changeset
|
810 virtual void oop_print_value_on(oop obj, outputStream* st); |
0 | 811 virtual void oop_print_on (oop obj, outputStream* st); |
812 | |
813 // Verification | |
814 virtual const char* internal_name() const = 0; | |
815 virtual void oop_verify_on(oop obj, outputStream* st); | |
816 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
|
817 virtual void oop_verify_old_oop(oop obj, narrowOop* p, bool allow_dirty); |
0 | 818 // tells whether obj is partially constructed (gc during class loading) |
819 virtual bool oop_partially_loaded(oop obj) const { return false; } | |
820 virtual void oop_set_partially_loaded(oop obj) {}; | |
821 | |
822 #ifndef PRODUCT | |
823 void verify_vtable_index(int index); | |
824 #endif | |
825 }; | |
1972 | 826 |
2376
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
2177
diff
changeset
|
827 |
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
2177
diff
changeset
|
828 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
|
829 |
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
2177
diff
changeset
|
830 |
1972 | 831 #endif // SHARE_VM_OOPS_KLASS_HPP |