< prev index next >

src/hotspot/share/oops/instanceKlass.hpp

Print this page

 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

 889   // check whether this class or one of its superclasses was redefined
 890   bool has_redefined_this_or_super() const;
 891 #endif
 892 
 893   // Access to the implementor of an interface.
 894   InstanceKlass* implementor() const;
 895   void set_implementor(InstanceKlass* ik);
 896   int  nof_implementors() const;
 897   void add_implementor(InstanceKlass* ik);  // ik is a new class that implements this interface
 898   void init_implementor();           // initialize
 899 
 900  private:
 901   // link this class into the implementors list of every interface it implements
 902   void process_interfaces();
 903 
 904  public:
 905   // virtual operations from Klass
 906   GrowableArray<Klass*>* compute_secondary_supers(int num_extra_slots,
 907                                                   Array<InstanceKlass*>* transitive_interfaces) override;
 908   bool can_be_primary_super_slow() const override;
 909   size_t oop_size(oop obj) const override { return size_helper(); }
 910   // slow because it's a virtual call and used for verifying the layout_helper.
 911   // Using the layout_helper bits, we can call is_instance_klass without a virtual call.
 912   DEBUG_ONLY(bool is_instance_klass_slow() const override { return true; })
 913 
 914   // Iterators
 915   void do_local_static_fields(FieldClosure* cl);
 916   void do_nonstatic_fields(FieldClosure* cl); // including inherited fields
 917   void do_local_static_fields(void f(fieldDescriptor*, Handle, TRAPS), Handle, TRAPS);
 918   void print_nonstatic_fields(FieldClosure* cl); // including inherited and injected fields
 919 
 920   void methods_do(void f(Method* method));
 921 
 922   static InstanceKlass* cast(Klass* k) {
 923     return const_cast<InstanceKlass*>(cast(const_cast<const Klass*>(k)));
 924   }
 925 
 926   static const InstanceKlass* cast(const Klass* k) {
 927     assert(k != nullptr, "k should not be null");
 928     assert(k->is_instance_klass(), "cast to InstanceKlass");
 929     return static_cast<const InstanceKlass*>(k);

 956                                                     itable_length(),
 957                                                     nonstatic_oop_map_size(),
 958                                                     is_interface());
 959   }
 960 
 961 
 962   inline intptr_t* start_of_itable() const;
 963   inline intptr_t* end_of_itable() const;
 964   inline oop static_field_base_raw();
 965 
 966   inline OopMapBlock* start_of_nonstatic_oop_maps() const;
 967   inline Klass** end_of_nonstatic_oop_maps() const;
 968 
 969   inline InstanceKlass* volatile* adr_implementor() const;
 970 
 971   // Use this to return the size of an instance in heap words:
 972   int size_helper() const {
 973     return layout_helper_to_size_helper(layout_helper());
 974   }
 975 









 976   // This bit is initialized in classFileParser.cpp.
 977   // It is false under any of the following conditions:
 978   //  - the class is abstract (including any interface)
 979   //  - the class size is larger than FastAllocateSizeLimit
 980   //  - the class is java/lang/Class, which cannot be allocated directly
 981   bool can_be_fastpath_allocated() const {
 982     return !layout_helper_needs_slow_path(layout_helper());
 983   }
 984 
 985   // Java itable
 986   klassItable itable() const;        // return klassItable wrapper
 987   Method* method_at_itable(InstanceKlass* holder, int index, TRAPS);
 988   Method* method_at_itable_or_null(InstanceKlass* holder, int index, bool& itable_entry_found);
 989   int vtable_index_of_interface_method(Method* method);
 990 
 991 #if INCLUDE_JVMTI
 992   void adjust_default_methods(bool* trace_name_printed);
 993 #endif // INCLUDE_JVMTI
 994 
 995   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

 891   // check whether this class or one of its superclasses was redefined
 892   bool has_redefined_this_or_super() const;
 893 #endif
 894 
 895   // Access to the implementor of an interface.
 896   InstanceKlass* implementor() const;
 897   void set_implementor(InstanceKlass* ik);
 898   int  nof_implementors() const;
 899   void add_implementor(InstanceKlass* ik);  // ik is a new class that implements this interface
 900   void init_implementor();           // initialize
 901 
 902  private:
 903   // link this class into the implementors list of every interface it implements
 904   void process_interfaces();
 905 
 906  public:
 907   // virtual operations from Klass
 908   GrowableArray<Klass*>* compute_secondary_supers(int num_extra_slots,
 909                                                   Array<InstanceKlass*>* transitive_interfaces) override;
 910   bool can_be_primary_super_slow() const override;
 911   size_t oop_size(oop obj, markWord mark) const override { return size_helper(); }
 912   // slow because it's a virtual call and used for verifying the layout_helper.
 913   // Using the layout_helper bits, we can call is_instance_klass without a virtual call.
 914   DEBUG_ONLY(bool is_instance_klass_slow() const override { return true; })
 915 
 916   // Iterators
 917   void do_local_static_fields(FieldClosure* cl);
 918   void do_nonstatic_fields(FieldClosure* cl); // including inherited fields
 919   void do_local_static_fields(void f(fieldDescriptor*, Handle, TRAPS), Handle, TRAPS);
 920   void print_nonstatic_fields(FieldClosure* cl); // including inherited and injected fields
 921 
 922   void methods_do(void f(Method* method));
 923 
 924   static InstanceKlass* cast(Klass* k) {
 925     return const_cast<InstanceKlass*>(cast(const_cast<const Klass*>(k)));
 926   }
 927 
 928   static const InstanceKlass* cast(const Klass* k) {
 929     assert(k != nullptr, "k should not be null");
 930     assert(k->is_instance_klass(), "cast to InstanceKlass");
 931     return static_cast<const InstanceKlass*>(k);

 958                                                     itable_length(),
 959                                                     nonstatic_oop_map_size(),
 960                                                     is_interface());
 961   }
 962 
 963 
 964   inline intptr_t* start_of_itable() const;
 965   inline intptr_t* end_of_itable() const;
 966   inline oop static_field_base_raw();
 967 
 968   inline OopMapBlock* start_of_nonstatic_oop_maps() const;
 969   inline Klass** end_of_nonstatic_oop_maps() const;
 970 
 971   inline InstanceKlass* volatile* adr_implementor() const;
 972 
 973   // Use this to return the size of an instance in heap words:
 974   int size_helper() const {
 975     return layout_helper_to_size_helper(layout_helper());
 976   }
 977 
 978   virtual int hash_offset_in_bytes(oop obj, markWord m) const override {
 979     assert(UseCompactObjectHeaders, "only with compact i-hash");
 980     return _hash_offset;
 981   }
 982   static int hash_offset_offset_in_bytes() {
 983     assert(UseCompactObjectHeaders, "only with compact i-hash");
 984     return (int)offset_of(InstanceKlass, _hash_offset);
 985   }
 986 
 987   // This bit is initialized in classFileParser.cpp.
 988   // It is false under any of the following conditions:
 989   //  - the class is abstract (including any interface)
 990   //  - the class size is larger than FastAllocateSizeLimit
 991   //  - the class is java/lang/Class, which cannot be allocated directly
 992   bool can_be_fastpath_allocated() const {
 993     return !layout_helper_needs_slow_path(layout_helper());
 994   }
 995 
 996   // Java itable
 997   klassItable itable() const;        // return klassItable wrapper
 998   Method* method_at_itable(InstanceKlass* holder, int index, TRAPS);
 999   Method* method_at_itable_or_null(InstanceKlass* holder, int index, bool& itable_entry_found);
1000   int vtable_index_of_interface_method(Method* method);
1001 
1002 #if INCLUDE_JVMTI
1003   void adjust_default_methods(bool* trace_name_printed);
1004 #endif // INCLUDE_JVMTI
1005 
1006   void clean_weak_instanceklass_links();
< prev index next >