219 // The NestHost attribute. The class info index for the class
220 // that is the nest-host of this class. This data has not been validated.
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 // State is set either at parse time or while executing, atomically to not disturb other state
235 InstanceKlassFlags _misc_flags;
236
237 JavaThread* volatile _init_thread; // Pointer to current thread doing initialization (to handle recursive initialization)
238
239 OopMapCache* volatile _oop_map_cache; // OopMapCache for all methods in the klass (allocated lazily)
240 JNIid* _jni_ids; // First JNI identifier for static fields in this class
241 jmethodID* volatile _methods_jmethod_ids; // jmethodIDs corresponding to method_idnum, or null if none
242 nmethodBucket* volatile _dep_context; // packed DependencyContext structure
243 uint64_t volatile _dep_context_last_cleaned;
244 nmethod* _osr_nmethods_head; // Head of list of on-stack replacement nmethods for this class
245 #if INCLUDE_JVMTI
246 BreakpointInfo* _breakpoints; // bpt lists, managed by Method*
247 // Linked instanceKlasses of previous versions
248 InstanceKlass* _previous_versions;
249 // JVMTI fields can be moved to their own structure - see 6315920
250 // JVMTI: cached class file, before retransformable agent modified it in CFLH
251 JvmtiCachedClassFileData* _cached_class_file;
252 #endif
253
254 #if INCLUDE_JVMTI
255 JvmtiCachedClassFieldMap* _jvmti_cached_class_field_map; // JVMTI: used during heap iteration
256 #endif
257
258 NOT_PRODUCT(int _verify_count;) // to avoid redundant verifies
868 // check whether this class or one of its superclasses was redefined
869 bool has_redefined_this_or_super() const;
870 #endif
871
872 // Access to the implementor of an interface.
873 InstanceKlass* implementor() const;
874 void set_implementor(InstanceKlass* ik);
875 int nof_implementors() const;
876 void add_implementor(InstanceKlass* ik); // ik is a new class that implements this interface
877 void init_implementor(); // initialize
878
879 private:
880 // link this class into the implementors list of every interface it implements
881 void process_interfaces();
882
883 public:
884 // virtual operations from Klass
885 GrowableArray<Klass*>* compute_secondary_supers(int num_extra_slots,
886 Array<InstanceKlass*>* transitive_interfaces);
887 bool can_be_primary_super_slow() const;
888 size_t oop_size(oop obj) const { return size_helper(); }
889 // slow because it's a virtual call and used for verifying the layout_helper.
890 // Using the layout_helper bits, we can call is_instance_klass without a virtual call.
891 DEBUG_ONLY(bool is_instance_klass_slow() const { return true; })
892
893 // Iterators
894 void do_local_static_fields(FieldClosure* cl);
895 void do_nonstatic_fields(FieldClosure* cl); // including inherited fields
896 void do_local_static_fields(void f(fieldDescriptor*, Handle, TRAPS), Handle, TRAPS);
897 void print_nonstatic_fields(FieldClosure* cl); // including inherited and injected fields
898
899 void methods_do(void f(Method* method));
900
901 static InstanceKlass* cast(Klass* k) {
902 return const_cast<InstanceKlass*>(cast(const_cast<const Klass*>(k)));
903 }
904
905 static const InstanceKlass* cast(const Klass* k) {
906 assert(k != nullptr, "k should not be null");
907 assert(k->is_instance_klass(), "cast to InstanceKlass");
908 return static_cast<const InstanceKlass*>(k);
935 itable_length(),
936 nonstatic_oop_map_size(),
937 is_interface());
938 }
939
940
941 inline intptr_t* start_of_itable() const;
942 inline intptr_t* end_of_itable() const;
943 inline oop static_field_base_raw();
944
945 inline OopMapBlock* start_of_nonstatic_oop_maps() const;
946 inline Klass** end_of_nonstatic_oop_maps() const;
947
948 inline InstanceKlass* volatile* adr_implementor() const;
949
950 // Use this to return the size of an instance in heap words:
951 int size_helper() const {
952 return layout_helper_to_size_helper(layout_helper());
953 }
954
955 // This bit is initialized in classFileParser.cpp.
956 // It is false under any of the following conditions:
957 // - the class is abstract (including any interface)
958 // - the class size is larger than FastAllocateSizeLimit
959 // - the class is java/lang/Class, which cannot be allocated directly
960 bool can_be_fastpath_allocated() const {
961 return !layout_helper_needs_slow_path(layout_helper());
962 }
963
964 // Java itable
965 klassItable itable() const; // return klassItable wrapper
966 Method* method_at_itable(InstanceKlass* holder, int index, TRAPS);
967 Method* method_at_itable_or_null(InstanceKlass* holder, int index, bool& itable_entry_found);
968 int vtable_index_of_interface_method(Method* method);
969
970 #if INCLUDE_JVMTI
971 void adjust_default_methods(bool* trace_name_printed);
972 #endif // INCLUDE_JVMTI
973
974 void clean_weak_instanceklass_links();
|
219 // The NestHost attribute. The class info index for the class
220 // that is the nest-host of this class. This data has not been validated.
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 // State is set either at parse time or while executing, atomically to not disturb other state
235 InstanceKlassFlags _misc_flags;
236
237 JavaThread* volatile _init_thread; // Pointer to current thread doing initialization (to handle recursive initialization)
238
239 int _hash_offset; // Offset of hidden field for i-hash
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, markWord mark) 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);
937 itable_length(),
938 nonstatic_oop_map_size(),
939 is_interface());
940 }
941
942
943 inline intptr_t* start_of_itable() const;
944 inline intptr_t* end_of_itable() const;
945 inline oop static_field_base_raw();
946
947 inline OopMapBlock* start_of_nonstatic_oop_maps() const;
948 inline Klass** end_of_nonstatic_oop_maps() const;
949
950 inline InstanceKlass* volatile* adr_implementor() const;
951
952 // Use this to return the size of an instance in heap words:
953 int size_helper() const {
954 return layout_helper_to_size_helper(layout_helper());
955 }
956
957 virtual int hash_offset_in_bytes(oop obj, markWord m) const {
958 assert(UseCompactObjectHeaders, "only with compact i-hash");
959 return _hash_offset;
960 }
961 static int hash_offset_offset_in_bytes() {
962 assert(UseCompactObjectHeaders, "only with compact i-hash");
963 return (int)offset_of(InstanceKlass, _hash_offset);
964 }
965
966 // This bit is initialized in classFileParser.cpp.
967 // It is false under any of the following conditions:
968 // - the class is abstract (including any interface)
969 // - the class size is larger than FastAllocateSizeLimit
970 // - the class is java/lang/Class, which cannot be allocated directly
971 bool can_be_fastpath_allocated() const {
972 return !layout_helper_needs_slow_path(layout_helper());
973 }
974
975 // Java itable
976 klassItable itable() const; // return klassItable wrapper
977 Method* method_at_itable(InstanceKlass* holder, int index, TRAPS);
978 Method* method_at_itable_or_null(InstanceKlass* holder, int index, bool& itable_entry_found);
979 int vtable_index_of_interface_method(Method* method);
980
981 #if INCLUDE_JVMTI
982 void adjust_default_methods(bool* trace_name_printed);
983 #endif // INCLUDE_JVMTI
984
985 void clean_weak_instanceklass_links();
|