188
189 // The NestMembers attribute. An array of shorts, where each is a
190 // class info index for the class that is a nest member. This data
191 // has not been validated.
192 Array<jushort>* _nest_members;
193
194 // Resolved nest-host klass: either true nest-host or self if we are not
195 // nested, or an error occurred resolving or validating the nominated
196 // nest-host. Can also be set directly by JDK API's that establish nest
197 // relationships.
198 // By always being set it makes nest-member access checks simpler.
199 InstanceKlass* _nest_host;
200
201 // The contents of the Record attribute.
202 Array<RecordComponent*>* _record_components;
203
204 // the source debug extension for this klass, NULL if not specified.
205 // Specified as UTF-8 string without terminating zero byte in the classfile,
206 // it is stored in the instanceklass as a NULL-terminated UTF-8 string
207 const char* _source_debug_extension;
208 // Array name derived from this class which needs unreferencing
209 // if this class is unloaded.
210 Symbol* _array_name;
211
212 // Number of heapOopSize words used by non-static fields in this klass
213 // (including inherited fields but after header_size()).
214 int _nonstatic_field_size;
215 int _static_field_size; // number words used by static fields (oop and non-oop) in this klass
216
217 int _nonstatic_oop_map_size;// size in words of nonstatic oop map blocks
218 int _itable_len; // length of Java itable (in words)
219
220 // The NestHost attribute. The class info index for the class
221 // that is the nest-host of this class. This data has not been validated.
222 u2 _nest_host_index;
223 u2 _this_class_index; // constant pool entry
224
225 u2 _static_oop_field_count;// number of static oop fields in this klass
226 u2 _java_fields_count; // The number of declared Java fields
227
228 volatile u2 _idnum_allocated_count; // JNI/JVMTI: increments with the addition of methods, old ids don't change
229
230 // _is_marked_dependent can be set concurrently, thus cannot be part of the
717 } else {
718 _misc_flags &= ~_misc_is_contended;
719 }
720 }
721
722 // source file name
723 Symbol* source_file_name() const { return _constants->source_file_name(); }
724 u2 source_file_name_index() const { return _constants->source_file_name_index(); }
725 void set_source_file_name_index(u2 sourcefile_index) { _constants->set_source_file_name_index(sourcefile_index); }
726
727 // minor and major version numbers of class file
728 u2 minor_version() const { return _constants->minor_version(); }
729 void set_minor_version(u2 minor_version) { _constants->set_minor_version(minor_version); }
730 u2 major_version() const { return _constants->major_version(); }
731 void set_major_version(u2 major_version) { _constants->set_major_version(major_version); }
732
733 // source debug extension
734 const char* source_debug_extension() const { return _source_debug_extension; }
735 void set_source_debug_extension(const char* array, int length);
736
737 // symbol unloading support (refcount already added)
738 Symbol* array_name() { return _array_name; }
739 void set_array_name(Symbol* name) { assert(_array_name == NULL || name == NULL, "name already created"); _array_name = name; }
740
741 // nonstatic oop-map blocks
742 static int nonstatic_oop_map_size(unsigned int oop_map_count) {
743 return oop_map_count * OopMapBlock::size_in_words();
744 }
745 unsigned int nonstatic_oop_map_count() const {
746 return _nonstatic_oop_map_size / OopMapBlock::size_in_words();
747 }
748 int nonstatic_oop_map_size() const { return _nonstatic_oop_map_size; }
749 void set_nonstatic_oop_map_size(int words) {
750 _nonstatic_oop_map_size = words;
751 }
752
753 bool has_contended_annotations() const {
754 return ((_misc_flags & _misc_has_contended_annotations) != 0);
755 }
756 void set_has_contended_annotations(bool value) {
757 if (value) {
758 _misc_flags |= _misc_has_contended_annotations;
759 } else {
760 _misc_flags &= ~_misc_has_contended_annotations;
1176 public:
1177 // Explicit metaspace deallocation of fields
1178 // For RedefineClasses and class file parsing errors, we need to deallocate
1179 // instanceKlasses and the metadata they point to.
1180 void deallocate_contents(ClassLoaderData* loader_data);
1181 static void deallocate_methods(ClassLoaderData* loader_data,
1182 Array<Method*>* methods);
1183 void static deallocate_interfaces(ClassLoaderData* loader_data,
1184 const Klass* super_klass,
1185 Array<InstanceKlass*>* local_interfaces,
1186 Array<InstanceKlass*>* transitive_interfaces);
1187 void static deallocate_record_components(ClassLoaderData* loader_data,
1188 Array<RecordComponent*>* record_component);
1189
1190 // The constant pool is on stack if any of the methods are executing or
1191 // referenced by handles.
1192 bool on_stack() const { return _constants->on_stack(); }
1193
1194 // callbacks for actions during class unloading
1195 static void unload_class(InstanceKlass* ik);
1196 static void release_C_heap_structures(InstanceKlass* ik);
1197
1198 // Naming
1199 const char* signature_name() const;
1200
1201 // Oop fields (and metadata) iterators
1202 //
1203 // The InstanceKlass iterators also visits the Object's klass.
1204
1205 // Forward iteration
1206 public:
1207 // Iterate over all oop fields in the oop maps.
1208 template <typename T, class OopClosureType>
1209 inline void oop_oop_iterate_oop_maps(oop obj, OopClosureType* closure);
1210
1211 // Iterate over all oop fields and metadata.
1212 template <typename T, class OopClosureType>
1213 inline void oop_oop_iterate(oop obj, OopClosureType* closure);
1214
1215 // Iterate over all oop fields in one oop map.
1216 template <typename T, class OopClosureType>
1287 Klass* array_klass_impl(bool or_null, int n, TRAPS);
1288
1289 // Returns the array class with this class as element type
1290 Klass* array_klass_impl(bool or_null, TRAPS);
1291
1292 // find a local method (returns NULL if not found)
1293 Method* find_method_impl(const Symbol* name,
1294 const Symbol* signature,
1295 OverpassLookupMode overpass_mode,
1296 StaticLookupMode static_mode,
1297 PrivateLookupMode private_mode) const;
1298
1299 static Method* find_method_impl(const Array<Method*>* methods,
1300 const Symbol* name,
1301 const Symbol* signature,
1302 OverpassLookupMode overpass_mode,
1303 StaticLookupMode static_mode,
1304 PrivateLookupMode private_mode);
1305
1306 // Free CHeap allocated fields.
1307 void release_C_heap_structures();
1308
1309 #if INCLUDE_JVMTI
1310 // RedefineClasses support
1311 void link_previous_versions(InstanceKlass* pv) { _previous_versions = pv; }
1312 void mark_newly_obsolete_methods(Array<Method*>* old_methods, int emcp_method_count);
1313 #endif
1314 public:
1315 // CDS support - remove and restore oops from metadata. Oops are not shared.
1316 virtual void remove_unshareable_info();
1317 virtual void remove_java_mirror();
1318 void restore_unshareable_info(ClassLoaderData* loader_data, Handle protection_domain, PackageEntry* pkg_entry, TRAPS);
1319
1320 // jvm support
1321 jint compute_modifier_flags(TRAPS) const;
1322
1323 public:
1324 // JVMTI support
1325 jint jvmti_class_status() const;
1326
1327 virtual void metaspace_pointers_do(MetaspaceClosure* iter);
|
188
189 // The NestMembers attribute. An array of shorts, where each is a
190 // class info index for the class that is a nest member. This data
191 // has not been validated.
192 Array<jushort>* _nest_members;
193
194 // Resolved nest-host klass: either true nest-host or self if we are not
195 // nested, or an error occurred resolving or validating the nominated
196 // nest-host. Can also be set directly by JDK API's that establish nest
197 // relationships.
198 // By always being set it makes nest-member access checks simpler.
199 InstanceKlass* _nest_host;
200
201 // The contents of the Record attribute.
202 Array<RecordComponent*>* _record_components;
203
204 // the source debug extension for this klass, NULL if not specified.
205 // Specified as UTF-8 string without terminating zero byte in the classfile,
206 // it is stored in the instanceklass as a NULL-terminated UTF-8 string
207 const char* _source_debug_extension;
208
209 // Number of heapOopSize words used by non-static fields in this klass
210 // (including inherited fields but after header_size()).
211 int _nonstatic_field_size;
212 int _static_field_size; // number words used by static fields (oop and non-oop) in this klass
213
214 int _nonstatic_oop_map_size;// size in words of nonstatic oop map blocks
215 int _itable_len; // length of Java itable (in words)
216
217 // The NestHost attribute. The class info index for the class
218 // that is the nest-host of this class. This data has not been validated.
219 u2 _nest_host_index;
220 u2 _this_class_index; // constant pool entry
221
222 u2 _static_oop_field_count;// number of static oop fields in this klass
223 u2 _java_fields_count; // The number of declared Java fields
224
225 volatile u2 _idnum_allocated_count; // JNI/JVMTI: increments with the addition of methods, old ids don't change
226
227 // _is_marked_dependent can be set concurrently, thus cannot be part of the
714 } else {
715 _misc_flags &= ~_misc_is_contended;
716 }
717 }
718
719 // source file name
720 Symbol* source_file_name() const { return _constants->source_file_name(); }
721 u2 source_file_name_index() const { return _constants->source_file_name_index(); }
722 void set_source_file_name_index(u2 sourcefile_index) { _constants->set_source_file_name_index(sourcefile_index); }
723
724 // minor and major version numbers of class file
725 u2 minor_version() const { return _constants->minor_version(); }
726 void set_minor_version(u2 minor_version) { _constants->set_minor_version(minor_version); }
727 u2 major_version() const { return _constants->major_version(); }
728 void set_major_version(u2 major_version) { _constants->set_major_version(major_version); }
729
730 // source debug extension
731 const char* source_debug_extension() const { return _source_debug_extension; }
732 void set_source_debug_extension(const char* array, int length);
733
734 // nonstatic oop-map blocks
735 static int nonstatic_oop_map_size(unsigned int oop_map_count) {
736 return oop_map_count * OopMapBlock::size_in_words();
737 }
738 unsigned int nonstatic_oop_map_count() const {
739 return _nonstatic_oop_map_size / OopMapBlock::size_in_words();
740 }
741 int nonstatic_oop_map_size() const { return _nonstatic_oop_map_size; }
742 void set_nonstatic_oop_map_size(int words) {
743 _nonstatic_oop_map_size = words;
744 }
745
746 bool has_contended_annotations() const {
747 return ((_misc_flags & _misc_has_contended_annotations) != 0);
748 }
749 void set_has_contended_annotations(bool value) {
750 if (value) {
751 _misc_flags |= _misc_has_contended_annotations;
752 } else {
753 _misc_flags &= ~_misc_has_contended_annotations;
1169 public:
1170 // Explicit metaspace deallocation of fields
1171 // For RedefineClasses and class file parsing errors, we need to deallocate
1172 // instanceKlasses and the metadata they point to.
1173 void deallocate_contents(ClassLoaderData* loader_data);
1174 static void deallocate_methods(ClassLoaderData* loader_data,
1175 Array<Method*>* methods);
1176 void static deallocate_interfaces(ClassLoaderData* loader_data,
1177 const Klass* super_klass,
1178 Array<InstanceKlass*>* local_interfaces,
1179 Array<InstanceKlass*>* transitive_interfaces);
1180 void static deallocate_record_components(ClassLoaderData* loader_data,
1181 Array<RecordComponent*>* record_component);
1182
1183 // The constant pool is on stack if any of the methods are executing or
1184 // referenced by handles.
1185 bool on_stack() const { return _constants->on_stack(); }
1186
1187 // callbacks for actions during class unloading
1188 static void unload_class(InstanceKlass* ik);
1189
1190 virtual void release_C_heap_structures();
1191
1192 // Naming
1193 const char* signature_name() const;
1194
1195 // Oop fields (and metadata) iterators
1196 //
1197 // The InstanceKlass iterators also visits the Object's klass.
1198
1199 // Forward iteration
1200 public:
1201 // Iterate over all oop fields in the oop maps.
1202 template <typename T, class OopClosureType>
1203 inline void oop_oop_iterate_oop_maps(oop obj, OopClosureType* closure);
1204
1205 // Iterate over all oop fields and metadata.
1206 template <typename T, class OopClosureType>
1207 inline void oop_oop_iterate(oop obj, OopClosureType* closure);
1208
1209 // Iterate over all oop fields in one oop map.
1210 template <typename T, class OopClosureType>
1281 Klass* array_klass_impl(bool or_null, int n, TRAPS);
1282
1283 // Returns the array class with this class as element type
1284 Klass* array_klass_impl(bool or_null, TRAPS);
1285
1286 // find a local method (returns NULL if not found)
1287 Method* find_method_impl(const Symbol* name,
1288 const Symbol* signature,
1289 OverpassLookupMode overpass_mode,
1290 StaticLookupMode static_mode,
1291 PrivateLookupMode private_mode) const;
1292
1293 static Method* find_method_impl(const Array<Method*>* methods,
1294 const Symbol* name,
1295 const Symbol* signature,
1296 OverpassLookupMode overpass_mode,
1297 StaticLookupMode static_mode,
1298 PrivateLookupMode private_mode);
1299
1300 // Free CHeap allocated fields.
1301 void release_C_heap_structures_internal();
1302
1303 #if INCLUDE_JVMTI
1304 // RedefineClasses support
1305 void link_previous_versions(InstanceKlass* pv) { _previous_versions = pv; }
1306 void mark_newly_obsolete_methods(Array<Method*>* old_methods, int emcp_method_count);
1307 #endif
1308 public:
1309 // CDS support - remove and restore oops from metadata. Oops are not shared.
1310 virtual void remove_unshareable_info();
1311 virtual void remove_java_mirror();
1312 void restore_unshareable_info(ClassLoaderData* loader_data, Handle protection_domain, PackageEntry* pkg_entry, TRAPS);
1313
1314 // jvm support
1315 jint compute_modifier_flags(TRAPS) const;
1316
1317 public:
1318 // JVMTI support
1319 jint jvmti_class_status() const;
1320
1321 virtual void metaspace_pointers_do(MetaspaceClosure* iter);
|