Mercurial > hg > truffle
annotate src/share/vm/oops/klass.hpp @ 6181:f8de958e5b2c
7176856: add the JRE name to the error log
Reviewed-by: coleenp, jrose, kvn, twisti
Contributed-by: Krystal Mok <sajia@taobao.com>
author | twisti |
---|---|
date | Mon, 18 Jun 2012 12:29:21 -0700 |
parents | b632e80fc9dc |
children | 957c266d8bc5 da91efe96a93 |
rev | line source |
---|---|
0 | 1 /* |
5972
9a9bb0010c91
7156764: Remove unused size parameter from some CollectedHeap methods
brutisso
parents:
4860
diff
changeset
|
2 * Copyright (c) 1997, 2012, 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; | |
5972
9a9bb0010c91
7156764: Remove unused size parameter from some CollectedHeap methods
brutisso
parents:
4860
diff
changeset
|
152 void post_new_init_klass(KlassHandle& klass, klassOop obj) const; |
0 | 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(); \ |
5972
9a9bb0010c91
7156764: Remove unused size parameter from some CollectedHeap methods
brutisso
parents:
4860
diff
changeset
|
163 post_new_init_klass(klass_klass, new_klass); \ |
342
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 TRACE_DEFINE_KLASS_TRACE_ID; |
0 | 269 public: |
270 | |
271 // returns the enclosing klassOop | |
272 klassOop as_klassOop() const { | |
273 // see klassOop.hpp for layout. | |
274 return (klassOop) (((char*) this) - sizeof(klassOopDesc)); | |
275 } | |
276 | |
277 public: | |
278 // Allocation | |
279 const Klass_vtbl& vtbl_value() const { return *this; } // used only on "example instances" | |
280 static KlassHandle base_create_klass(KlassHandle& klass, int size, const Klass_vtbl& vtbl, TRAPS); | |
281 static klassOop base_create_klass_oop(KlassHandle& klass, int size, const Klass_vtbl& vtbl, TRAPS); | |
282 | |
283 // super | |
284 klassOop super() const { return _super; } | |
285 void set_super(klassOop k) { oop_store_without_check((oop*) &_super, (oop) k); } | |
286 | |
287 // initializes _super link, _primary_supers & _secondary_supers arrays | |
288 void initialize_supers(klassOop k, TRAPS); | |
289 void initialize_supers_impl1(klassOop k); | |
290 void initialize_supers_impl2(klassOop k); | |
291 | |
292 // klass-specific helper for initializing _secondary_supers | |
293 virtual objArrayOop compute_secondary_supers(int num_extra_slots, TRAPS); | |
294 | |
295 // java_super is the Java-level super type as specified by Class.getSuperClass. | |
296 virtual klassOop java_super() const { return NULL; } | |
297 | |
298 juint super_check_offset() const { return _super_check_offset; } | |
299 void set_super_check_offset(juint o) { _super_check_offset = o; } | |
300 | |
301 klassOop secondary_super_cache() const { return _secondary_super_cache; } | |
302 void set_secondary_super_cache(klassOop k) { oop_store_without_check((oop*) &_secondary_super_cache, (oop) k); } | |
303 | |
304 objArrayOop secondary_supers() const { return _secondary_supers; } | |
305 void set_secondary_supers(objArrayOop k) { oop_store_without_check((oop*) &_secondary_supers, (oop) k); } | |
306 | |
307 // Return the element of the _super chain of the given depth. | |
308 // If there is no such element, return either NULL or this. | |
309 klassOop primary_super_of_depth(juint i) const { | |
310 assert(i < primary_super_limit(), "oob"); | |
311 klassOop super = _primary_supers[i]; | |
312 assert(super == NULL || super->klass_part()->super_depth() == i, "correct display"); | |
313 return super; | |
314 } | |
315 | |
316 // Can this klass be a primary super? False for interfaces and arrays of | |
317 // interfaces. False also for arrays or classes with long super chains. | |
318 bool can_be_primary_super() const { | |
4762
069ab3f976d3
7118863: Move sizeof(klassOopDesc) into the *Klass::*_offset_in_bytes() functions
stefank
parents:
2376
diff
changeset
|
319 const juint secondary_offset = in_bytes(secondary_super_cache_offset()); |
0 | 320 return super_check_offset() != secondary_offset; |
321 } | |
322 virtual bool can_be_primary_super_slow() const; | |
323 | |
324 // Returns number of primary supers; may be a number in the inclusive range [0, primary_super_limit]. | |
325 juint super_depth() const { | |
326 if (!can_be_primary_super()) { | |
327 return primary_super_limit(); | |
328 } else { | |
4762
069ab3f976d3
7118863: Move sizeof(klassOopDesc) into the *Klass::*_offset_in_bytes() functions
stefank
parents:
2376
diff
changeset
|
329 juint d = (super_check_offset() - in_bytes(primary_supers_offset())) / sizeof(klassOop); |
0 | 330 assert(d < primary_super_limit(), "oob"); |
331 assert(_primary_supers[d] == as_klassOop(), "proper init"); | |
332 return d; | |
333 } | |
334 } | |
335 | |
336 // java mirror | |
337 oop java_mirror() const { return _java_mirror; } | |
338 void set_java_mirror(oop m) { oop_store((oop*) &_java_mirror, m); } | |
339 | |
340 // modifier flags | |
341 jint modifier_flags() const { return _modifier_flags; } | |
342 void set_modifier_flags(jint flags) { _modifier_flags = flags; } | |
343 | |
344 // size helper | |
345 int layout_helper() const { return _layout_helper; } | |
346 void set_layout_helper(int lh) { _layout_helper = lh; } | |
347 | |
348 // Note: for instances layout_helper() may include padding. | |
349 // Use instanceKlass::contains_field_offset to classify field offsets. | |
350 | |
351 // sub/superklass links | |
352 instanceKlass* superklass() const; | |
353 Klass* subklass() const; | |
354 Klass* next_sibling() const; | |
355 void append_to_sibling_list(); // add newly created receiver to superklass' subklass list | |
356 void remove_from_sibling_list(); // remove receiver from sibling list | |
357 protected: // internal accessors | |
358 klassOop subklass_oop() const { return _subklass; } | |
359 klassOop next_sibling_oop() const { return _next_sibling; } | |
360 void set_subklass(klassOop s); | |
361 void set_next_sibling(klassOop s); | |
362 | |
363 oop* adr_super() const { return (oop*)&_super; } | |
364 oop* adr_primary_supers() const { return (oop*)&_primary_supers[0]; } | |
365 oop* adr_secondary_super_cache() const { return (oop*)&_secondary_super_cache; } | |
366 oop* adr_secondary_supers()const { return (oop*)&_secondary_supers; } | |
367 oop* adr_java_mirror() const { return (oop*)&_java_mirror; } | |
368 oop* adr_subklass() const { return (oop*)&_subklass; } | |
369 oop* adr_next_sibling() const { return (oop*)&_next_sibling; } | |
370 | |
371 public: | |
372 // Allocation profiling support | |
373 juint alloc_count() const { return _alloc_count; } | |
374 void set_alloc_count(juint n) { _alloc_count = n; } | |
375 virtual juint alloc_size() const = 0; | |
376 virtual void set_alloc_size(juint n) = 0; | |
377 | |
378 // Compiler support | |
4762
069ab3f976d3
7118863: Move sizeof(klassOopDesc) into the *Klass::*_offset_in_bytes() functions
stefank
parents:
2376
diff
changeset
|
379 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
|
380 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
|
381 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
|
382 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
|
383 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
|
384 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
|
385 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
|
386 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
|
387 static ByteSize access_flags_offset() { return in_ByteSize(sizeof(klassOopDesc) + offset_of(Klass, _access_flags)); } |
0 | 388 |
389 // Unpacking layout_helper: | |
390 enum { | |
391 _lh_neutral_value = 0, // neutral non-array non-instance value | |
392 _lh_instance_slow_path_bit = 0x01, | |
393 _lh_log2_element_size_shift = BitsPerByte*0, | |
394 _lh_log2_element_size_mask = BitsPerLong-1, | |
395 _lh_element_type_shift = BitsPerByte*1, | |
396 _lh_element_type_mask = right_n_bits(BitsPerByte), // shifted mask | |
397 _lh_header_size_shift = BitsPerByte*2, | |
398 _lh_header_size_mask = right_n_bits(BitsPerByte), // shifted mask | |
399 _lh_array_tag_bits = 2, | |
400 _lh_array_tag_shift = BitsPerInt - _lh_array_tag_bits, | |
401 _lh_array_tag_type_value = ~0x00, // 0xC0000000 >> 30 | |
402 _lh_array_tag_obj_value = ~0x01 // 0x80000000 >> 30 | |
403 }; | |
404 | |
405 static int layout_helper_size_in_bytes(jint lh) { | |
406 assert(lh > (jint)_lh_neutral_value, "must be instance"); | |
407 return (int) lh & ~_lh_instance_slow_path_bit; | |
408 } | |
409 static bool layout_helper_needs_slow_path(jint lh) { | |
410 assert(lh > (jint)_lh_neutral_value, "must be instance"); | |
411 return (lh & _lh_instance_slow_path_bit) != 0; | |
412 } | |
413 static bool layout_helper_is_instance(jint lh) { | |
414 return (jint)lh > (jint)_lh_neutral_value; | |
415 } | |
416 static bool layout_helper_is_javaArray(jint lh) { | |
417 return (jint)lh < (jint)_lh_neutral_value; | |
418 } | |
419 static bool layout_helper_is_typeArray(jint lh) { | |
420 // _lh_array_tag_type_value == (lh >> _lh_array_tag_shift); | |
421 return (juint)lh >= (juint)(_lh_array_tag_type_value << _lh_array_tag_shift); | |
422 } | |
423 static bool layout_helper_is_objArray(jint lh) { | |
424 // _lh_array_tag_obj_value == (lh >> _lh_array_tag_shift); | |
425 return (jint)lh < (jint)(_lh_array_tag_type_value << _lh_array_tag_shift); | |
426 } | |
427 static int layout_helper_header_size(jint lh) { | |
428 assert(lh < (jint)_lh_neutral_value, "must be array"); | |
429 int hsize = (lh >> _lh_header_size_shift) & _lh_header_size_mask; | |
430 assert(hsize > 0 && hsize < (int)sizeof(oopDesc)*3, "sanity"); | |
431 return hsize; | |
432 } | |
433 static BasicType layout_helper_element_type(jint lh) { | |
434 assert(lh < (jint)_lh_neutral_value, "must be array"); | |
435 int btvalue = (lh >> _lh_element_type_shift) & _lh_element_type_mask; | |
436 assert(btvalue >= T_BOOLEAN && btvalue <= T_OBJECT, "sanity"); | |
437 return (BasicType) btvalue; | |
438 } | |
439 static int layout_helper_log2_element_size(jint lh) { | |
440 assert(lh < (jint)_lh_neutral_value, "must be array"); | |
441 int l2esz = (lh >> _lh_log2_element_size_shift) & _lh_log2_element_size_mask; | |
442 assert(l2esz <= LogBitsPerLong, "sanity"); | |
443 return l2esz; | |
444 } | |
445 static jint array_layout_helper(jint tag, int hsize, BasicType etype, int log2_esize) { | |
446 return (tag << _lh_array_tag_shift) | |
447 | (hsize << _lh_header_size_shift) | |
448 | ((int)etype << _lh_element_type_shift) | |
449 | (log2_esize << _lh_log2_element_size_shift); | |
450 } | |
451 static jint instance_layout_helper(jint size, bool slow_path_flag) { | |
452 return (size << LogHeapWordSize) | |
453 | (slow_path_flag ? _lh_instance_slow_path_bit : 0); | |
454 } | |
455 static int layout_helper_to_size_helper(jint lh) { | |
456 assert(lh > (jint)_lh_neutral_value, "must be instance"); | |
457 // Note that the following expression discards _lh_instance_slow_path_bit. | |
458 return lh >> LogHeapWordSize; | |
459 } | |
460 // Out-of-line version computes everything based on the etype: | |
461 static jint array_layout_helper(BasicType etype); | |
462 | |
463 // What is the maximum number of primary superclasses any klass can have? | |
464 #ifdef PRODUCT | |
465 static juint primary_super_limit() { return _primary_super_limit; } | |
466 #else | |
467 static juint primary_super_limit() { | |
468 assert(FastSuperclassLimit <= _primary_super_limit, "parameter oob"); | |
469 return FastSuperclassLimit; | |
470 } | |
471 #endif | |
472 | |
473 // vtables | |
474 virtual klassVtable* vtable() const { return NULL; } | |
475 | |
476 static int klass_size_in_bytes() { return offset_of(Klass, _alloc_count) + sizeof(juint); } // all "visible" fields | |
477 | |
478 // subclass check | |
479 bool is_subclass_of(klassOop k) const; | |
480 // subtype check: true if is_subclass_of, or if k is interface and receiver implements it | |
481 bool is_subtype_of(klassOop k) const { | |
482 juint off = k->klass_part()->super_check_offset(); | |
483 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
|
484 const juint secondary_offset = in_bytes(secondary_super_cache_offset()); |
0 | 485 if (sup == k) { |
486 return true; | |
487 } else if (off != secondary_offset) { | |
488 return false; | |
489 } else { | |
490 return search_secondary_supers(k); | |
491 } | |
492 } | |
493 bool search_secondary_supers(klassOop k) const; | |
494 | |
605 | 495 // Find LCA in class hierarchy |
0 | 496 Klass *LCA( Klass *k ); |
497 | |
498 // Check whether reflection/jni/jvm code is allowed to instantiate this class; | |
499 // if not, throw either an Error or an Exception. | |
500 virtual void check_valid_for_instantiation(bool throwError, TRAPS); | |
501 | |
502 // Casting | |
503 static Klass* cast(klassOop k) { | |
504 assert(k->is_klass(), "cast to Klass"); | |
505 return k->klass_part(); | |
506 } | |
507 | |
508 // array copying | |
509 virtual void copy_array(arrayOop s, int src_pos, arrayOop d, int dst_pos, int length, TRAPS); | |
510 | |
511 // tells if the class should be initialized | |
512 virtual bool should_be_initialized() const { return false; } | |
513 // initializes the klass | |
514 virtual void initialize(TRAPS); | |
515 // lookup operation for MethodLookupCache | |
516 friend class MethodLookupCache; | |
2177
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
1972
diff
changeset
|
517 virtual methodOop uncached_lookup_method(Symbol* name, Symbol* signature) const; |
0 | 518 public: |
2177
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
1972
diff
changeset
|
519 methodOop lookup_method(Symbol* name, Symbol* signature) const { |
0 | 520 return uncached_lookup_method(name, signature); |
521 } | |
522 | |
523 // array class with specific rank | |
524 klassOop array_klass(int rank, TRAPS) { return array_klass_impl(false, rank, THREAD); } | |
525 | |
526 // array class with this klass as element type | |
527 klassOop array_klass(TRAPS) { return array_klass_impl(false, THREAD); } | |
528 | |
529 // These will return NULL instead of allocating on the heap: | |
530 // NB: these can block for a mutex, like other functions with TRAPS arg. | |
531 klassOop array_klass_or_null(int rank); | |
532 klassOop array_klass_or_null(); | |
533 | |
534 virtual oop protection_domain() { return NULL; } | |
535 virtual oop class_loader() const { return NULL; } | |
536 | |
537 protected: | |
538 virtual klassOop array_klass_impl(bool or_null, int rank, TRAPS); | |
539 virtual klassOop array_klass_impl(bool or_null, TRAPS); | |
540 | |
541 public: | |
542 virtual void remove_unshareable_info(); | |
2177
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
1972
diff
changeset
|
543 virtual void shared_symbols_iterate(SymbolClosure* closure); |
0 | 544 |
545 protected: | |
546 // computes the subtype relationship | |
547 virtual bool compute_is_subtype_of(klassOop k); | |
548 public: | |
549 // subclass accessor (here for convenience; undefined for non-klass objects) | |
550 virtual bool is_leaf_class() const { fatal("not a class"); return false; } | |
551 public: | |
552 // ALL FUNCTIONS BELOW THIS POINT ARE DISPATCHED FROM AN OOP | |
553 // These functions describe behavior for the oop not the KLASS. | |
554 | |
555 // actual oop size of obj in memory | |
556 virtual int oop_size(oop obj) const = 0; | |
557 | |
558 // actual oop size of this klass in memory | |
559 virtual int klass_oop_size() const = 0; | |
560 | |
561 // Returns the Java name for a class (Resource allocated) | |
562 // For arrays, this returns the name of the element with a leading '['. | |
563 // For classes, this returns the name with the package separators | |
564 // turned into '.'s. | |
565 const char* external_name() const; | |
566 // Returns the name for a class (Resource allocated) as the class | |
567 // would appear in a signature. | |
568 // For arrays, this returns the name of the element with a leading '['. | |
569 // For classes, this returns the name with a leading 'L' and a trailing ';' | |
570 // and the package separators as '/'. | |
1039
987e948ebbc8
6815692: method handle code needs some cleanup (post-6655638)
jrose
parents:
628
diff
changeset
|
571 virtual const char* signature_name() const; |
0 | 572 |
573 // garbage collection support | |
574 virtual void oop_follow_contents(oop obj) = 0; | |
575 virtual int oop_adjust_pointers(oop obj) = 0; | |
576 | |
577 // Parallel Scavenge and Parallel Old | |
578 PARALLEL_GC_DECLS_PV | |
579 | |
580 public: | |
581 // type testing operations | |
582 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
|
583 virtual bool oop_is_instanceMirror() const { return false; } |
0 | 584 virtual bool oop_is_instanceRef() const { return false; } |
585 virtual bool oop_is_array() const { return false; } | |
586 virtual bool oop_is_objArray_slow() const { return false; } | |
587 virtual bool oop_is_klass() const { return false; } | |
588 virtual bool oop_is_thread() const { return false; } | |
589 virtual bool oop_is_method() const { return false; } | |
590 virtual bool oop_is_constMethod() const { return false; } | |
591 virtual bool oop_is_methodData() const { return false; } | |
592 virtual bool oop_is_constantPool() const { return false; } | |
593 virtual bool oop_is_constantPoolCache() const { return false; } | |
594 virtual bool oop_is_typeArray_slow() const { return false; } | |
595 virtual bool oop_is_arrayKlass() const { return false; } | |
596 virtual bool oop_is_objArrayKlass() const { return false; } | |
597 virtual bool oop_is_typeArrayKlass() const { return false; } | |
598 virtual bool oop_is_compiledICHolder() const { return false; } | |
599 virtual bool oop_is_instanceKlass() const { return false; } | |
600 | |
601 bool oop_is_javaArray_slow() const { | |
602 return oop_is_objArray_slow() || oop_is_typeArray_slow(); | |
603 } | |
604 | |
605 // Fast non-virtual versions, used by oop.inline.hpp and elsewhere: | |
606 #ifndef ASSERT | |
607 #define assert_same_query(xval, xcheck) xval | |
608 #else | |
609 private: | |
610 static bool assert_same_query(bool xval, bool xslow) { | |
611 assert(xval == xslow, "slow and fast queries agree"); | |
612 return xval; | |
613 } | |
614 public: | |
615 #endif | |
616 inline bool oop_is_instance() const { return assert_same_query( | |
617 layout_helper_is_instance(layout_helper()), | |
618 oop_is_instance_slow()); } | |
619 inline bool oop_is_javaArray() const { return assert_same_query( | |
620 layout_helper_is_javaArray(layout_helper()), | |
621 oop_is_javaArray_slow()); } | |
622 inline bool oop_is_objArray() const { return assert_same_query( | |
623 layout_helper_is_objArray(layout_helper()), | |
624 oop_is_objArray_slow()); } | |
625 inline bool oop_is_typeArray() const { return assert_same_query( | |
626 layout_helper_is_typeArray(layout_helper()), | |
627 oop_is_typeArray_slow()); } | |
628 #undef assert_same_query | |
629 | |
630 // 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
|
631 // Parsability of an object is object specific. |
0 | 632 virtual bool oop_is_parsable(oop obj) const { return true; } |
633 | |
518
0af8b0718fc9
6692899: CMS: many vm.parallel_class_loading tests fail with assert "missing Printezis mark"
jmasa
parents:
356
diff
changeset
|
634 // 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
|
635 // 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
|
636 // 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
|
637 // 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
|
638 // 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
|
639 // 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
|
640 // 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
|
641 // 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
|
642 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
|
643 |
0 | 644 // Access flags |
645 AccessFlags access_flags() const { return _access_flags; } | |
646 void set_access_flags(AccessFlags flags) { _access_flags = flags; } | |
647 | |
648 bool is_public() const { return _access_flags.is_public(); } | |
649 bool is_final() const { return _access_flags.is_final(); } | |
650 bool is_interface() const { return _access_flags.is_interface(); } | |
651 bool is_abstract() const { return _access_flags.is_abstract(); } | |
652 bool is_super() const { return _access_flags.is_super(); } | |
653 bool is_synthetic() const { return _access_flags.is_synthetic(); } | |
654 void set_is_synthetic() { _access_flags.set_is_synthetic(); } | |
655 bool has_finalizer() const { return _access_flags.has_finalizer(); } | |
656 bool has_final_method() const { return _access_flags.has_final_method(); } | |
657 void set_has_finalizer() { _access_flags.set_has_finalizer(); } | |
658 void set_has_final_method() { _access_flags.set_has_final_method(); } | |
659 bool is_cloneable() const { return _access_flags.is_cloneable(); } | |
660 void set_is_cloneable() { _access_flags.set_is_cloneable(); } | |
661 bool has_vanilla_constructor() const { return _access_flags.has_vanilla_constructor(); } | |
662 void set_has_vanilla_constructor() { _access_flags.set_has_vanilla_constructor(); } | |
663 bool has_miranda_methods () const { return access_flags().has_miranda_methods(); } | |
664 void set_has_miranda_methods() { _access_flags.set_has_miranda_methods(); } | |
665 | |
666 // Biased locking support | |
667 // Note: the prototype header is always set up to be at least the | |
668 // prototype markOop. If biased locking is enabled it may further be | |
669 // biasable and have an epoch. | |
670 markOop prototype_header() const { return _prototype_header; } | |
671 // NOTE: once instances of this klass are floating around in the | |
672 // system, this header must only be updated at a safepoint. | |
673 // NOTE 2: currently we only ever set the prototype header to the | |
674 // biasable prototype for instanceKlasses. There is no technical | |
675 // reason why it could not be done for arrayKlasses aside from | |
676 // wanting to reduce the initial scope of this optimization. There | |
677 // are potential problems in setting the bias pattern for | |
678 // JVM-internal oops. | |
679 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
|
680 static ByteSize prototype_header_offset() { return in_ByteSize(sizeof(klassOopDesc) + offset_of(Klass, _prototype_header)); } |
0 | 681 |
682 int biased_lock_revocation_count() const { return (int) _biased_lock_revocation_count; } | |
683 // Atomically increments biased_lock_revocation_count and returns updated value | |
684 int atomic_incr_biased_lock_revocation_count(); | |
685 void set_biased_lock_revocation_count(int val) { _biased_lock_revocation_count = (jint) val; } | |
686 jlong last_biased_lock_bulk_revocation_time() { return _last_biased_lock_bulk_revocation_time; } | |
687 void set_last_biased_lock_bulk_revocation_time(jlong cur_time) { _last_biased_lock_bulk_revocation_time = cur_time; } | |
688 | |
4800
94ec88ca68e2
7115199: Add event tracing hooks and Java Flight Recorder infrastructure
phh
parents:
2376
diff
changeset
|
689 TRACE_DEFINE_KLASS_METHODS; |
0 | 690 |
691 // garbage collection support | |
692 virtual void follow_weak_klass_links( | |
693 BoolObjectClosure* is_alive, OopClosure* keep_alive); | |
694 | |
695 // Prefetch within oop iterators. This is a macro because we | |
696 // can't guarantee that the compiler will inline it. In 64-bit | |
697 // it generally doesn't. Signature is | |
698 // | |
699 // static void prefetch_beyond(oop* const start, | |
700 // oop* const end, | |
701 // const intx foffset, | |
702 // const Prefetch::style pstyle); | |
703 #define prefetch_beyond(start, end, foffset, pstyle) { \ | |
704 const intx foffset_ = (foffset); \ | |
705 const Prefetch::style pstyle_ = (pstyle); \ | |
706 assert(foffset_ > 0, "prefetch beyond, not behind"); \ | |
707 if (pstyle_ != Prefetch::do_none) { \ | |
708 oop* ref = (start); \ | |
709 if (ref < (end)) { \ | |
710 switch (pstyle_) { \ | |
711 case Prefetch::do_read: \ | |
712 Prefetch::read(*ref, foffset_); \ | |
713 break; \ | |
714 case Prefetch::do_write: \ | |
715 Prefetch::write(*ref, foffset_); \ | |
716 break; \ | |
717 default: \ | |
718 ShouldNotReachHere(); \ | |
719 break; \ | |
720 } \ | |
721 } \ | |
722 } \ | |
723 } | |
724 | |
725 // iterators | |
726 virtual int oop_oop_iterate(oop obj, OopClosure* blk) = 0; | |
727 virtual int oop_oop_iterate_v(oop obj, OopClosure* blk) { | |
728 return oop_oop_iterate(obj, blk); | |
729 } | |
730 | |
342
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
113
diff
changeset
|
731 #ifndef SERIALGC |
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
113
diff
changeset
|
732 // 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
|
733 // iteration. |
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
113
diff
changeset
|
734 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
|
735 return oop_oop_iterate_v(obj, blk); |
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
113
diff
changeset
|
736 } |
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
113
diff
changeset
|
737 #endif // !SERIALGC |
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
113
diff
changeset
|
738 |
0 | 739 // Iterates "blk" over all the oops in "obj" (of type "this") within "mr". |
740 // (I don't see why the _m should be required, but without it the Solaris | |
741 // C++ gives warning messages about overridings of the "oop_oop_iterate" | |
742 // defined above "hiding" this virtual function. (DLD, 6/20/00)) */ | |
743 virtual int oop_oop_iterate_m(oop obj, OopClosure* blk, MemRegion mr) = 0; | |
744 virtual int oop_oop_iterate_v_m(oop obj, OopClosure* blk, MemRegion mr) { | |
745 return oop_oop_iterate_m(obj, blk, mr); | |
746 } | |
747 | |
748 // Versions of the above iterators specialized to particular subtypes | |
749 // of OopClosure, to avoid closure virtual calls. | |
750 #define Klass_OOP_OOP_ITERATE_DECL(OopClosureType, nv_suffix) \ | |
751 virtual int oop_oop_iterate##nv_suffix(oop obj, OopClosureType* blk) { \ | |
752 /* Default implementation reverts to general version. */ \ | |
753 return oop_oop_iterate(obj, blk); \ | |
754 } \ | |
755 \ | |
756 /* Iterates "blk" over all the oops in "obj" (of type "this") within "mr". \ | |
757 (I don't see why the _m should be required, but without it the Solaris \ | |
758 C++ gives warning messages about overridings of the "oop_oop_iterate" \ | |
759 defined above "hiding" this virtual function. (DLD, 6/20/00)) */ \ | |
760 virtual int oop_oop_iterate##nv_suffix##_m(oop obj, \ | |
761 OopClosureType* blk, \ | |
762 MemRegion mr) { \ | |
763 return oop_oop_iterate_m(obj, blk, mr); \ | |
764 } | |
765 | |
766 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
|
767 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
|
768 |
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
113
diff
changeset
|
769 #ifndef SERIALGC |
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
113
diff
changeset
|
770 #define Klass_OOP_OOP_ITERATE_BACKWARDS_DECL(OopClosureType, nv_suffix) \ |
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
113
diff
changeset
|
771 virtual int oop_oop_iterate_backwards##nv_suffix(oop obj, \ |
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
113
diff
changeset
|
772 OopClosureType* blk) { \ |
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
113
diff
changeset
|
773 /* Default implementation reverts to general version. */ \ |
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
113
diff
changeset
|
774 return oop_oop_iterate_backwards_v(obj, blk); \ |
37f87013dfd8
6711316: Open source the Garbage-First garbage collector
ysr
parents:
113
diff
changeset
|
775 } |
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 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
|
778 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
|
779 #endif // !SERIALGC |
0 | 780 |
781 virtual void array_klasses_do(void f(klassOop k)) {} | |
782 virtual void with_array_klasses_do(void f(klassOop k)); | |
783 | |
784 // Return self, except for abstract classes with exactly 1 | |
785 // implementor. Then return the 1 concrete implementation. | |
786 Klass *up_cast_abstract(); | |
787 | |
788 // klass name | |
2177
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
1972
diff
changeset
|
789 Symbol* name() const { return _name; } |
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
1972
diff
changeset
|
790 void set_name(Symbol* n); |
0 | 791 |
792 friend class klassKlass; | |
793 | |
794 public: | |
795 // jvm support | |
796 virtual jint compute_modifier_flags(TRAPS) const; | |
797 | |
798 // JVMTI support | |
799 virtual jint jvmti_class_status() const; | |
800 | |
801 // Printing | |
1155
4e6abf09f540
6912062: disassembler plugin needs to produce symbolic information in product mode
jrose
parents:
1039
diff
changeset
|
802 virtual void oop_print_value_on(oop obj, outputStream* st); |
0 | 803 virtual void oop_print_on (oop obj, outputStream* st); |
804 | |
805 // Verification | |
806 virtual const char* internal_name() const = 0; | |
807 virtual void oop_verify_on(oop obj, outputStream* st); | |
808 // tells whether obj is partially constructed (gc during class loading) | |
809 virtual bool oop_partially_loaded(oop obj) const { return false; } | |
810 virtual void oop_set_partially_loaded(oop obj) {}; | |
811 | |
812 #ifndef PRODUCT | |
813 void verify_vtable_index(int index); | |
814 #endif | |
815 }; | |
1972 | 816 |
2376
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
2177
diff
changeset
|
817 |
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
2177
diff
changeset
|
818 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
|
819 |
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
2177
diff
changeset
|
820 |
1972 | 821 #endif // SHARE_VM_OOPS_KLASS_HPP |