annotate src/share/vm/oops/instanceKlass.hpp @ 5820:87ee5ee27509

Added tag jdk8-b132 for changeset 0c94c41dcd70
author katleman
date Tue, 04 Mar 2014 11:51:03 -0800
parents 379f11bc04fc
children
rev   line source
duke@0 1 /*
acorn@4062 2 * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
duke@0 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
duke@0 4 *
duke@0 5 * This code is free software; you can redistribute it and/or modify it
duke@0 6 * under the terms of the GNU General Public License version 2 only, as
duke@0 7 * published by the Free Software Foundation.
duke@0 8 *
duke@0 9 * This code is distributed in the hope that it will be useful, but WITHOUT
duke@0 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
duke@0 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
duke@0 12 * version 2 for more details (a copy is included in the LICENSE file that
duke@0 13 * accompanied this code).
duke@0 14 *
duke@0 15 * You should have received a copy of the GNU General Public License version
duke@0 16 * 2 along with this work; if not, write to the Free Software Foundation,
duke@0 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
duke@0 18 *
trims@1472 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
trims@1472 20 * or visit www.oracle.com if you need additional information or have any
trims@1472 21 * questions.
duke@0 22 *
duke@0 23 */
duke@0 24
stefank@1879 25 #ifndef SHARE_VM_OOPS_INSTANCEKLASS_HPP
stefank@1879 26 #define SHARE_VM_OOPS_INSTANCEKLASS_HPP
stefank@1879 27
coleenp@3602 28 #include "classfile/classLoaderData.hpp"
sla@4802 29 #include "memory/referenceType.hpp"
coleenp@3602 30 #include "oops/annotations.hpp"
coleenp@3602 31 #include "oops/constMethod.hpp"
never@2702 32 #include "oops/fieldInfo.hpp"
stefank@1879 33 #include "oops/instanceOop.hpp"
stefank@1879 34 #include "oops/klassVtable.hpp"
zgu@3965 35 #include "runtime/atomic.hpp"
stefank@1879 36 #include "runtime/handles.hpp"
stefank@1879 37 #include "runtime/os.hpp"
stefank@1879 38 #include "utilities/accessFlags.hpp"
stefank@1879 39 #include "utilities/bitMap.inline.hpp"
jprovino@4107 40 #include "utilities/macros.hpp"
sla@4802 41 #include "trace/traceMacros.hpp"
stefank@1879 42
coleenp@3602 43 // An InstanceKlass is the VM level representation of a Java class.
duke@0 44 // It contains all information needed for at class at execution runtime.
duke@0 45
coleenp@3602 46 // InstanceKlass layout:
duke@0 47 // [C++ vtbl pointer ] Klass
duke@0 48 // [subtype cache ] Klass
duke@0 49 // [instance size ] Klass
duke@0 50 // [java mirror ] Klass
duke@0 51 // [super ] Klass
duke@0 52 // [access_flags ] Klass
duke@0 53 // [name ] Klass
duke@0 54 // [first subklass ] Klass
duke@0 55 // [next sibling ] Klass
duke@0 56 // [array klasses ]
duke@0 57 // [methods ]
duke@0 58 // [local interfaces ]
duke@0 59 // [transitive interfaces ]
duke@0 60 // [fields ]
duke@0 61 // [constants ]
duke@0 62 // [class loader ]
duke@0 63 // [source file name ]
duke@0 64 // [inner classes ]
duke@0 65 // [static field size ]
duke@0 66 // [nonstatic field size ]
duke@0 67 // [static oop fields size ]
duke@0 68 // [nonstatic oop maps size ]
duke@0 69 // [has finalize method ]
duke@0 70 // [deoptimization mark bit ]
duke@0 71 // [initialization state ]
duke@0 72 // [initializing thread ]
duke@0 73 // [Java vtable length ]
duke@0 74 // [oop map cache (stack maps) ]
duke@0 75 // [EMBEDDED Java vtable ] size in words = vtable_len
duke@0 76 // [EMBEDDED nonstatic oop-map blocks] size in words = nonstatic_oop_map_size
jiangli@3266 77 // The embedded nonstatic oop-map blocks are short pairs (offset, length)
jiangli@3266 78 // indicating where oops are located in instances of this klass.
jiangli@3266 79 // [EMBEDDED implementor of the interface] only exist for interface
jiangli@3306 80 // [EMBEDDED host klass ] only exist for an anonymous class (JSR 292 enabled)
duke@0 81
duke@0 82
duke@0 83 // forward declaration for class -- see below for definition
duke@0 84 class SuperTypeClosure;
duke@0 85 class JNIid;
duke@0 86 class jniIdMapBase;
duke@0 87 class BreakpointInfo;
duke@0 88 class fieldDescriptor;
duke@0 89 class DepChange;
duke@0 90 class nmethodBucket;
duke@0 91 class PreviousVersionNode;
duke@0 92 class JvmtiCachedClassFieldMap;
sspitsyn@4530 93 class MemberNameTable;
duke@0 94
duke@0 95 // This is used in iterators below.
duke@0 96 class FieldClosure: public StackObj {
duke@0 97 public:
duke@0 98 virtual void do_field(fieldDescriptor* fd) = 0;
duke@0 99 };
duke@0 100
duke@0 101 #ifndef PRODUCT
duke@0 102 // Print fields.
duke@0 103 // If "obj" argument to constructor is NULL, prints static fields, otherwise prints non-static fields.
duke@0 104 class FieldPrinter: public FieldClosure {
duke@0 105 oop _obj;
duke@0 106 outputStream* _st;
duke@0 107 public:
duke@0 108 FieldPrinter(outputStream* st, oop obj = NULL) : _obj(obj), _st(st) {}
duke@0 109 void do_field(fieldDescriptor* fd);
duke@0 110 };
duke@0 111 #endif // !PRODUCT
duke@0 112
jcoomes@938 113 // ValueObjs embedded in klass. Describes where oops are located in instances of
jcoomes@938 114 // this klass.
jcoomes@938 115 class OopMapBlock VALUE_OBJ_CLASS_SPEC {
jcoomes@938 116 public:
jcoomes@938 117 // Byte offset of the first oop mapped by this block.
jcoomes@939 118 int offset() const { return _offset; }
jcoomes@939 119 void set_offset(int offset) { _offset = offset; }
jcoomes@938 120
jcoomes@938 121 // Number of oops in this block.
jcoomes@939 122 uint count() const { return _count; }
jcoomes@939 123 void set_count(uint count) { _count = count; }
jcoomes@938 124
jcoomes@938 125 // sizeof(OopMapBlock) in HeapWords.
jcoomes@938 126 static const int size_in_words() {
jcoomes@938 127 return align_size_up(int(sizeof(OopMapBlock)), HeapWordSize) >>
jcoomes@938 128 LogHeapWordSize;
jcoomes@938 129 }
jcoomes@938 130
jcoomes@938 131 private:
jcoomes@939 132 int _offset;
jcoomes@939 133 uint _count;
jcoomes@938 134 };
jcoomes@938 135
jiangli@4986 136 struct JvmtiCachedClassFileData;
jiangli@4986 137
coleenp@3602 138 class InstanceKlass: public Klass {
duke@0 139 friend class VMStructs;
coleenp@3602 140 friend class ClassFileParser;
minqi@3832 141 friend class CompileReplay;
coleenp@3602 142
coleenp@3602 143 protected:
coleenp@3602 144 // Constructor
coleenp@3602 145 InstanceKlass(int vtable_len,
coleenp@3602 146 int itable_len,
coleenp@3602 147 int static_field_size,
coleenp@3602 148 int nonstatic_oop_map_size,
coleenp@3602 149 ReferenceType rt,
coleenp@3602 150 AccessFlags access_flags,
coleenp@3602 151 bool is_anonymous);
duke@0 152 public:
coleenp@4284 153 static InstanceKlass* allocate_instance_klass(
coleenp@4284 154 ClassLoaderData* loader_data,
coleenp@3602 155 int vtable_len,
coleenp@3602 156 int itable_len,
coleenp@3602 157 int static_field_size,
coleenp@3602 158 int nonstatic_oop_map_size,
coleenp@3602 159 ReferenceType rt,
coleenp@3602 160 AccessFlags access_flags,
coleenp@3602 161 Symbol* name,
coleenp@4137 162 Klass* super_klass,
coleenp@4137 163 bool is_anonymous,
coleenp@3602 164 TRAPS);
coleenp@3602 165
coleenp@3602 166 InstanceKlass() { assert(DumpSharedSpaces || UseSharedSpaces, "only for CDS"); }
coleenp@3602 167
duke@0 168 // See "The Java Virtual Machine Specification" section 2.16.2-5 for a detailed description
duke@0 169 // of the class loading & initialization procedure, and the use of the states.
duke@0 170 enum ClassState {
duke@0 171 allocated, // allocated (but not yet linked)
duke@0 172 loaded, // loaded and inserted in class hierarchy (but not linked yet)
duke@0 173 linked, // successfully linked/verified (but not initialized yet)
duke@0 174 being_initialized, // currently running class initializer
duke@0 175 fully_initialized, // initialized (successfull final state)
duke@0 176 initialization_error // error happened during initialization
duke@0 177 };
duke@0 178
zgu@3965 179 static int number_of_instance_classes() { return _total_instanceKlass_count; }
zgu@3965 180
zgu@3965 181 private:
zgu@3965 182 static volatile int _total_instanceKlass_count;
zgu@3965 183
duke@0 184 protected:
coleenp@3602 185 // Annotations for this class
coleenp@3602 186 Annotations* _annotations;
coleenp@3602 187 // Array classes holding elements of this class.
coleenp@3602 188 Klass* _array_klasses;
coleenp@3602 189 // Constant pool for this class.
coleenp@3602 190 ConstantPool* _constants;
jiangli@3235 191 // The InnerClasses attribute and EnclosingMethod attribute. The
jiangli@3235 192 // _inner_classes is an array of shorts. If the class has InnerClasses
jiangli@3235 193 // attribute, then the _inner_classes array begins with 4-tuples of shorts
jiangli@3235 194 // [inner_class_info_index, outer_class_info_index,
jiangli@3235 195 // inner_name_index, inner_class_access_flags] for the InnerClasses
jiangli@3235 196 // attribute. If the EnclosingMethod attribute exists, it occupies the
jiangli@3235 197 // last two shorts [class_index, method_index] of the array. If only
jiangli@3235 198 // the InnerClasses attribute exists, the _inner_classes array length is
jiangli@3235 199 // number_of_inner_classes * 4. If the class has both InnerClasses
jiangli@3235 200 // and EnclosingMethod attributes the _inner_classes array length is
jiangli@3235 201 // number_of_inner_classes * 4 + enclosing_method_attribute_size.
coleenp@3602 202 Array<jushort>* _inner_classes;
duke@0 203
coleenp@2062 204 // the source debug extension for this klass, NULL if not specified.
fparain@3471 205 // Specified as UTF-8 string without terminating zero byte in the classfile,
fparain@3471 206 // it is stored in the instanceklass as a NULL-terminated UTF-8 string
fparain@3471 207 char* _source_debug_extension;
coleenp@2062 208 // Array name derived from this class which needs unreferencing
coleenp@2062 209 // if this class is unloaded.
coleenp@2062 210 Symbol* _array_name;
coleenp@2062 211
kvn@165 212 // Number of heapOopSize words used by non-static fields in this klass
kvn@165 213 // (including inherited fields but after header_size()).
coleenp@113 214 int _nonstatic_field_size;
coleenp@113 215 int _static_field_size; // number words used by static fields (oop and non-oop) in this klass
jiangli@5100 216 // Constant pool index to the utf8 entry of the Generic signature,
jiangli@5100 217 // or 0 if none.
jiangli@5100 218 u2 _generic_signature_index;
jiangli@5100 219 // Constant pool index to the utf8 entry for the name of source file
jiangli@5100 220 // containing this klass, 0 if not specified.
jiangli@5100 221 u2 _source_file_name_index;
jiangli@2938 222 u2 _static_oop_field_count;// number of static oop fields in this klass
jiangli@2938 223 u2 _java_fields_count; // The number of declared Java fields
jcoomes@938 224 int _nonstatic_oop_map_size;// size in words of nonstatic oop map blocks
coleenp@2931 225
jiangli@4001 226 // _is_marked_dependent can be set concurrently, thus cannot be part of the
jiangli@4001 227 // _misc_flags.
dcubed@2966 228 bool _is_marked_dependent; // used for marking during flushing and deoptimization
jiangli@4001 229
jiangli@3306 230 enum {
jiangli@3306 231 _misc_rewritten = 1 << 0, // methods rewritten.
jiangli@3306 232 _misc_has_nonstatic_fields = 1 << 1, // for sizing with UseCompressedOops
jiangli@3306 233 _misc_should_verify_class = 1 << 2, // allow caching of preverification
coleenp@4546 234 _misc_is_anonymous = 1 << 3, // has embedded _host_klass field
dlong@4004 235 _misc_is_contended = 1 << 4, // marked with contended annotation
dlong@4004 236 _misc_has_default_methods = 1 << 5 // class/superclass/implemented interfaces has default methods
jiangli@3306 237 };
jiangli@3306 238 u2 _misc_flags;
duke@0 239 u2 _minor_version; // minor version number of class file
duke@0 240 u2 _major_version; // major version number of class file
duke@0 241 Thread* _init_thread; // Pointer to current thread doing initialization (to handle recusive initialization)
duke@0 242 int _vtable_len; // length of Java vtable (in words)
duke@0 243 int _itable_len; // length of Java itable (in words)
duke@0 244 OopMapCache* volatile _oop_map_cache; // OopMapCache for all methods in the klass (allocated lazily)
sspitsyn@4530 245 MemberNameTable* _member_names; // Member names
duke@0 246 JNIid* _jni_ids; // First JNI identifier for static fields in this class
duke@0 247 jmethodID* _methods_jmethod_ids; // jmethodIDs corresponding to method_idnum, or NULL if none
duke@0 248 nmethodBucket* _dependencies; // list of dependent nmethods
duke@0 249 nmethod* _osr_nmethods_head; // Head of list of on-stack replacement nmethods for this class
coleenp@3602 250 BreakpointInfo* _breakpoints; // bpt lists, managed by Method*
duke@0 251 // Array of interesting part(s) of the previous version(s) of this
coleenp@3602 252 // InstanceKlass. See PreviousVersionWalker below.
duke@0 253 GrowableArray<PreviousVersionNode *>* _previous_versions;
duke@0 254 // JVMTI fields can be moved to their own structure - see 6315920
jiangli@4986 255 // JVMTI: cached class file, before retransformable agent modified it in CFLH
jiangli@4986 256 JvmtiCachedClassFileData* _cached_class_file;
iklam@4074 257
iklam@4074 258 volatile u2 _idnum_allocated_count; // JNI/JVMTI: increments with the addition of methods, old ids don't change
iklam@4074 259
iklam@4074 260 // Class states are defined as ClassState (see above).
iklam@4074 261 // Place the _init_state here to utilize the unused 2-byte after
iklam@4074 262 // _idnum_allocated_count.
iklam@4074 263 u1 _init_state; // state of class
iklam@4074 264 u1 _reference_type; // reference type
iklam@4074 265
duke@0 266 JvmtiCachedClassFieldMap* _jvmti_cached_class_field_map; // JVMTI: used during heap iteration
kamg@3810 267
coleenp@4277 268 NOT_PRODUCT(int _verify_count;) // to avoid redundant verifies
coleenp@4277 269
coleenp@3602 270 // Method array.
coleenp@3602 271 Array<Method*>* _methods;
acorn@5413 272 // Default Method Array, concrete methods inherited from interfaces
acorn@5413 273 Array<Method*>* _default_methods;
coleenp@3602 274 // Interface (Klass*s) this class declares locally to implement.
coleenp@3602 275 Array<Klass*>* _local_interfaces;
coleenp@3602 276 // Interface (Klass*s) this class implements transitively.
coleenp@3602 277 Array<Klass*>* _transitive_interfaces;
coleenp@3602 278 // Int array containing the original order of method in the class file (for JVMTI).
coleenp@3602 279 Array<int>* _method_ordering;
acorn@5413 280 // Int array containing the vtable_indices for default_methods
acorn@5413 281 // offset matches _default_methods offset
acorn@5413 282 Array<int>* _default_vtable_indices;
acorn@5413 283
coleenp@3602 284 // Instance and static variable information, starts with 6-tuples of shorts
coleenp@3602 285 // [access, name index, sig index, initval index, low_offset, high_offset]
coleenp@3602 286 // for all fields, followed by the generic signature data at the end of
coleenp@3602 287 // the array. Only fields with generic signature attributes have the generic
coleenp@3602 288 // signature data set in the array. The fields array looks like following:
coleenp@3602 289 //
coleenp@3602 290 // f1: [access, name index, sig index, initial value index, low_offset, high_offset]
coleenp@3602 291 // f2: [access, name index, sig index, initial value index, low_offset, high_offset]
coleenp@3602 292 // ...
coleenp@3602 293 // fn: [access, name index, sig index, initial value index, low_offset, high_offset]
coleenp@3602 294 // [generic signature index]
coleenp@3602 295 // [generic signature index]
coleenp@3602 296 // ...
coleenp@3602 297 Array<u2>* _fields;
duke@0 298
duke@0 299 // embedded Java vtable follows here
duke@0 300 // embedded Java itables follows here
duke@0 301 // embedded static fields follows here
duke@0 302 // embedded nonstatic oop-map blocks follows here
jiangli@3266 303 // embedded implementor of this interface follows here
jiangli@3266 304 // The embedded implementor only exists if the current klass is an
jiangli@3266 305 // iterface. The possible values of the implementor fall into following
jiangli@3266 306 // three cases:
jiangli@3266 307 // NULL: no implementor.
coleenp@3602 308 // A Klass* that's not itself: one implementor.
jiangli@3266 309 // Itsef: more than one implementors.
jiangli@3306 310 // embedded host klass follows here
jiangli@3306 311 // The embedded host klass only exists in an anonymous class for
jiangli@3306 312 // dynamic language support (JSR 292 enabled). The host class grants
jiangli@3306 313 // its access privileges to this class also. The host class is either
jiangli@3306 314 // named, or a previously loaded anonymous class. A non-anonymous class
jiangli@3306 315 // or an anonymous class loaded through normal classloading does not
jiangli@3306 316 // have this embedded field.
jiangli@3306 317 //
duke@0 318
duke@0 319 friend class SystemDictionary;
duke@0 320
duke@0 321 public:
jiangli@3306 322 bool has_nonstatic_fields() const {
jiangli@3306 323 return (_misc_flags & _misc_has_nonstatic_fields) != 0;
jiangli@3306 324 }
jiangli@3306 325 void set_has_nonstatic_fields(bool b) {
jiangli@3306 326 if (b) {
jiangli@3306 327 _misc_flags |= _misc_has_nonstatic_fields;
jiangli@3306 328 } else {
jiangli@3306 329 _misc_flags &= ~_misc_has_nonstatic_fields;
jiangli@3306 330 }
jiangli@3306 331 }
coleenp@113 332
duke@0 333 // field sizes
duke@0 334 int nonstatic_field_size() const { return _nonstatic_field_size; }
duke@0 335 void set_nonstatic_field_size(int size) { _nonstatic_field_size = size; }
duke@0 336
duke@0 337 int static_field_size() const { return _static_field_size; }
duke@0 338 void set_static_field_size(int size) { _static_field_size = size; }
duke@0 339
jiangli@2938 340 int static_oop_field_count() const { return (int)_static_oop_field_count; }
jiangli@2938 341 void set_static_oop_field_count(u2 size) { _static_oop_field_count = size; }
duke@0 342
duke@0 343 // Java vtable
duke@0 344 int vtable_length() const { return _vtable_len; }
duke@0 345 void set_vtable_length(int len) { _vtable_len = len; }
duke@0 346
duke@0 347 // Java itable
duke@0 348 int itable_length() const { return _itable_len; }
duke@0 349 void set_itable_length(int len) { _itable_len = len; }
duke@0 350
duke@0 351 // array klasses
coleenp@3602 352 Klass* array_klasses() const { return _array_klasses; }
coleenp@3602 353 void set_array_klasses(Klass* k) { _array_klasses = k; }
duke@0 354
duke@0 355 // methods
coleenp@3602 356 Array<Method*>* methods() const { return _methods; }
coleenp@3602 357 void set_methods(Array<Method*>* a) { _methods = a; }
coleenp@3602 358 Method* method_with_idnum(int idnum);
duke@0 359
duke@0 360 // method ordering
coleenp@3602 361 Array<int>* method_ordering() const { return _method_ordering; }
coleenp@3602 362 void set_method_ordering(Array<int>* m) { _method_ordering = m; }
coleenp@4284 363 void copy_method_ordering(intArray* m, TRAPS);
duke@0 364
acorn@5413 365 // default_methods
acorn@5413 366 Array<Method*>* default_methods() const { return _default_methods; }
acorn@5413 367 void set_default_methods(Array<Method*>* a) { _default_methods = a; }
acorn@5413 368
acorn@5413 369 // default method vtable_indices
acorn@5413 370 Array<int>* default_vtable_indices() const { return _default_vtable_indices; }
acorn@5413 371 void set_default_vtable_indices(Array<int>* v) { _default_vtable_indices = v; }
acorn@5413 372 Array<int>* create_new_default_vtable_indices(int len, TRAPS);
acorn@5413 373
duke@0 374 // interfaces
coleenp@3602 375 Array<Klass*>* local_interfaces() const { return _local_interfaces; }
coleenp@3602 376 void set_local_interfaces(Array<Klass*>* a) {
coleenp@3602 377 guarantee(_local_interfaces == NULL || a == NULL, "Just checking");
coleenp@3602 378 _local_interfaces = a; }
coleenp@4284 379
coleenp@3602 380 Array<Klass*>* transitive_interfaces() const { return _transitive_interfaces; }
coleenp@3602 381 void set_transitive_interfaces(Array<Klass*>* a) {
coleenp@3602 382 guarantee(_transitive_interfaces == NULL || a == NULL, "Just checking");
coleenp@4284 383 _transitive_interfaces = a;
coleenp@4284 384 }
duke@0 385
never@2702 386 private:
never@2702 387 friend class fieldDescriptor;
never@2702 388 FieldInfo* field(int index) const { return FieldInfo::from_field_array(_fields, index); }
never@2702 389
never@2702 390 public:
never@2702 391 int field_offset (int index) const { return field(index)->offset(); }
never@2702 392 int field_access_flags(int index) const { return field(index)->access_flags(); }
never@2702 393 Symbol* field_name (int index) const { return field(index)->name(constants()); }
never@2702 394 Symbol* field_signature (int index) const { return field(index)->signature(constants()); }
never@2702 395
never@2702 396 // Number of Java declared fields
jiangli@2938 397 int java_fields_count() const { return (int)_java_fields_count; }
never@2702 398
coleenp@3602 399 Array<u2>* fields() const { return _fields; }
coleenp@3602 400 void set_fields(Array<u2>* f, u2 java_fields_count) {
coleenp@3602 401 guarantee(_fields == NULL || f == NULL, "Just checking");
coleenp@4284 402 _fields = f;
never@2702 403 _java_fields_count = java_fields_count;
duke@0 404 }
duke@0 405
duke@0 406 // inner classes
coleenp@3602 407 Array<u2>* inner_classes() const { return _inner_classes; }
coleenp@3602 408 void set_inner_classes(Array<u2>* f) { _inner_classes = f; }
duke@0 409
duke@0 410 enum InnerClassAttributeOffset {
duke@0 411 // From http://mirror.eng/products/jdk/1.1/docs/guide/innerclasses/spec/innerclasses.doc10.html#18814
duke@0 412 inner_class_inner_class_info_offset = 0,
duke@0 413 inner_class_outer_class_info_offset = 1,
duke@0 414 inner_class_inner_name_offset = 2,
duke@0 415 inner_class_access_flags_offset = 3,
duke@0 416 inner_class_next_offset = 4
duke@0 417 };
duke@0 418
jiangli@3235 419 enum EnclosingMethodAttributeOffset {
jiangli@3235 420 enclosing_method_class_index_offset = 0,
jiangli@3235 421 enclosing_method_method_index_offset = 1,
jiangli@3235 422 enclosing_method_attribute_size = 2
jiangli@3235 423 };
jiangli@3235 424
acorn@652 425 // method override check
coleenp@2062 426 bool is_override(methodHandle super_method, Handle targetclassloader, Symbol* targetclassname, TRAPS);
acorn@652 427
duke@0 428 // package
coleenp@3602 429 bool is_same_class_package(Klass* class2);
coleenp@2062 430 bool is_same_class_package(oop classloader2, Symbol* classname2);
coleenp@2062 431 static bool is_same_class_package(oop class_loader1, Symbol* class_name1, oop class_loader2, Symbol* class_name2);
duke@0 432
jrose@665 433 // find an enclosing class (defined where original code was, in jvm.cpp!)
coleenp@3602 434 Klass* compute_enclosing_class(bool* inner_is_member, TRAPS) {
coleenp@3602 435 instanceKlassHandle self(THREAD, this);
xlu@1126 436 return compute_enclosing_class_impl(self, inner_is_member, THREAD);
jrose@665 437 }
coleenp@3602 438 static Klass* compute_enclosing_class_impl(instanceKlassHandle self,
xlu@1126 439 bool* inner_is_member, TRAPS);
jrose@665 440
jrose@665 441 // tell if two classes have the same enclosing class (at package level)
coleenp@3602 442 bool is_same_package_member(Klass* class2, TRAPS) {
coleenp@3602 443 instanceKlassHandle self(THREAD, this);
jrose@665 444 return is_same_package_member_impl(self, class2, THREAD);
jrose@665 445 }
jrose@665 446 static bool is_same_package_member_impl(instanceKlassHandle self,
coleenp@3602 447 Klass* class2, TRAPS);
jrose@665 448
duke@0 449 // initialization state
duke@0 450 bool is_loaded() const { return _init_state >= loaded; }
duke@0 451 bool is_linked() const { return _init_state >= linked; }
duke@0 452 bool is_initialized() const { return _init_state == fully_initialized; }
duke@0 453 bool is_not_initialized() const { return _init_state < being_initialized; }
duke@0 454 bool is_being_initialized() const { return _init_state == being_initialized; }
duke@0 455 bool is_in_error_state() const { return _init_state == initialization_error; }
duke@0 456 bool is_reentrant_initialization(Thread *thread) { return thread == _init_thread; }
coleenp@2933 457 ClassState init_state() { return (ClassState)_init_state; }
jiangli@3306 458 bool is_rewritten() const { return (_misc_flags & _misc_rewritten) != 0; }
acorn@973 459
acorn@973 460 // defineClass specified verification
jiangli@3306 461 bool should_verify_class() const {
jiangli@3306 462 return (_misc_flags & _misc_should_verify_class) != 0;
jiangli@3306 463 }
jiangli@3306 464 void set_should_verify_class(bool value) {
jiangli@3306 465 if (value) {
jiangli@3306 466 _misc_flags |= _misc_should_verify_class;
jiangli@3306 467 } else {
jiangli@3306 468 _misc_flags &= ~_misc_should_verify_class;
jiangli@3306 469 }
jiangli@3306 470 }
duke@0 471
duke@0 472 // marking
dcubed@2966 473 bool is_marked_dependent() const { return _is_marked_dependent; }
dcubed@2966 474 void set_is_marked_dependent(bool value) { _is_marked_dependent = value; }
duke@0 475
duke@0 476 // initialization (virtuals from Klass)
duke@0 477 bool should_be_initialized() const; // means that initialize should be called
duke@0 478 void initialize(TRAPS);
duke@0 479 void link_class(TRAPS);
duke@0 480 bool link_class_or_fail(TRAPS); // returns false on failure
duke@0 481 void unlink_class();
duke@0 482 void rewrite_class(TRAPS);
coleenp@3960 483 void link_methods(TRAPS);
coleenp@3602 484 Method* class_initializer();
duke@0 485
duke@0 486 // set the class to initialized if no static initializer is present
duke@0 487 void eager_initialize(Thread *thread);
duke@0 488
duke@0 489 // reference type
jiangli@3091 490 ReferenceType reference_type() const { return (ReferenceType)_reference_type; }
jiangli@3091 491 void set_reference_type(ReferenceType t) {
jiangli@3091 492 assert(t == (u1)t, "overflow");
jiangli@3091 493 _reference_type = (u1)t;
jiangli@3091 494 }
duke@0 495
coleenp@3602 496 static ByteSize reference_type_offset() { return in_ByteSize(offset_of(InstanceKlass, _reference_type)); }
johnc@2346 497
duke@0 498 // find local field, returns true if found
coleenp@2062 499 bool find_local_field(Symbol* name, Symbol* sig, fieldDescriptor* fd) const;
duke@0 500 // find field in direct superinterfaces, returns the interface in which the field is defined
coleenp@3602 501 Klass* find_interface_field(Symbol* name, Symbol* sig, fieldDescriptor* fd) const;
duke@0 502 // find field according to JVM spec 5.4.3.2, returns the klass in which the field is defined
coleenp@3602 503 Klass* find_field(Symbol* name, Symbol* sig, fieldDescriptor* fd) const;
duke@0 504 // find instance or static fields according to JVM spec 5.4.3.2, returns the klass in which the field is defined
coleenp@3602 505 Klass* find_field(Symbol* name, Symbol* sig, bool is_static, fieldDescriptor* fd) const;
duke@0 506
duke@0 507 // find a non-static or static field given its offset within the class.
duke@0 508 bool contains_field_offset(int offset) {
coleenp@113 509 return instanceOopDesc::contains_field_offset(offset, nonstatic_field_size());
duke@0 510 }
duke@0 511
duke@0 512 bool find_local_field_from_offset(int offset, bool is_static, fieldDescriptor* fd) const;
duke@0 513 bool find_field_from_offset(int offset, bool is_static, fieldDescriptor* fd) const;
duke@0 514
duke@0 515 // find a local method (returns NULL if not found)
coleenp@3602 516 Method* find_method(Symbol* name, Symbol* signature) const;
coleenp@3602 517 static Method* find_method(Array<Method*>* methods, Symbol* name, Symbol* signature);
acorn@5710 518 static Method* find_instance_method(Array<Method*>* methods, Symbol* name, Symbol* signature);
duke@0 519
acorn@5413 520 // find a local method index in default_methods (returns -1 if not found)
acorn@5413 521 static int find_method_index(Array<Method*>* methods, Symbol* name, Symbol* signature);
acorn@5413 522
duke@0 523 // lookup operation (returns NULL if not found)
coleenp@3602 524 Method* uncached_lookup_method(Symbol* name, Symbol* signature) const;
duke@0 525
duke@0 526 // lookup a method in all the interfaces that this class implements
duke@0 527 // (returns NULL if not found)
hseigel@5760 528 Method* lookup_method_in_all_interfaces(Symbol* name, Symbol* signature, bool skip_default_methods) const;
hseigel@5760 529
acorn@5413 530 // lookup a method in local defaults then in all interfaces
acorn@5413 531 // (returns NULL if not found)
acorn@5413 532 Method* lookup_method_in_ordered_interfaces(Symbol* name, Symbol* signature) const;
duke@0 533
kamg@3810 534 // Find method indices by name. If a method with the specified name is
kamg@3810 535 // found the index to the first method is returned, and 'end' is filled in
kamg@3810 536 // with the index of first non-name-matching method. If no method is found
kamg@3810 537 // -1 is returned.
kamg@3810 538 int find_method_by_name(Symbol* name, int* end);
kamg@3810 539 static int find_method_by_name(Array<Method*>* methods, Symbol* name, int* end);
kamg@3810 540
duke@0 541 // constant pool
coleenp@3602 542 ConstantPool* constants() const { return _constants; }
coleenp@3602 543 void set_constants(ConstantPool* c) { _constants = c; }
duke@0 544
duke@0 545 // protection domain
coleenp@4741 546 oop protection_domain() const;
coleenp@4741 547
coleenp@4741 548 // signers
coleenp@4741 549 objArrayOop signers() const;
duke@0 550
jrose@431 551 // host class
coleenp@3602 552 Klass* host_klass() const {
coleenp@3602 553 Klass** hk = (Klass**)adr_host_klass();
jiangli@3306 554 if (hk == NULL) {
jiangli@3306 555 return NULL;
jiangli@3306 556 } else {
jiangli@3306 557 return *hk;
jiangli@3306 558 }
jiangli@3306 559 }
coleenp@3602 560 void set_host_klass(Klass* host) {
jiangli@3306 561 assert(is_anonymous(), "not anonymous");
coleenp@3602 562 Klass** addr = (Klass**)adr_host_klass();
jiangli@3306 563 assert(addr != NULL, "no reversed space");
morris@4258 564 if (addr != NULL) {
morris@4258 565 *addr = host;
morris@4258 566 }
jiangli@3306 567 }
jiangli@3306 568 bool is_anonymous() const {
jiangli@3306 569 return (_misc_flags & _misc_is_anonymous) != 0;
jiangli@3306 570 }
jiangli@3306 571 void set_is_anonymous(bool value) {
jiangli@3306 572 if (value) {
jiangli@3306 573 _misc_flags |= _misc_is_anonymous;
jiangli@3306 574 } else {
jiangli@3306 575 _misc_flags &= ~_misc_is_anonymous;
jiangli@3306 576 }
jiangli@3306 577 }
jrose@431 578
coleenp@3910 579 // Oop that keeps the metadata for this class from being unloaded
coleenp@3910 580 // in places where the metadata is stored in other places, like nmethods
coleenp@3910 581 oop klass_holder() const {
coleenp@3910 582 return is_anonymous() ? java_mirror() : class_loader();
coleenp@3910 583 }
coleenp@3910 584
jwilhelm@3995 585 bool is_contended() const {
jwilhelm@3995 586 return (_misc_flags & _misc_is_contended) != 0;
jwilhelm@3995 587 }
jwilhelm@3995 588 void set_is_contended(bool value) {
jwilhelm@3995 589 if (value) {
jwilhelm@3995 590 _misc_flags |= _misc_is_contended;
jwilhelm@3995 591 } else {
jwilhelm@3995 592 _misc_flags &= ~_misc_is_contended;
jwilhelm@3995 593 }
jwilhelm@3995 594 }
jwilhelm@3995 595
duke@0 596 // source file name
jiangli@5100 597 Symbol* source_file_name() const {
jiangli@5100 598 return (_source_file_name_index == 0) ?
jiangli@5100 599 (Symbol*)NULL : _constants->symbol_at(_source_file_name_index);
jiangli@5100 600 }
jiangli@5100 601 u2 source_file_name_index() const {
jiangli@5100 602 return _source_file_name_index;
jiangli@5100 603 }
jiangli@5100 604 void set_source_file_name_index(u2 sourcefile_index) {
jiangli@5100 605 _source_file_name_index = sourcefile_index;
jiangli@5100 606 }
duke@0 607
duke@0 608 // minor and major version numbers of class file
duke@0 609 u2 minor_version() const { return _minor_version; }
duke@0 610 void set_minor_version(u2 minor_version) { _minor_version = minor_version; }
duke@0 611 u2 major_version() const { return _major_version; }
duke@0 612 void set_major_version(u2 major_version) { _major_version = major_version; }
duke@0 613
duke@0 614 // source debug extension
fparain@3471 615 char* source_debug_extension() const { return _source_debug_extension; }
fparain@3471 616 void set_source_debug_extension(char* array, int length);
coleenp@2062 617
coleenp@2062 618 // symbol unloading support (refcount already added)
coleenp@2062 619 Symbol* array_name() { return _array_name; }
coleenp@4277 620 void set_array_name(Symbol* name) { assert(_array_name == NULL || name == NULL, "name already created"); _array_name = name; }
duke@0 621
duke@0 622 // nonstatic oop-map blocks
jcoomes@939 623 static int nonstatic_oop_map_size(unsigned int oop_map_count) {
jcoomes@938 624 return oop_map_count * OopMapBlock::size_in_words();
jcoomes@938 625 }
jcoomes@939 626 unsigned int nonstatic_oop_map_count() const {
jcoomes@938 627 return _nonstatic_oop_map_size / OopMapBlock::size_in_words();
jcoomes@938 628 }
jcoomes@938 629 int nonstatic_oop_map_size() const { return _nonstatic_oop_map_size; }
jcoomes@938 630 void set_nonstatic_oop_map_size(int words) {
jcoomes@938 631 _nonstatic_oop_map_size = words;
jcoomes@938 632 }
duke@0 633
duke@0 634 // RedefineClasses() support for previous versions:
duke@0 635 void add_previous_version(instanceKlassHandle ikh, BitMap *emcp_methods,
duke@0 636 int emcp_method_count);
dcubed@977 637 // If the _previous_versions array is non-NULL, then this klass
dcubed@977 638 // has been redefined at least once even if we aren't currently
dcubed@977 639 // tracking a previous version.
dcubed@977 640 bool has_been_redefined() const { return _previous_versions != NULL; }
duke@0 641 bool has_previous_version() const;
duke@0 642 void init_previous_versions() {
duke@0 643 _previous_versions = NULL;
duke@0 644 }
duke@0 645 GrowableArray<PreviousVersionNode *>* previous_versions() const {
duke@0 646 return _previous_versions;
duke@0 647 }
duke@0 648
coleenp@3602 649 static void purge_previous_versions(InstanceKlass* ik);
coleenp@3602 650
duke@0 651 // JVMTI: Support for caching a class file before it is modified by an agent that can do retransformation
jiangli@4986 652 void set_cached_class_file(JvmtiCachedClassFileData *data) {
jiangli@4986 653 _cached_class_file = data;
jiangli@4986 654 }
jiangli@4986 655 JvmtiCachedClassFileData * get_cached_class_file() { return _cached_class_file; }
jiangli@4986 656 jint get_cached_class_file_len();
jiangli@4986 657 unsigned char * get_cached_class_file_bytes();
duke@0 658
duke@0 659 // JVMTI: Support for caching of field indices, types, and offsets
duke@0 660 void set_jvmti_cached_class_field_map(JvmtiCachedClassFieldMap* descriptor) {
duke@0 661 _jvmti_cached_class_field_map = descriptor;
duke@0 662 }
duke@0 663 JvmtiCachedClassFieldMap* jvmti_cached_class_field_map() const {
duke@0 664 return _jvmti_cached_class_field_map;
duke@0 665 }
duke@0 666
jiangli@4001 667 bool has_default_methods() const {
jiangli@4001 668 return (_misc_flags & _misc_has_default_methods) != 0;
jiangli@4001 669 }
jiangli@4001 670 void set_has_default_methods(bool b) {
jiangli@4001 671 if (b) {
jiangli@4001 672 _misc_flags |= _misc_has_default_methods;
jiangli@4001 673 } else {
jiangli@4001 674 _misc_flags &= ~_misc_has_default_methods;
jiangli@4001 675 }
jiangli@4001 676 }
kamg@3810 677
coleenp@3602 678 // for adding methods, ConstMethod::UNSET_IDNUM means no more ids available
duke@0 679 inline u2 next_method_idnum();
duke@0 680 void set_initial_method_idnum(u2 value) { _idnum_allocated_count = value; }
duke@0 681
duke@0 682 // generics support
jiangli@5100 683 Symbol* generic_signature() const {
jiangli@5100 684 return (_generic_signature_index == 0) ?
jiangli@5100 685 (Symbol*)NULL : _constants->symbol_at(_generic_signature_index);
jiangli@5100 686 }
jiangli@5100 687 u2 generic_signature_index() const {
jiangli@5100 688 return _generic_signature_index;
jiangli@5100 689 }
jiangli@5100 690 void set_generic_signature_index(u2 sig_index) {
jiangli@5100 691 _generic_signature_index = sig_index;
jiangli@5100 692 }
coleenp@2062 693
jiangli@3235 694 u2 enclosing_method_data(int offset);
jiangli@3235 695 u2 enclosing_method_class_index() {
jiangli@3235 696 return enclosing_method_data(enclosing_method_class_index_offset);
jiangli@3235 697 }
jiangli@3235 698 u2 enclosing_method_method_index() {
jiangli@3235 699 return enclosing_method_data(enclosing_method_method_index_offset);
jiangli@3235 700 }
duke@0 701 void set_enclosing_method_indices(u2 class_index,
jiangli@3235 702 u2 method_index);
duke@0 703
duke@0 704 // jmethodID support
dcubed@977 705 static jmethodID get_jmethod_id(instanceKlassHandle ik_h,
dcubed@977 706 methodHandle method_h);
dcubed@977 707 static jmethodID get_jmethod_id_fetch_or_update(instanceKlassHandle ik_h,
dcubed@977 708 size_t idnum, jmethodID new_id, jmethodID* new_jmeths,
dcubed@977 709 jmethodID* to_dealloc_id_p,
dcubed@977 710 jmethodID** to_dealloc_jmeths_p);
dcubed@977 711 static void get_jmethod_id_length_value(jmethodID* cache, size_t idnum,
dcubed@977 712 size_t *length_p, jmethodID* id_p);
coleenp@3602 713 jmethodID jmethod_id_or_null(Method* method);
duke@0 714
duke@0 715 // annotations support
coleenp@3602 716 Annotations* annotations() const { return _annotations; }
coleenp@3602 717 void set_annotations(Annotations* anno) { _annotations = anno; }
coleenp@4137 718
coleenp@3602 719 AnnotationArray* class_annotations() const {
coleenp@4137 720 return (_annotations != NULL) ? _annotations->class_annotations() : NULL;
coleenp@3602 721 }
coleenp@3602 722 Array<AnnotationArray*>* fields_annotations() const {
coleenp@4137 723 return (_annotations != NULL) ? _annotations->fields_annotations() : NULL;
coleenp@3602 724 }
coleenp@4137 725 AnnotationArray* class_type_annotations() const {
coleenp@4137 726 return (_annotations != NULL) ? _annotations->class_type_annotations() : NULL;
stefank@3958 727 }
coleenp@4137 728 Array<AnnotationArray*>* fields_type_annotations() const {
coleenp@4137 729 return (_annotations != NULL) ? _annotations->fields_type_annotations() : NULL;
coleenp@4137 730 }
duke@0 731 // allocation
duke@0 732 instanceOop allocate_instance(TRAPS);
duke@0 733
duke@0 734 // additional member function to return a handle
duke@0 735 instanceHandle allocate_instance_handle(TRAPS) { return instanceHandle(THREAD, allocate_instance(THREAD)); }
duke@0 736
duke@0 737 objArrayOop allocate_objArray(int n, int length, TRAPS);
duke@0 738 // Helper function
duke@0 739 static instanceOop register_finalizer(instanceOop i, TRAPS);
duke@0 740
duke@0 741 // Check whether reflection/jni/jvm code is allowed to instantiate this class;
duke@0 742 // if not, throw either an Error or an Exception.
duke@0 743 virtual void check_valid_for_instantiation(bool throwError, TRAPS);
duke@0 744
duke@0 745 // initialization
duke@0 746 void call_class_initializer(TRAPS);
duke@0 747 void set_initialization_state_and_notify(ClassState state, TRAPS);
duke@0 748
duke@0 749 // OopMapCache support
duke@0 750 OopMapCache* oop_map_cache() { return _oop_map_cache; }
duke@0 751 void set_oop_map_cache(OopMapCache *cache) { _oop_map_cache = cache; }
duke@0 752 void mask_for(methodHandle method, int bci, InterpreterOopMap* entry);
duke@0 753
duke@0 754 // JNI identifier support (for static fields - for jni performance)
duke@0 755 JNIid* jni_ids() { return _jni_ids; }
duke@0 756 void set_jni_ids(JNIid* ids) { _jni_ids = ids; }
duke@0 757 JNIid* jni_id_for(int offset);
duke@0 758
duke@0 759 // maintenance of deoptimization dependencies
duke@0 760 int mark_dependent_nmethods(DepChange& changes);
duke@0 761 void add_dependent_nmethod(nmethod* nm);
duke@0 762 void remove_dependent_nmethod(nmethod* nm);
duke@0 763
duke@0 764 // On-stack replacement support
duke@0 765 nmethod* osr_nmethods_head() const { return _osr_nmethods_head; };
duke@0 766 void set_osr_nmethods_head(nmethod* h) { _osr_nmethods_head = h; };
duke@0 767 void add_osr_nmethod(nmethod* n);
duke@0 768 void remove_osr_nmethod(nmethod* n);
minqi@4662 769 nmethod* lookup_osr_nmethod(const Method* m, int bci, int level, bool match_level) const;
duke@0 770
coleenp@3602 771 // Breakpoint support (see methods on Method* for details)
duke@0 772 BreakpointInfo* breakpoints() const { return _breakpoints; };
duke@0 773 void set_breakpoints(BreakpointInfo* bps) { _breakpoints = bps; };
duke@0 774
duke@0 775 // support for stub routines
coleenp@3602 776 static ByteSize init_state_offset() { return in_ByteSize(offset_of(InstanceKlass, _init_state)); }
rbackman@3274 777 TRACE_DEFINE_OFFSET;
coleenp@3602 778 static ByteSize init_thread_offset() { return in_ByteSize(offset_of(InstanceKlass, _init_thread)); }
duke@0 779
duke@0 780 // subclass/subinterface checks
coleenp@3602 781 bool implements_interface(Klass* k) const;
hseigel@5697 782 bool is_same_or_direct_interface(Klass* k) const;
duke@0 783
jiangli@3266 784 // Access to the implementor of an interface.
coleenp@3602 785 Klass* implementor() const
jiangli@3266 786 {
coleenp@3602 787 Klass** k = adr_implementor();
jiangli@3266 788 if (k == NULL) {
jiangli@3266 789 return NULL;
jiangli@3266 790 } else {
jiangli@3266 791 return *k;
jiangli@3266 792 }
duke@0 793 }
jiangli@3266 794
coleenp@3602 795 void set_implementor(Klass* k) {
jiangli@3266 796 assert(is_interface(), "not interface");
coleenp@3602 797 Klass** addr = adr_implementor();
morris@4258 798 assert(addr != NULL, "null addr");
morris@4258 799 if (addr != NULL) {
morris@4258 800 *addr = k;
morris@4258 801 }
jiangli@3266 802 }
jiangli@3266 803
jiangli@3266 804 int nof_implementors() const {
coleenp@3602 805 Klass* k = implementor();
jiangli@3266 806 if (k == NULL) {
jiangli@3266 807 return 0;
coleenp@3602 808 } else if (k != this) {
jiangli@3266 809 return 1;
jiangli@3266 810 } else {
jiangli@3266 811 return 2;
jiangli@3266 812 }
jiangli@3266 813 }
jiangli@3266 814
coleenp@3602 815 void add_implementor(Klass* k); // k is a new class that implements this interface
duke@0 816 void init_implementor(); // initialize
duke@0 817
duke@0 818 // link this class into the implementors list of every interface it implements
duke@0 819 void process_interfaces(Thread *thread);
duke@0 820
duke@0 821 // virtual operations from Klass
duke@0 822 bool is_leaf_class() const { return _subklass == NULL; }
coleenp@3602 823 GrowableArray<Klass*>* compute_secondary_supers(int num_extra_slots);
coleenp@3602 824 bool compute_is_subtype_of(Klass* k);
duke@0 825 bool can_be_primary_super_slow() const;
duke@0 826 int oop_size(oop obj) const { return size_helper(); }
duke@0 827 bool oop_is_instance_slow() const { return true; }
duke@0 828
duke@0 829 // Iterators
duke@0 830 void do_local_static_fields(FieldClosure* cl);
duke@0 831 void do_nonstatic_fields(FieldClosure* cl); // including inherited fields
duke@0 832 void do_local_static_fields(void f(fieldDescriptor*, TRAPS), TRAPS);
duke@0 833
coleenp@3602 834 void methods_do(void f(Method* method));
coleenp@3602 835 void array_klasses_do(void f(Klass* k));
coleenp@3602 836 void array_klasses_do(void f(Klass* k, TRAPS), TRAPS);
duke@0 837 bool super_types_do(SuperTypeClosure* blk);
duke@0 838
coleenp@3602 839 // Casting from Klass*
coleenp@3602 840 static InstanceKlass* cast(Klass* k) {
never@2223 841 assert(k->is_klass(), "must be");
coleenp@3602 842 assert(k->oop_is_instance(), "cast to InstanceKlass");
coleenp@3602 843 return (InstanceKlass*) k;
duke@0 844 }
duke@0 845
kamg@3810 846 InstanceKlass* java_super() const {
kamg@3810 847 return (super() == NULL) ? NULL : cast(super());
kamg@3810 848 }
kamg@3810 849
duke@0 850 // Sizing (in words)
coleenp@3602 851 static int header_size() { return align_object_offset(sizeof(InstanceKlass)/HeapWordSize); }
coleenp@4137 852
coleenp@3602 853 static int size(int vtable_length, int itable_length,
coleenp@3602 854 int nonstatic_oop_map_size,
coleenp@3602 855 bool is_interface, bool is_anonymous) {
coleenp@3602 856 return align_object_size(header_size() +
coleenp@3602 857 align_object_offset(vtable_length) +
coleenp@3602 858 align_object_offset(itable_length) +
coleenp@3602 859 ((is_interface || is_anonymous) ?
coleenp@3602 860 align_object_offset(nonstatic_oop_map_size) :
coleenp@3602 861 nonstatic_oop_map_size) +
coleenp@3602 862 (is_interface ? (int)sizeof(Klass*)/HeapWordSize : 0) +
coleenp@3602 863 (is_anonymous ? (int)sizeof(Klass*)/HeapWordSize : 0));
coleenp@3602 864 }
coleenp@3602 865 int size() const { return size(vtable_length(),
coleenp@3602 866 itable_length(),
coleenp@3602 867 nonstatic_oop_map_size(),
coleenp@3602 868 is_interface(),
coleenp@3602 869 is_anonymous());
coleenp@3602 870 }
acorn@4062 871 #if INCLUDE_SERVICES
acorn@4062 872 virtual void collect_statistics(KlassSizeStats *sz) const;
acorn@4062 873 #endif
jiangli@3266 874
duke@0 875 static int vtable_start_offset() { return header_size(); }
coleenp@3602 876 static int vtable_length_offset() { return offset_of(InstanceKlass, _vtable_len) / HeapWordSize; }
duke@0 877
coleenp@3602 878 intptr_t* start_of_vtable() const { return ((intptr_t*)this) + vtable_start_offset(); }
duke@0 879 intptr_t* start_of_itable() const { return start_of_vtable() + align_object_offset(vtable_length()); }
coleenp@3602 880 int itable_offset_in_words() const { return start_of_itable() - (intptr_t*)this; }
duke@0 881
duke@0 882 intptr_t* end_of_itable() const { return start_of_itable() + itable_length(); }
duke@0 883
never@2223 884 address static_field_addr(int offset);
coleenp@113 885
coleenp@113 886 OopMapBlock* start_of_nonstatic_oop_maps() const {
never@2223 887 return (OopMapBlock*)(start_of_itable() + align_object_offset(itable_length()));
coleenp@113 888 }
duke@0 889
coleenp@4137 890 Klass** end_of_nonstatic_oop_maps() const {
coleenp@4137 891 return (Klass**)(start_of_nonstatic_oop_maps() +
coleenp@4137 892 nonstatic_oop_map_count());
coleenp@4137 893 }
coleenp@4137 894
coleenp@3602 895 Klass** adr_implementor() const {
jiangli@3266 896 if (is_interface()) {
coleenp@4137 897 return (Klass**)end_of_nonstatic_oop_maps();
jiangli@3266 898 } else {
jiangli@3266 899 return NULL;
jiangli@3266 900 }
jiangli@3266 901 };
jiangli@3266 902
coleenp@3602 903 Klass** adr_host_klass() const {
jiangli@3306 904 if (is_anonymous()) {
coleenp@3602 905 Klass** adr_impl = adr_implementor();
jiangli@3306 906 if (adr_impl != NULL) {
jiangli@3306 907 return adr_impl + 1;
jiangli@3306 908 } else {
coleenp@4137 909 return end_of_nonstatic_oop_maps();
jiangli@3306 910 }
jiangli@3306 911 } else {
jiangli@3306 912 return NULL;
jiangli@3306 913 }
jiangli@3306 914 }
jiangli@3306 915
duke@0 916 // Use this to return the size of an instance in heap words:
duke@0 917 int size_helper() const {
duke@0 918 return layout_helper_to_size_helper(layout_helper());
duke@0 919 }
duke@0 920
duke@0 921 // This bit is initialized in classFileParser.cpp.
duke@0 922 // It is false under any of the following conditions:
duke@0 923 // - the class is abstract (including any interface)
duke@0 924 // - the class has a finalizer (if !RegisterFinalizersAtInit)
duke@0 925 // - the class size is larger than FastAllocateSizeLimit
duke@0 926 // - the class is java/lang/Class, which cannot be allocated directly
duke@0 927 bool can_be_fastpath_allocated() const {
duke@0 928 return !layout_helper_needs_slow_path(layout_helper());
duke@0 929 }
duke@0 930
duke@0 931 // Java vtable/itable
duke@0 932 klassVtable* vtable() const; // return new klassVtable wrapper
coleenp@3602 933 inline Method* method_at_vtable(int index);
duke@0 934 klassItable* itable() const; // return new klassItable wrapper
coleenp@3602 935 Method* method_at_itable(Klass* holder, int index, TRAPS);
duke@0 936
acorn@5413 937 #if INCLUDE_JVMTI
acorn@5413 938 void adjust_default_methods(Method** old_methods, Method** new_methods,
acorn@5413 939 int methods_length, bool* trace_name_printed);
acorn@5413 940 #endif // INCLUDE_JVMTI
acorn@5413 941
duke@0 942 // Garbage collection
duke@0 943 void oop_follow_contents(oop obj);
duke@0 944 int oop_adjust_pointers(oop obj);
duke@0 945
coleenp@3602 946 void clean_implementors_list(BoolObjectClosure* is_alive);
coleenp@3602 947 void clean_method_data(BoolObjectClosure* is_alive);
coleenp@3602 948
coleenp@3602 949 // Explicit metaspace deallocation of fields
coleenp@4284 950 // For RedefineClasses and class file parsing errors, we need to deallocate
coleenp@4284 951 // instanceKlasses and the metadata they point to.
coleenp@3602 952 void deallocate_contents(ClassLoaderData* loader_data);
coleenp@4284 953 static void deallocate_methods(ClassLoaderData* loader_data,
coleenp@4284 954 Array<Method*>* methods);
coleenp@4284 955 void static deallocate_interfaces(ClassLoaderData* loader_data,
coleenp@4284 956 Klass* super_klass,
coleenp@4284 957 Array<Klass*>* local_interfaces,
coleenp@4284 958 Array<Klass*>* transitive_interfaces);
coleenp@3602 959
coleenp@3602 960 // The constant pool is on stack if any of the methods are executing or
coleenp@3602 961 // referenced by handles.
coleenp@3602 962 bool on_stack() const { return _constants->on_stack(); }
coleenp@3602 963
coleenp@4546 964 // callbacks for actions during class unloading
coleenp@4546 965 static void notify_unload_class(InstanceKlass* ik);
coleenp@4546 966 static void release_C_heap_structures(InstanceKlass* ik);
duke@0 967
duke@0 968 // Parallel Scavenge and Parallel Old
duke@0 969 PARALLEL_GC_DECLS
duke@0 970
duke@0 971 // Naming
jrose@1039 972 const char* signature_name() const;
duke@0 973
duke@0 974 // Iterators
coleenp@3602 975 int oop_oop_iterate(oop obj, ExtendedOopClosure* blk) {
duke@0 976 return oop_oop_iterate_v(obj, blk);
duke@0 977 }
duke@0 978
coleenp@3602 979 int oop_oop_iterate_m(oop obj, ExtendedOopClosure* blk, MemRegion mr) {
duke@0 980 return oop_oop_iterate_v_m(obj, blk, mr);
duke@0 981 }
duke@0 982
ysr@342 983 #define InstanceKlass_OOP_OOP_ITERATE_DECL(OopClosureType, nv_suffix) \
ysr@342 984 int oop_oop_iterate##nv_suffix(oop obj, OopClosureType* blk); \
ysr@342 985 int oop_oop_iterate##nv_suffix##_m(oop obj, OopClosureType* blk, \
duke@0 986 MemRegion mr);
duke@0 987
duke@0 988 ALL_OOP_OOP_ITERATE_CLOSURES_1(InstanceKlass_OOP_OOP_ITERATE_DECL)
ysr@342 989 ALL_OOP_OOP_ITERATE_CLOSURES_2(InstanceKlass_OOP_OOP_ITERATE_DECL)
ysr@342 990
jprovino@4107 991 #if INCLUDE_ALL_GCS
ysr@342 992 #define InstanceKlass_OOP_OOP_ITERATE_BACKWARDS_DECL(OopClosureType, nv_suffix) \
ysr@342 993 int oop_oop_iterate_backwards##nv_suffix(oop obj, OopClosureType* blk);
ysr@342 994
ysr@342 995 ALL_OOP_OOP_ITERATE_CLOSURES_1(InstanceKlass_OOP_OOP_ITERATE_BACKWARDS_DECL)
ysr@342 996 ALL_OOP_OOP_ITERATE_CLOSURES_2(InstanceKlass_OOP_OOP_ITERATE_BACKWARDS_DECL)
jprovino@4107 997 #endif // INCLUDE_ALL_GCS
duke@0 998
coleenp@3602 999 u2 idnum_allocated_count() const { return _idnum_allocated_count; }
iklam@4549 1000
duke@0 1001 private:
duke@0 1002 // initialization state
duke@0 1003 #ifdef ASSERT
duke@0 1004 void set_init_state(ClassState state);
duke@0 1005 #else
coleenp@2933 1006 void set_init_state(ClassState state) { _init_state = (u1)state; }
duke@0 1007 #endif
jiangli@3306 1008 void set_rewritten() { _misc_flags |= _misc_rewritten; }
duke@0 1009 void set_init_thread(Thread *thread) { _init_thread = thread; }
duke@0 1010
dcubed@977 1011 // The RedefineClasses() API can cause new method idnums to be needed
dcubed@977 1012 // which will cause the caches to grow. Safety requires different
dcubed@977 1013 // cache management logic if the caches can grow instead of just
dcubed@977 1014 // going from NULL to non-NULL.
dcubed@977 1015 bool idnum_can_increment() const { return has_been_redefined(); }
duke@0 1016 jmethodID* methods_jmethod_ids_acquire() const
duke@0 1017 { return (jmethodID*)OrderAccess::load_ptr_acquire(&_methods_jmethod_ids); }
duke@0 1018 void release_set_methods_jmethod_ids(jmethodID* jmeths)
duke@0 1019 { OrderAccess::release_store_ptr(&_methods_jmethod_ids, jmeths); }
duke@0 1020
coleenp@3602 1021 // Lock during initialization
iklam@4549 1022 public:
coleenp@4741 1023 // Lock for (1) initialization; (2) access to the ConstantPool of this class.
coleenp@4741 1024 // Must be one per class and it has to be a VM internal object so java code
coleenp@4741 1025 // cannot lock it (like the mirror).
coleenp@4741 1026 // It has to be an object not a Mutex because it's held through java calls.
coleenp@5401 1027 oop init_lock() const;
iklam@4549 1028 private:
iklam@5536 1029 void fence_and_clear_init_lock();
duke@0 1030
duke@0 1031 // Static methods that are used to implement member methods where an exposed this pointer
duke@0 1032 // is needed due to possible GCs
duke@0 1033 static bool link_class_impl (instanceKlassHandle this_oop, bool throw_verifyerror, TRAPS);
duke@0 1034 static bool verify_code (instanceKlassHandle this_oop, bool throw_verifyerror, TRAPS);
duke@0 1035 static void initialize_impl (instanceKlassHandle this_oop, TRAPS);
duke@0 1036 static void eager_initialize_impl (instanceKlassHandle this_oop);
duke@0 1037 static void set_initialization_state_and_notify_impl (instanceKlassHandle this_oop, ClassState state, TRAPS);
duke@0 1038 static void call_class_initializer_impl (instanceKlassHandle this_oop, TRAPS);
coleenp@3602 1039 static Klass* array_klass_impl (instanceKlassHandle this_oop, bool or_null, int n, TRAPS);
duke@0 1040 static void do_local_static_fields_impl (instanceKlassHandle this_oop, void f(fieldDescriptor* fd, TRAPS), TRAPS);
duke@0 1041 /* jni_id_for_impl for jfieldID only */
duke@0 1042 static JNIid* jni_id_for_impl (instanceKlassHandle this_oop, int offset);
duke@0 1043
duke@0 1044 // Returns the array class for the n'th dimension
coleenp@3602 1045 Klass* array_klass_impl(bool or_null, int n, TRAPS);
duke@0 1046
duke@0 1047 // Returns the array class with this class as element type
coleenp@3602 1048 Klass* array_klass_impl(bool or_null, TRAPS);
duke@0 1049
coleenp@4546 1050 // Free CHeap allocated fields.
coleenp@4546 1051 void release_C_heap_structures();
duke@0 1052 public:
coleenp@3602 1053 // CDS support - remove and restore oops from metadata. Oops are not shared.
duke@0 1054 virtual void remove_unshareable_info();
coleenp@3602 1055 virtual void restore_unshareable_info(TRAPS);
duke@0 1056
duke@0 1057 // jvm support
duke@0 1058 jint compute_modifier_flags(TRAPS) const;
duke@0 1059
sspitsyn@4530 1060 // JSR-292 support
sspitsyn@4530 1061 MemberNameTable* member_names() { return _member_names; }
sspitsyn@4530 1062 void set_member_names(MemberNameTable* member_names) { _member_names = member_names; }
sspitsyn@4743 1063 void add_member_name(int index, Handle member_name);
sspitsyn@4743 1064 oop get_member_name(int index);
sspitsyn@4530 1065
duke@0 1066 public:
duke@0 1067 // JVMTI support
duke@0 1068 jint jvmti_class_status() const;
duke@0 1069
duke@0 1070 public:
duke@0 1071 // Printing
coleenp@3602 1072 #ifndef PRODUCT
coleenp@3602 1073 void print_on(outputStream* st) const;
coleenp@3602 1074 #endif
coleenp@3602 1075 void print_value_on(outputStream* st) const;
coleenp@3602 1076
jrose@1155 1077 void oop_print_value_on(oop obj, outputStream* st);
coleenp@3602 1078
jrose@1155 1079 #ifndef PRODUCT
duke@0 1080 void oop_print_on (oop obj, outputStream* st);
duke@0 1081
duke@0 1082 void print_dependent_nmethods(bool verbose = false);
duke@0 1083 bool is_dependent_nmethod(nmethod* nm);
duke@0 1084 #endif
duke@0 1085
coleenp@3602 1086 const char* internal_name() const;
coleenp@3602 1087
duke@0 1088 // Verification
coleenp@4872 1089 void verify_on(outputStream* st, bool check_dictionary);
coleenp@3602 1090
duke@0 1091 void oop_verify_on(oop obj, outputStream* st);
duke@0 1092 };
duke@0 1093
coleenp@3602 1094 inline Method* InstanceKlass::method_at_vtable(int index) {
duke@0 1095 #ifndef PRODUCT
duke@0 1096 assert(index >= 0, "valid vtable index");
duke@0 1097 if (DebugVtables) {
duke@0 1098 verify_vtable_index(index);
duke@0 1099 }
duke@0 1100 #endif
duke@0 1101 vtableEntry* ve = (vtableEntry*)start_of_vtable();
duke@0 1102 return ve[index].method();
duke@0 1103 }
duke@0 1104
duke@0 1105 // for adding methods
duke@0 1106 // UNSET_IDNUM return means no more ids available
coleenp@3602 1107 inline u2 InstanceKlass::next_method_idnum() {
coleenp@3602 1108 if (_idnum_allocated_count == ConstMethod::MAX_IDNUM) {
coleenp@3602 1109 return ConstMethod::UNSET_IDNUM; // no more ids available
duke@0 1110 } else {
duke@0 1111 return _idnum_allocated_count++;
duke@0 1112 }
duke@0 1113 }
duke@0 1114
duke@0 1115
duke@0 1116 /* JNIid class for jfieldIDs only */
zgu@3465 1117 class JNIid: public CHeapObj<mtClass> {
duke@0 1118 friend class VMStructs;
duke@0 1119 private:
coleenp@3602 1120 Klass* _holder;
duke@0 1121 JNIid* _next;
duke@0 1122 int _offset;
duke@0 1123 #ifdef ASSERT
duke@0 1124 bool _is_static_field_id;
duke@0 1125 #endif
duke@0 1126
duke@0 1127 public:
duke@0 1128 // Accessors
coleenp@3602 1129 Klass* holder() const { return _holder; }
duke@0 1130 int offset() const { return _offset; }
duke@0 1131 JNIid* next() { return _next; }
duke@0 1132 // Constructor
coleenp@3602 1133 JNIid(Klass* holder, int offset, JNIid* next);
duke@0 1134 // Identifier lookup
duke@0 1135 JNIid* find(int offset);
duke@0 1136
never@2223 1137 bool find_local_field(fieldDescriptor* fd) {
coleenp@3602 1138 return InstanceKlass::cast(holder())->find_local_field_from_offset(offset(), true, fd);
never@2223 1139 }
never@2223 1140
duke@0 1141 static void deallocate(JNIid* id);
duke@0 1142 // Debugging
duke@0 1143 #ifdef ASSERT
duke@0 1144 bool is_static_field_id() const { return _is_static_field_id; }
duke@0 1145 void set_is_static_field_id() { _is_static_field_id = true; }
duke@0 1146 #endif
coleenp@3602 1147 void verify(Klass* holder);
duke@0 1148 };
duke@0 1149
duke@0 1150
duke@0 1151 // If breakpoints are more numerous than just JVMTI breakpoints,
duke@0 1152 // consider compressing this data structure.
coleenp@3602 1153 // It is currently a simple linked list defined in method.hpp.
duke@0 1154
duke@0 1155 class BreakpointInfo;
duke@0 1156
duke@0 1157
duke@0 1158 // A collection point for interesting information about the previous
coleenp@5314 1159 // version(s) of an InstanceKlass. A GrowableArray of PreviousVersionNodes
coleenp@5314 1160 // is attached to the InstanceKlass as needed. See PreviousVersionWalker below.
zgu@3465 1161 class PreviousVersionNode : public CHeapObj<mtClass> {
duke@0 1162 private:
coleenp@5314 1163 ConstantPool* _prev_constant_pool;
dcubed@47 1164
coleenp@3602 1165 // If the previous version of the InstanceKlass doesn't have any
duke@0 1166 // EMCP methods, then _prev_EMCP_methods will be NULL. If all the
duke@0 1167 // EMCP methods have been collected, then _prev_EMCP_methods can
duke@0 1168 // have a length of zero.
coleenp@3602 1169 GrowableArray<Method*>* _prev_EMCP_methods;
duke@0 1170
duke@0 1171 public:
coleenp@5314 1172 PreviousVersionNode(ConstantPool* prev_constant_pool,
coleenp@5314 1173 GrowableArray<Method*>* prev_EMCP_methods);
duke@0 1174 ~PreviousVersionNode();
coleenp@3602 1175 ConstantPool* prev_constant_pool() const {
duke@0 1176 return _prev_constant_pool;
duke@0 1177 }
coleenp@3602 1178 GrowableArray<Method*>* prev_EMCP_methods() const {
duke@0 1179 return _prev_EMCP_methods;
duke@0 1180 }
duke@0 1181 };
duke@0 1182
duke@0 1183
coleenp@5314 1184 // Helper object for walking previous versions.
duke@0 1185 class PreviousVersionWalker : public StackObj {
duke@0 1186 private:
coleenp@5314 1187 Thread* _thread;
duke@0 1188 GrowableArray<PreviousVersionNode *>* _previous_versions;
duke@0 1189 int _current_index;
duke@0 1190
coleenp@5314 1191 // A pointer to the current node object so we can handle the deletes.
coleenp@5314 1192 PreviousVersionNode* _current_p;
duke@0 1193
coleenp@5314 1194 // The constant pool handle keeps all the methods in this class from being
coleenp@5314 1195 // deallocated from the metaspace during class unloading.
coleenp@5314 1196 constantPoolHandle _current_constant_pool_handle;
duke@0 1197
duke@0 1198 public:
coleenp@5314 1199 PreviousVersionWalker(Thread* thread, InstanceKlass *ik);
duke@0 1200
duke@0 1201 // Return the interesting information for the next previous version
duke@0 1202 // of the klass. Returns NULL if there are no more previous versions.
coleenp@5314 1203 PreviousVersionNode* next_previous_version();
duke@0 1204 };
stefank@1879 1205
never@2703 1206
never@2703 1207 //
never@2703 1208 // nmethodBucket is used to record dependent nmethods for
never@2703 1209 // deoptimization. nmethod dependencies are actually <klass, method>
never@2703 1210 // pairs but we really only care about the klass part for purposes of
never@2703 1211 // finding nmethods which might need to be deoptimized. Instead of
never@2703 1212 // recording the method, a count of how many times a particular nmethod
never@2703 1213 // was recorded is kept. This ensures that any recording errors are
never@2703 1214 // noticed since an nmethod should be removed as many times are it's
never@2703 1215 // added.
never@2703 1216 //
zgu@3465 1217 class nmethodBucket: public CHeapObj<mtClass> {
never@2703 1218 friend class VMStructs;
never@2703 1219 private:
never@2703 1220 nmethod* _nmethod;
never@2703 1221 int _count;
never@2703 1222 nmethodBucket* _next;
never@2703 1223
never@2703 1224 public:
never@2703 1225 nmethodBucket(nmethod* nmethod, nmethodBucket* next) {
never@2703 1226 _nmethod = nmethod;
never@2703 1227 _next = next;
never@2703 1228 _count = 1;
never@2703 1229 }
never@2703 1230 int count() { return _count; }
never@2703 1231 int increment() { _count += 1; return _count; }
never@2703 1232 int decrement() { _count -= 1; assert(_count >= 0, "don't underflow"); return _count; }
never@2703 1233 nmethodBucket* next() { return _next; }
never@2703 1234 void set_next(nmethodBucket* b) { _next = b; }
never@2703 1235 nmethod* get_nmethod() { return _nmethod; }
never@2703 1236 };
never@2703 1237
jiangli@3235 1238 // An iterator that's used to access the inner classes indices in the
coleenp@3602 1239 // InstanceKlass::_inner_classes array.
jiangli@3235 1240 class InnerClassesIterator : public StackObj {
jiangli@3235 1241 private:
coleenp@3602 1242 Array<jushort>* _inner_classes;
jiangli@3235 1243 int _length;
jiangli@3235 1244 int _idx;
jiangli@3235 1245 public:
jiangli@3235 1246
jiangli@3235 1247 InnerClassesIterator(instanceKlassHandle k) {
jiangli@3235 1248 _inner_classes = k->inner_classes();
jiangli@3235 1249 if (k->inner_classes() != NULL) {
jiangli@3235 1250 _length = _inner_classes->length();
jiangli@3235 1251 // The inner class array's length should be the multiple of
jiangli@3235 1252 // inner_class_next_offset if it only contains the InnerClasses
jiangli@3235 1253 // attribute data, or it should be
jiangli@3235 1254 // n*inner_class_next_offset+enclosing_method_attribute_size
jiangli@3235 1255 // if it also contains the EnclosingMethod data.
coleenp@3602 1256 assert((_length % InstanceKlass::inner_class_next_offset == 0 ||
coleenp@3602 1257 _length % InstanceKlass::inner_class_next_offset == InstanceKlass::enclosing_method_attribute_size),
jiangli@3235 1258 "just checking");
jiangli@3235 1259 // Remove the enclosing_method portion if exists.
coleenp@3602 1260 if (_length % InstanceKlass::inner_class_next_offset == InstanceKlass::enclosing_method_attribute_size) {
coleenp@3602 1261 _length -= InstanceKlass::enclosing_method_attribute_size;
jiangli@3235 1262 }
jiangli@3235 1263 } else {
jiangli@3235 1264 _length = 0;
jiangli@3235 1265 }
jiangli@3235 1266 _idx = 0;
jiangli@3235 1267 }
jiangli@3235 1268
jiangli@3235 1269 int length() const {
jiangli@3235 1270 return _length;
jiangli@3235 1271 }
jiangli@3235 1272
jiangli@3235 1273 void next() {
coleenp@3602 1274 _idx += InstanceKlass::inner_class_next_offset;
jiangli@3235 1275 }
jiangli@3235 1276
jiangli@3235 1277 bool done() const {
jiangli@3235 1278 return (_idx >= _length);
jiangli@3235 1279 }
jiangli@3235 1280
jiangli@3235 1281 u2 inner_class_info_index() const {
coleenp@3602 1282 return _inner_classes->at(
coleenp@3602 1283 _idx + InstanceKlass::inner_class_inner_class_info_offset);
jiangli@3235 1284 }
jiangli@3235 1285
jiangli@3235 1286 void set_inner_class_info_index(u2 index) {
coleenp@3602 1287 _inner_classes->at_put(
coleenp@3602 1288 _idx + InstanceKlass::inner_class_inner_class_info_offset, index);
jiangli@3235 1289 }
jiangli@3235 1290
jiangli@3235 1291 u2 outer_class_info_index() const {
coleenp@3602 1292 return _inner_classes->at(
coleenp@3602 1293 _idx + InstanceKlass::inner_class_outer_class_info_offset);
jiangli@3235 1294 }
jiangli@3235 1295
jiangli@3235 1296 void set_outer_class_info_index(u2 index) {
coleenp@3602 1297 _inner_classes->at_put(
coleenp@3602 1298 _idx + InstanceKlass::inner_class_outer_class_info_offset, index);
jiangli@3235 1299 }
jiangli@3235 1300
jiangli@3235 1301 u2 inner_name_index() const {
coleenp@3602 1302 return _inner_classes->at(
coleenp@3602 1303 _idx + InstanceKlass::inner_class_inner_name_offset);
jiangli@3235 1304 }
jiangli@3235 1305
jiangli@3235 1306 void set_inner_name_index(u2 index) {
coleenp@3602 1307 _inner_classes->at_put(
coleenp@3602 1308 _idx + InstanceKlass::inner_class_inner_name_offset, index);
jiangli@3235 1309 }
jiangli@3235 1310
jiangli@3235 1311 u2 inner_access_flags() const {
coleenp@3602 1312 return _inner_classes->at(
coleenp@3602 1313 _idx + InstanceKlass::inner_class_access_flags_offset);
jiangli@3235 1314 }
jiangli@3235 1315 };
jiangli@3235 1316
stefank@1879 1317 #endif // SHARE_VM_OOPS_INSTANCEKLASS_HPP