220 u2 _nest_host_index;
221 u2 _this_class_index; // constant pool entry
222 u2 _static_oop_field_count; // number of static oop fields in this klass
223
224 volatile u2 _idnum_allocated_count; // JNI/JVMTI: increments with the addition of methods, old ids don't change
225
226 // Class states are defined as ClassState (see above).
227 // Place the _init_state here to utilize the unused 2-byte after
228 // _idnum_allocated_count.
229 volatile ClassState _init_state; // state of class
230
231 u1 _reference_type; // reference type
232
233 AccessFlags _access_flags; // Access flags. The class/interface distinction is stored here.
234
235 // State is set either at parse time or while executing, atomically to not disturb other state
236 InstanceKlassFlags _misc_flags;
237
238 JavaThread* volatile _init_thread; // Pointer to current thread doing initialization (to handle recursive initialization)
239
240 OopMapCache* volatile _oop_map_cache; // OopMapCache for all methods in the klass (allocated lazily)
241 JNIid* _jni_ids; // First JNI identifier for static fields in this class
242 jmethodID* volatile _methods_jmethod_ids; // jmethodIDs corresponding to method_idnum, or null if none
243 nmethodBucket* volatile _dep_context; // packed DependencyContext structure
244 uint64_t volatile _dep_context_last_cleaned;
245 nmethod* _osr_nmethods_head; // Head of list of on-stack replacement nmethods for this class
246 #if INCLUDE_JVMTI
247 BreakpointInfo* _breakpoints; // bpt lists, managed by Method*
248 // Linked instanceKlasses of previous versions
249 InstanceKlass* _previous_versions;
250 // JVMTI fields can be moved to their own structure - see 6315920
251 // JVMTI: cached class file, before retransformable agent modified it in CFLH
252 JvmtiCachedClassFileData* _cached_class_file;
253 #endif
254
255 #if INCLUDE_JVMTI
256 JvmtiCachedClassFieldMap* _jvmti_cached_class_field_map; // JVMTI: used during heap iteration
257 #endif
258
259 NOT_PRODUCT(int _verify_count;) // to avoid redundant verifies
885 // check whether this class or one of its superclasses was redefined
886 bool has_redefined_this_or_super() const;
887 #endif
888
889 // Access to the implementor of an interface.
890 InstanceKlass* implementor() const;
891 void set_implementor(InstanceKlass* ik);
892 int nof_implementors() const;
893 void add_implementor(InstanceKlass* ik); // ik is a new class that implements this interface
894 void init_implementor(); // initialize
895
896 private:
897 // link this class into the implementors list of every interface it implements
898 void process_interfaces();
899
900 public:
901 // virtual operations from Klass
902 GrowableArray<Klass*>* compute_secondary_supers(int num_extra_slots,
903 Array<InstanceKlass*>* transitive_interfaces) override;
904 bool can_be_primary_super_slow() const override;
905 size_t oop_size(oop obj) const override { return size_helper(); }
906 // slow because it's a virtual call and used for verifying the layout_helper.
907 // Using the layout_helper bits, we can call is_instance_klass without a virtual call.
908 DEBUG_ONLY(bool is_instance_klass_slow() const override { return true; })
909
910 // Iterators
911 void do_local_static_fields(FieldClosure* cl);
912 void do_nonstatic_fields(FieldClosure* cl); // including inherited fields
913 void do_local_static_fields(void f(fieldDescriptor*, Handle, TRAPS), Handle, TRAPS);
914 void print_nonstatic_fields(FieldClosure* cl); // including inherited and injected fields
915
916 void methods_do(void f(Method* method));
917
918 static InstanceKlass* cast(Klass* k) {
919 return const_cast<InstanceKlass*>(cast(const_cast<const Klass*>(k)));
920 }
921
922 static const InstanceKlass* cast(const Klass* k) {
923 assert(k != nullptr, "k should not be null");
924 assert(k->is_instance_klass(), "cast to InstanceKlass");
925 return static_cast<const InstanceKlass*>(k);
952 itable_length(),
953 nonstatic_oop_map_size(),
954 is_interface());
955 }
956
957
958 inline intptr_t* start_of_itable() const;
959 inline intptr_t* end_of_itable() const;
960 inline oop static_field_base_raw();
961
962 inline OopMapBlock* start_of_nonstatic_oop_maps() const;
963 inline Klass** end_of_nonstatic_oop_maps() const;
964
965 inline InstanceKlass* volatile* adr_implementor() const;
966
967 // Use this to return the size of an instance in heap words:
968 int size_helper() const {
969 return layout_helper_to_size_helper(layout_helper());
970 }
971
972 // This bit is initialized in classFileParser.cpp.
973 // It is false under any of the following conditions:
974 // - the class is abstract (including any interface)
975 // - the class size is larger than FastAllocateSizeLimit
976 // - the class is java/lang/Class, which cannot be allocated directly
977 bool can_be_fastpath_allocated() const {
978 return !layout_helper_needs_slow_path(layout_helper());
979 }
980
981 // Java itable
982 klassItable itable() const; // return klassItable wrapper
983 Method* method_at_itable(InstanceKlass* holder, int index, TRAPS);
984 Method* method_at_itable_or_null(InstanceKlass* holder, int index, bool& itable_entry_found);
985 int vtable_index_of_interface_method(Method* method);
986
987 #if INCLUDE_JVMTI
988 void adjust_default_methods(bool* trace_name_printed);
989 #endif // INCLUDE_JVMTI
990
991 void clean_weak_instanceklass_links();
|
220 u2 _nest_host_index;
221 u2 _this_class_index; // constant pool entry
222 u2 _static_oop_field_count; // number of static oop fields in this klass
223
224 volatile u2 _idnum_allocated_count; // JNI/JVMTI: increments with the addition of methods, old ids don't change
225
226 // Class states are defined as ClassState (see above).
227 // Place the _init_state here to utilize the unused 2-byte after
228 // _idnum_allocated_count.
229 volatile ClassState _init_state; // state of class
230
231 u1 _reference_type; // reference type
232
233 AccessFlags _access_flags; // Access flags. The class/interface distinction is stored here.
234
235 // State is set either at parse time or while executing, atomically to not disturb other state
236 InstanceKlassFlags _misc_flags;
237
238 JavaThread* volatile _init_thread; // Pointer to current thread doing initialization (to handle recursive initialization)
239
240 int _hash_offset; // Offset of hidden field for i-hash
241
242 OopMapCache* volatile _oop_map_cache; // OopMapCache for all methods in the klass (allocated lazily)
243 JNIid* _jni_ids; // First JNI identifier for static fields in this class
244 jmethodID* volatile _methods_jmethod_ids; // jmethodIDs corresponding to method_idnum, or null if none
245 nmethodBucket* volatile _dep_context; // packed DependencyContext structure
246 uint64_t volatile _dep_context_last_cleaned;
247 nmethod* _osr_nmethods_head; // Head of list of on-stack replacement nmethods for this class
248 #if INCLUDE_JVMTI
249 BreakpointInfo* _breakpoints; // bpt lists, managed by Method*
250 // Linked instanceKlasses of previous versions
251 InstanceKlass* _previous_versions;
252 // JVMTI fields can be moved to their own structure - see 6315920
253 // JVMTI: cached class file, before retransformable agent modified it in CFLH
254 JvmtiCachedClassFileData* _cached_class_file;
255 #endif
256
257 #if INCLUDE_JVMTI
258 JvmtiCachedClassFieldMap* _jvmti_cached_class_field_map; // JVMTI: used during heap iteration
259 #endif
260
261 NOT_PRODUCT(int _verify_count;) // to avoid redundant verifies
887 // check whether this class or one of its superclasses was redefined
888 bool has_redefined_this_or_super() const;
889 #endif
890
891 // Access to the implementor of an interface.
892 InstanceKlass* implementor() const;
893 void set_implementor(InstanceKlass* ik);
894 int nof_implementors() const;
895 void add_implementor(InstanceKlass* ik); // ik is a new class that implements this interface
896 void init_implementor(); // initialize
897
898 private:
899 // link this class into the implementors list of every interface it implements
900 void process_interfaces();
901
902 public:
903 // virtual operations from Klass
904 GrowableArray<Klass*>* compute_secondary_supers(int num_extra_slots,
905 Array<InstanceKlass*>* transitive_interfaces) override;
906 bool can_be_primary_super_slow() const override;
907 size_t oop_size(oop obj, markWord mark) const override { return size_helper(); }
908 // slow because it's a virtual call and used for verifying the layout_helper.
909 // Using the layout_helper bits, we can call is_instance_klass without a virtual call.
910 DEBUG_ONLY(bool is_instance_klass_slow() const override { return true; })
911
912 // Iterators
913 void do_local_static_fields(FieldClosure* cl);
914 void do_nonstatic_fields(FieldClosure* cl); // including inherited fields
915 void do_local_static_fields(void f(fieldDescriptor*, Handle, TRAPS), Handle, TRAPS);
916 void print_nonstatic_fields(FieldClosure* cl); // including inherited and injected fields
917
918 void methods_do(void f(Method* method));
919
920 static InstanceKlass* cast(Klass* k) {
921 return const_cast<InstanceKlass*>(cast(const_cast<const Klass*>(k)));
922 }
923
924 static const InstanceKlass* cast(const Klass* k) {
925 assert(k != nullptr, "k should not be null");
926 assert(k->is_instance_klass(), "cast to InstanceKlass");
927 return static_cast<const InstanceKlass*>(k);
954 itable_length(),
955 nonstatic_oop_map_size(),
956 is_interface());
957 }
958
959
960 inline intptr_t* start_of_itable() const;
961 inline intptr_t* end_of_itable() const;
962 inline oop static_field_base_raw();
963
964 inline OopMapBlock* start_of_nonstatic_oop_maps() const;
965 inline Klass** end_of_nonstatic_oop_maps() const;
966
967 inline InstanceKlass* volatile* adr_implementor() const;
968
969 // Use this to return the size of an instance in heap words:
970 int size_helper() const {
971 return layout_helper_to_size_helper(layout_helper());
972 }
973
974 virtual int hash_offset_in_bytes(oop obj, markWord m) const override {
975 assert(UseCompactObjectHeaders, "only with compact i-hash");
976 return _hash_offset;
977 }
978 static int hash_offset_offset_in_bytes() {
979 assert(UseCompactObjectHeaders, "only with compact i-hash");
980 return (int)offset_of(InstanceKlass, _hash_offset);
981 }
982
983 // This bit is initialized in classFileParser.cpp.
984 // It is false under any of the following conditions:
985 // - the class is abstract (including any interface)
986 // - the class size is larger than FastAllocateSizeLimit
987 // - the class is java/lang/Class, which cannot be allocated directly
988 bool can_be_fastpath_allocated() const {
989 return !layout_helper_needs_slow_path(layout_helper());
990 }
991
992 // Java itable
993 klassItable itable() const; // return klassItable wrapper
994 Method* method_at_itable(InstanceKlass* holder, int index, TRAPS);
995 Method* method_at_itable_or_null(InstanceKlass* holder, int index, bool& itable_entry_found);
996 int vtable_index_of_interface_method(Method* method);
997
998 #if INCLUDE_JVMTI
999 void adjust_default_methods(bool* trace_name_printed);
1000 #endif // INCLUDE_JVMTI
1001
1002 void clean_weak_instanceklass_links();
|