221 // The NestHost attribute. The class info index for the class
222 // that is the nest-host of this class. This data has not been validated.
223 u2 _nest_host_index;
224 u2 _this_class_index; // constant pool entry
225 u2 _static_oop_field_count; // number of static oop fields in this klass
226
227 volatile u2 _idnum_allocated_count; // JNI/JVMTI: increments with the addition of methods, old ids don't change
228
229 // Class states are defined as ClassState (see above).
230 // Place the _init_state here to utilize the unused 2-byte after
231 // _idnum_allocated_count.
232 volatile ClassState _init_state; // state of class
233
234 u1 _reference_type; // reference type
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
869 // check whether this class or one of its superclasses was redefined
870 bool has_redefined_this_or_super() const;
871 #endif
872
873 // Access to the implementor of an interface.
874 InstanceKlass* implementor() const;
875 void set_implementor(InstanceKlass* ik);
876 int nof_implementors() const;
877 void add_implementor(InstanceKlass* ik); // ik is a new class that implements this interface
878 void init_implementor(); // initialize
879
880 private:
881 // link this class into the implementors list of every interface it implements
882 void process_interfaces();
883
884 public:
885 // virtual operations from Klass
886 GrowableArray<Klass*>* compute_secondary_supers(int num_extra_slots,
887 Array<InstanceKlass*>* transitive_interfaces);
888 bool can_be_primary_super_slow() const;
889 size_t oop_size(oop obj) const { return size_helper(); }
890 // slow because it's a virtual call and used for verifying the layout_helper.
891 // Using the layout_helper bits, we can call is_instance_klass without a virtual call.
892 DEBUG_ONLY(bool is_instance_klass_slow() const { return true; })
893
894 // Iterators
895 void do_local_static_fields(FieldClosure* cl);
896 void do_nonstatic_fields(FieldClosure* cl); // including inherited fields
897 void do_local_static_fields(void f(fieldDescriptor*, Handle, TRAPS), Handle, TRAPS);
898 void print_nonstatic_fields(FieldClosure* cl); // including inherited and injected fields
899
900 void methods_do(void f(Method* method));
901
902 static InstanceKlass* cast(Klass* k) {
903 return const_cast<InstanceKlass*>(cast(const_cast<const Klass*>(k)));
904 }
905
906 static const InstanceKlass* cast(const Klass* k) {
907 assert(k != nullptr, "k should not be null");
908 assert(k->is_instance_klass(), "cast to InstanceKlass");
909 return static_cast<const InstanceKlass*>(k);
930 itable_length(),
931 nonstatic_oop_map_size(),
932 is_interface());
933 }
934
935
936 inline intptr_t* start_of_itable() const;
937 inline intptr_t* end_of_itable() const;
938 inline oop static_field_base_raw();
939
940 inline OopMapBlock* start_of_nonstatic_oop_maps() const;
941 inline Klass** end_of_nonstatic_oop_maps() const;
942
943 inline InstanceKlass* volatile* adr_implementor() const;
944
945 // Use this to return the size of an instance in heap words:
946 int size_helper() const {
947 return layout_helper_to_size_helper(layout_helper());
948 }
949
950 // This bit is initialized in classFileParser.cpp.
951 // It is false under any of the following conditions:
952 // - the class is abstract (including any interface)
953 // - the class size is larger than FastAllocateSizeLimit
954 // - the class is java/lang/Class, which cannot be allocated directly
955 bool can_be_fastpath_allocated() const {
956 return !layout_helper_needs_slow_path(layout_helper());
957 }
958
959 // Java itable
960 klassItable itable() const; // return klassItable wrapper
961 Method* method_at_itable(InstanceKlass* holder, int index, TRAPS);
962 Method* method_at_itable_or_null(InstanceKlass* holder, int index, bool& itable_entry_found);
963 int vtable_index_of_interface_method(Method* method);
964
965 #if INCLUDE_JVMTI
966 void adjust_default_methods(bool* trace_name_printed);
967 #endif // INCLUDE_JVMTI
968
969 void clean_weak_instanceklass_links();
|
221 // The NestHost attribute. The class info index for the class
222 // that is the nest-host of this class. This data has not been validated.
223 u2 _nest_host_index;
224 u2 _this_class_index; // constant pool entry
225 u2 _static_oop_field_count; // number of static oop fields in this klass
226
227 volatile u2 _idnum_allocated_count; // JNI/JVMTI: increments with the addition of methods, old ids don't change
228
229 // Class states are defined as ClassState (see above).
230 // Place the _init_state here to utilize the unused 2-byte after
231 // _idnum_allocated_count.
232 volatile ClassState _init_state; // state of class
233
234 u1 _reference_type; // reference type
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
871 // check whether this class or one of its superclasses was redefined
872 bool has_redefined_this_or_super() const;
873 #endif
874
875 // Access to the implementor of an interface.
876 InstanceKlass* implementor() const;
877 void set_implementor(InstanceKlass* ik);
878 int nof_implementors() const;
879 void add_implementor(InstanceKlass* ik); // ik is a new class that implements this interface
880 void init_implementor(); // initialize
881
882 private:
883 // link this class into the implementors list of every interface it implements
884 void process_interfaces();
885
886 public:
887 // virtual operations from Klass
888 GrowableArray<Klass*>* compute_secondary_supers(int num_extra_slots,
889 Array<InstanceKlass*>* transitive_interfaces);
890 bool can_be_primary_super_slow() const;
891 size_t oop_size(oop obj, markWord mark) const { return size_helper(); }
892 // slow because it's a virtual call and used for verifying the layout_helper.
893 // Using the layout_helper bits, we can call is_instance_klass without a virtual call.
894 DEBUG_ONLY(bool is_instance_klass_slow() const { return true; })
895
896 // Iterators
897 void do_local_static_fields(FieldClosure* cl);
898 void do_nonstatic_fields(FieldClosure* cl); // including inherited fields
899 void do_local_static_fields(void f(fieldDescriptor*, Handle, TRAPS), Handle, TRAPS);
900 void print_nonstatic_fields(FieldClosure* cl); // including inherited and injected fields
901
902 void methods_do(void f(Method* method));
903
904 static InstanceKlass* cast(Klass* k) {
905 return const_cast<InstanceKlass*>(cast(const_cast<const Klass*>(k)));
906 }
907
908 static const InstanceKlass* cast(const Klass* k) {
909 assert(k != nullptr, "k should not be null");
910 assert(k->is_instance_klass(), "cast to InstanceKlass");
911 return static_cast<const InstanceKlass*>(k);
932 itable_length(),
933 nonstatic_oop_map_size(),
934 is_interface());
935 }
936
937
938 inline intptr_t* start_of_itable() const;
939 inline intptr_t* end_of_itable() const;
940 inline oop static_field_base_raw();
941
942 inline OopMapBlock* start_of_nonstatic_oop_maps() const;
943 inline Klass** end_of_nonstatic_oop_maps() const;
944
945 inline InstanceKlass* volatile* adr_implementor() const;
946
947 // Use this to return the size of an instance in heap words:
948 int size_helper() const {
949 return layout_helper_to_size_helper(layout_helper());
950 }
951
952 virtual int hash_offset_in_bytes(oop obj) const {
953 assert(UseCompactObjectHeaders, "only with compact i-hash");
954 return _hash_offset;
955 }
956 static int hash_offset_offset_in_bytes() {
957 assert(UseCompactObjectHeaders, "only with compact i-hash");
958 return (int)offset_of(InstanceKlass, _hash_offset);
959 }
960
961 // This bit is initialized in classFileParser.cpp.
962 // It is false under any of the following conditions:
963 // - the class is abstract (including any interface)
964 // - the class size is larger than FastAllocateSizeLimit
965 // - the class is java/lang/Class, which cannot be allocated directly
966 bool can_be_fastpath_allocated() const {
967 return !layout_helper_needs_slow_path(layout_helper());
968 }
969
970 // Java itable
971 klassItable itable() const; // return klassItable wrapper
972 Method* method_at_itable(InstanceKlass* holder, int index, TRAPS);
973 Method* method_at_itable_or_null(InstanceKlass* holder, int index, bool& itable_entry_found);
974 int vtable_index_of_interface_method(Method* method);
975
976 #if INCLUDE_JVMTI
977 void adjust_default_methods(bool* trace_name_printed);
978 #endif // INCLUDE_JVMTI
979
980 void clean_weak_instanceklass_links();
|