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