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