126 127 private: 128 int _offset; 129 uint _count; 130 }; 131 132 struct JvmtiCachedClassFileData; 133 134 class SigEntry; 135 136 class ValueKlassFixedBlock VALUE_OBJ_CLASS_SPEC { 137 Array<SigEntry>** _extended_sig; 138 Array<VMRegPair>** _return_regs; 139 address* _pack_handler; 140 address* _unpack_handler; 141 int* _default_value_offset; 142 143 friend class ValueKlass; 144 }; 145 146 class InstanceKlass: public Klass { 147 friend class VMStructs; 148 friend class JVMCIVMStructs; 149 friend class ClassFileParser; 150 friend class CompileReplay; 151 152 protected: 153 InstanceKlass(const ClassFileParser& parser, unsigned kind); 154 155 public: 156 InstanceKlass() { assert(DumpSharedSpaces || UseSharedSpaces, "only for CDS"); } 157 158 // See "The Java Virtual Machine Specification" section 2.16.2-5 for a detailed description 159 // of the class loading & initialization procedure, and the use of the states. 160 enum ClassState { 161 allocated, // allocated (but not yet linked) 162 loaded, // loaded and inserted in class hierarchy (but not linked yet) 163 linked, // successfully linked/verified (but not initialized yet) 164 being_initialized, // currently running class initializer 165 fully_initialized, // initialized (successfull final state) 177 Annotations* _annotations; 178 // Package this class is defined in 179 PackageEntry* _package_entry; 180 // Array classes holding elements of this class. 181 Klass* volatile _array_klasses; 182 // Constant pool for this class. 183 ConstantPool* _constants; 184 // The InnerClasses attribute and EnclosingMethod attribute. The 185 // _inner_classes is an array of shorts. If the class has InnerClasses 186 // attribute, then the _inner_classes array begins with 4-tuples of shorts 187 // [inner_class_info_index, outer_class_info_index, 188 // inner_name_index, inner_class_access_flags] for the InnerClasses 189 // attribute. If the EnclosingMethod attribute exists, it occupies the 190 // last two shorts [class_index, method_index] of the array. If only 191 // the InnerClasses attribute exists, the _inner_classes array length is 192 // number_of_inner_classes * 4. If the class has both InnerClasses 193 // and EnclosingMethod attributes the _inner_classes array length is 194 // number_of_inner_classes * 4 + enclosing_method_attribute_size. 195 Array<jushort>* _inner_classes; 196 197 // the source debug extension for this klass, NULL if not specified. 198 // Specified as UTF-8 string without terminating zero byte in the classfile, 199 // it is stored in the instanceklass as a NULL-terminated UTF-8 string 200 const char* _source_debug_extension; 201 // Array name derived from this class which needs unreferencing 202 // if this class is unloaded. 203 Symbol* _array_name; 204 205 // Number of heapOopSize words used by non-static fields in this klass 206 // (including inherited fields but after header_size()). 207 int _nonstatic_field_size; 208 int _static_field_size; // number words used by static fields (oop and non-oop) in this klass 209 // Constant pool index to the utf8 entry of the Generic signature, 210 // or 0 if none. 211 u2 _generic_signature_index; 212 // Constant pool index to the utf8 entry for the name of source file 213 // containing this klass, 0 if not specified. 214 u2 _source_file_name_index; 215 u2 _static_oop_field_count;// number of static oop fields in this klass 216 u2 _java_fields_count; // The number of declared Java fields 463 int field_offset (int index) const { return field(index)->offset(); } 464 int field_access_flags(int index) const { return field(index)->access_flags(); } 465 Symbol* field_name (int index) const { return field(index)->name(constants()); } 466 Symbol* field_signature (int index) const { return field(index)->signature(constants()); } 467 bool field_is_flattened(int index) const { return field(index)->is_flattened(); } 468 469 // Number of Java declared fields 470 int java_fields_count() const { return (int)_java_fields_count; } 471 472 Array<u2>* fields() const { return _fields; } 473 void set_fields(Array<u2>* f, u2 java_fields_count) { 474 guarantee(_fields == NULL || f == NULL, "Just checking"); 475 _fields = f; 476 _java_fields_count = java_fields_count; 477 } 478 479 // inner classes 480 Array<u2>* inner_classes() const { return _inner_classes; } 481 void set_inner_classes(Array<u2>* f) { _inner_classes = f; } 482 483 enum InnerClassAttributeOffset { 484 // From http://mirror.eng/products/jdk/1.1/docs/guide/innerclasses/spec/innerclasses.doc10.html#18814 485 inner_class_inner_class_info_offset = 0, 486 inner_class_outer_class_info_offset = 1, 487 inner_class_inner_name_offset = 2, 488 inner_class_access_flags_offset = 3, 489 inner_class_next_offset = 4 490 }; 491 492 enum EnclosingMethodAttributeOffset { 493 enclosing_method_class_index_offset = 0, 494 enclosing_method_method_index_offset = 1, 495 enclosing_method_attribute_size = 2 496 }; 497 498 // method override check 499 bool is_override(const methodHandle& super_method, Handle targetclassloader, Symbol* targetclassname, TRAPS); 500 501 // package 502 PackageEntry* package() const { return _package_entry; } | 126 127 private: 128 int _offset; 129 uint _count; 130 }; 131 132 struct JvmtiCachedClassFileData; 133 134 class SigEntry; 135 136 class ValueKlassFixedBlock VALUE_OBJ_CLASS_SPEC { 137 Array<SigEntry>** _extended_sig; 138 Array<VMRegPair>** _return_regs; 139 address* _pack_handler; 140 address* _unpack_handler; 141 int* _default_value_offset; 142 143 friend class ValueKlass; 144 }; 145 146 class ValueTypes VALUE_OBJ_CLASS_SPEC { 147 public: 148 u2 _class_info_index; 149 Symbol* _class_name; 150 }; 151 152 class InstanceKlass: public Klass { 153 friend class VMStructs; 154 friend class JVMCIVMStructs; 155 friend class ClassFileParser; 156 friend class CompileReplay; 157 158 protected: 159 InstanceKlass(const ClassFileParser& parser, unsigned kind); 160 161 public: 162 InstanceKlass() { assert(DumpSharedSpaces || UseSharedSpaces, "only for CDS"); } 163 164 // See "The Java Virtual Machine Specification" section 2.16.2-5 for a detailed description 165 // of the class loading & initialization procedure, and the use of the states. 166 enum ClassState { 167 allocated, // allocated (but not yet linked) 168 loaded, // loaded and inserted in class hierarchy (but not linked yet) 169 linked, // successfully linked/verified (but not initialized yet) 170 being_initialized, // currently running class initializer 171 fully_initialized, // initialized (successfull final state) 183 Annotations* _annotations; 184 // Package this class is defined in 185 PackageEntry* _package_entry; 186 // Array classes holding elements of this class. 187 Klass* volatile _array_klasses; 188 // Constant pool for this class. 189 ConstantPool* _constants; 190 // The InnerClasses attribute and EnclosingMethod attribute. The 191 // _inner_classes is an array of shorts. If the class has InnerClasses 192 // attribute, then the _inner_classes array begins with 4-tuples of shorts 193 // [inner_class_info_index, outer_class_info_index, 194 // inner_name_index, inner_class_access_flags] for the InnerClasses 195 // attribute. If the EnclosingMethod attribute exists, it occupies the 196 // last two shorts [class_index, method_index] of the array. If only 197 // the InnerClasses attribute exists, the _inner_classes array length is 198 // number_of_inner_classes * 4. If the class has both InnerClasses 199 // and EnclosingMethod attributes the _inner_classes array length is 200 // number_of_inner_classes * 4 + enclosing_method_attribute_size. 201 Array<jushort>* _inner_classes; 202 203 Array<ValueTypes>* _value_types; 204 205 // the source debug extension for this klass, NULL if not specified. 206 // Specified as UTF-8 string without terminating zero byte in the classfile, 207 // it is stored in the instanceklass as a NULL-terminated UTF-8 string 208 const char* _source_debug_extension; 209 // Array name derived from this class which needs unreferencing 210 // if this class is unloaded. 211 Symbol* _array_name; 212 213 // Number of heapOopSize words used by non-static fields in this klass 214 // (including inherited fields but after header_size()). 215 int _nonstatic_field_size; 216 int _static_field_size; // number words used by static fields (oop and non-oop) in this klass 217 // Constant pool index to the utf8 entry of the Generic signature, 218 // or 0 if none. 219 u2 _generic_signature_index; 220 // Constant pool index to the utf8 entry for the name of source file 221 // containing this klass, 0 if not specified. 222 u2 _source_file_name_index; 223 u2 _static_oop_field_count;// number of static oop fields in this klass 224 u2 _java_fields_count; // The number of declared Java fields 471 int field_offset (int index) const { return field(index)->offset(); } 472 int field_access_flags(int index) const { return field(index)->access_flags(); } 473 Symbol* field_name (int index) const { return field(index)->name(constants()); } 474 Symbol* field_signature (int index) const { return field(index)->signature(constants()); } 475 bool field_is_flattened(int index) const { return field(index)->is_flattened(); } 476 477 // Number of Java declared fields 478 int java_fields_count() const { return (int)_java_fields_count; } 479 480 Array<u2>* fields() const { return _fields; } 481 void set_fields(Array<u2>* f, u2 java_fields_count) { 482 guarantee(_fields == NULL || f == NULL, "Just checking"); 483 _fields = f; 484 _java_fields_count = java_fields_count; 485 } 486 487 // inner classes 488 Array<u2>* inner_classes() const { return _inner_classes; } 489 void set_inner_classes(Array<u2>* f) { _inner_classes = f; } 490 491 Array<ValueTypes>* value_types() const { return _value_types; } 492 void set_value_types(Array<ValueTypes>* f) { _value_types = f; } 493 494 bool is_declared_value_type(int index); 495 bool is_declared_value_type(Symbol* symbol); 496 497 static bool is_declared_value_type(Array<ValueTypes>* value_types, int index); 498 static bool is_declared_value_type(ConstantPool* constants, Array<ValueTypes>* value_types, Symbol* symbol); 499 500 enum InnerClassAttributeOffset { 501 // From http://mirror.eng/products/jdk/1.1/docs/guide/innerclasses/spec/innerclasses.doc10.html#18814 502 inner_class_inner_class_info_offset = 0, 503 inner_class_outer_class_info_offset = 1, 504 inner_class_inner_name_offset = 2, 505 inner_class_access_flags_offset = 3, 506 inner_class_next_offset = 4 507 }; 508 509 enum EnclosingMethodAttributeOffset { 510 enclosing_method_class_index_offset = 0, 511 enclosing_method_method_index_offset = 1, 512 enclosing_method_attribute_size = 2 513 }; 514 515 // method override check 516 bool is_override(const methodHandle& super_method, Handle targetclassloader, Symbol* targetclassname, TRAPS); 517 518 // package 519 PackageEntry* package() const { return _package_entry; } |