src/share/vm/oops/instanceKlass.hpp

Print this page




 223   // if this class is unloaded.
 224   Symbol*         _array_name;
 225 
 226   // Number of heapOopSize words used by non-static fields in this klass
 227   // (including inherited fields but after header_size()).
 228   int             _nonstatic_field_size;
 229   int             _static_field_size;    // number words used by static fields (oop and non-oop) in this klass
 230   u2              _static_oop_field_count;// number of static oop fields in this klass
 231   u2              _java_fields_count;    // The number of declared Java fields
 232   int             _nonstatic_oop_map_size;// size in words of nonstatic oop map blocks
 233 
 234   bool            _is_marked_dependent;  // used for marking during flushing and deoptimization
 235   bool            _rewritten;            // methods rewritten.
 236   bool            _has_nonstatic_fields; // for sizing with UseCompressedOops
 237   bool            _should_verify_class;  // allow caching of preverification
 238   u2              _minor_version;        // minor version number of class file
 239   u2              _major_version;        // major version number of class file
 240   Thread*         _init_thread;          // Pointer to current thread doing initialization (to handle recusive initialization)
 241   int             _vtable_len;           // length of Java vtable (in words)
 242   int             _itable_len;           // length of Java itable (in words)
 243   ReferenceType   _reference_type;       // reference type
 244   OopMapCache*    volatile _oop_map_cache;   // OopMapCache for all methods in the klass (allocated lazily)
 245   JNIid*          _jni_ids;              // First JNI identifier for static fields in this class
 246   jmethodID*      _methods_jmethod_ids;  // jmethodIDs corresponding to method_idnum, or NULL if none
 247   int*            _methods_cached_itable_indices;  // itable_index cache for JNI invoke corresponding to methods idnum, or NULL
 248   nmethodBucket*  _dependencies;         // list of dependent nmethods
 249   nmethod*        _osr_nmethods_head;    // Head of list of on-stack replacement nmethods for this class
 250   BreakpointInfo* _breakpoints;          // bpt lists, managed by methodOop
 251   int             _nof_implementors;     // No of implementors of this interface (zero if not an interface)
 252   // Array of interesting part(s) of the previous version(s) of this
 253   // instanceKlass. See PreviousVersionWalker below.
 254   GrowableArray<PreviousVersionNode *>* _previous_versions;
 255   u2              _enclosing_method_class_index;  // Constant pool index for class of enclosing method, or 0 if none
 256   u2              _enclosing_method_method_index; // Constant pool index for name and type of enclosing method, or 0 if none
 257   // JVMTI fields can be moved to their own structure - see 6315920
 258   unsigned char * _cached_class_file_bytes;       // JVMTI: cached class file, before retransformable agent modified it in CFLH
 259   jint            _cached_class_file_len;         // JVMTI: length of above
 260   JvmtiCachedClassFieldMap* _jvmti_cached_class_field_map;  // JVMTI: used during heap iteration
 261   volatile u2     _idnum_allocated_count;         // JNI/JVMTI: increments with the addition of methods, old ids don't change
 262 
 263   // Class states are defined as ClassState (see above).
 264   // Place the _init_state here to utilize the unused 2-byte after
 265   // _idnum_allocated_count.
 266   u1              _init_state;                    // state of class
 267 


 268   // embedded Java vtable follows here
 269   // embedded Java itables follows here
 270   // embedded static fields follows here
 271   // embedded nonstatic oop-map blocks follows here
 272 
 273   friend class instanceKlassKlass;
 274   friend class SystemDictionary;
 275 
 276  public:
 277   bool has_nonstatic_fields() const        { return _has_nonstatic_fields; }
 278   void set_has_nonstatic_fields(bool b)    { _has_nonstatic_fields = b; }
 279 
 280   // field sizes
 281   int nonstatic_field_size() const         { return _nonstatic_field_size; }
 282   void set_nonstatic_field_size(int size)  { _nonstatic_field_size = size; }
 283 
 284   int static_field_size() const            { return _static_field_size; }
 285   void set_static_field_size(int size)     { _static_field_size = size; }
 286 
 287   int static_oop_field_count() const       { return (int)_static_oop_field_count; }


 390   void set_should_verify_class(bool value) { _should_verify_class = value; }
 391 
 392   // marking
 393   bool is_marked_dependent() const         { return _is_marked_dependent; }
 394   void set_is_marked_dependent(bool value) { _is_marked_dependent = value; }
 395 
 396   // initialization (virtuals from Klass)
 397   bool should_be_initialized() const;  // means that initialize should be called
 398   void initialize(TRAPS);
 399   void link_class(TRAPS);
 400   bool link_class_or_fail(TRAPS); // returns false on failure
 401   void unlink_class();
 402   void rewrite_class(TRAPS);
 403   void relocate_and_link_methods(TRAPS);
 404   methodOop class_initializer();
 405 
 406   // set the class to initialized if no static initializer is present
 407   void eager_initialize(Thread *thread);
 408 
 409   // reference type
 410   ReferenceType reference_type() const     { return _reference_type; }
 411   void set_reference_type(ReferenceType t) { _reference_type = t; }
 412 
 413   static ByteSize reference_type_offset() { return in_ByteSize(sizeof(klassOopDesc) + offset_of(instanceKlass, _reference_type)); }
 414 
 415   // find local field, returns true if found
 416   bool find_local_field(Symbol* name, Symbol* sig, fieldDescriptor* fd) const;
 417   // find field in direct superinterfaces, returns the interface in which the field is defined
 418   klassOop find_interface_field(Symbol* name, Symbol* sig, fieldDescriptor* fd) const;
 419   // find field according to JVM spec 5.4.3.2, returns the klass in which the field is defined
 420   klassOop find_field(Symbol* name, Symbol* sig, fieldDescriptor* fd) const;
 421   // find instance or static fields according to JVM spec 5.4.3.2, returns the klass in which the field is defined
 422   klassOop find_field(Symbol* name, Symbol* sig, bool is_static, fieldDescriptor* fd) const;
 423 
 424   // find a non-static or static field given its offset within the class.
 425   bool contains_field_offset(int offset) {
 426     return instanceOopDesc::contains_field_offset(offset, nonstatic_field_size());
 427   }
 428 
 429   bool find_local_field_from_offset(int offset, bool is_static, fieldDescriptor* fd) const;
 430   bool find_field_from_offset(int offset, bool is_static, fieldDescriptor* fd) const;
 431 




 223   // if this class is unloaded.
 224   Symbol*         _array_name;
 225 
 226   // Number of heapOopSize words used by non-static fields in this klass
 227   // (including inherited fields but after header_size()).
 228   int             _nonstatic_field_size;
 229   int             _static_field_size;    // number words used by static fields (oop and non-oop) in this klass
 230   u2              _static_oop_field_count;// number of static oop fields in this klass
 231   u2              _java_fields_count;    // The number of declared Java fields
 232   int             _nonstatic_oop_map_size;// size in words of nonstatic oop map blocks
 233 
 234   bool            _is_marked_dependent;  // used for marking during flushing and deoptimization
 235   bool            _rewritten;            // methods rewritten.
 236   bool            _has_nonstatic_fields; // for sizing with UseCompressedOops
 237   bool            _should_verify_class;  // allow caching of preverification
 238   u2              _minor_version;        // minor version number of class file
 239   u2              _major_version;        // major version number of class file
 240   Thread*         _init_thread;          // Pointer to current thread doing initialization (to handle recusive initialization)
 241   int             _vtable_len;           // length of Java vtable (in words)
 242   int             _itable_len;           // length of Java itable (in words)

 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*      _methods_jmethod_ids;  // jmethodIDs corresponding to method_idnum, or NULL if none
 246   int*            _methods_cached_itable_indices;  // itable_index cache for JNI invoke corresponding to methods idnum, or NULL
 247   nmethodBucket*  _dependencies;         // list of dependent nmethods
 248   nmethod*        _osr_nmethods_head;    // Head of list of on-stack replacement nmethods for this class
 249   BreakpointInfo* _breakpoints;          // bpt lists, managed by methodOop
 250   int             _nof_implementors;     // No of implementors of this interface (zero if not an interface)
 251   // Array of interesting part(s) of the previous version(s) of this
 252   // instanceKlass. See PreviousVersionWalker below.
 253   GrowableArray<PreviousVersionNode *>* _previous_versions;
 254   u2              _enclosing_method_class_index;  // Constant pool index for class of enclosing method, or 0 if none
 255   u2              _enclosing_method_method_index; // Constant pool index for name and type of enclosing method, or 0 if none
 256   // JVMTI fields can be moved to their own structure - see 6315920
 257   unsigned char * _cached_class_file_bytes;       // JVMTI: cached class file, before retransformable agent modified it in CFLH
 258   jint            _cached_class_file_len;         // JVMTI: length of above
 259   JvmtiCachedClassFieldMap* _jvmti_cached_class_field_map;  // JVMTI: used during heap iteration
 260   volatile u2     _idnum_allocated_count;         // JNI/JVMTI: increments with the addition of methods, old ids don't change
 261 
 262   // Class states are defined as ClassState (see above).
 263   // Place the _init_state here to utilize the unused 2-byte after
 264   // _idnum_allocated_count.
 265   u1              _init_state;                    // state of class
 266 
 267   u1              _reference_type;                // reference type
 268 
 269   // embedded Java vtable follows here
 270   // embedded Java itables follows here
 271   // embedded static fields follows here
 272   // embedded nonstatic oop-map blocks follows here
 273 
 274   friend class instanceKlassKlass;
 275   friend class SystemDictionary;
 276 
 277  public:
 278   bool has_nonstatic_fields() const        { return _has_nonstatic_fields; }
 279   void set_has_nonstatic_fields(bool b)    { _has_nonstatic_fields = b; }
 280 
 281   // field sizes
 282   int nonstatic_field_size() const         { return _nonstatic_field_size; }
 283   void set_nonstatic_field_size(int size)  { _nonstatic_field_size = size; }
 284 
 285   int static_field_size() const            { return _static_field_size; }
 286   void set_static_field_size(int size)     { _static_field_size = size; }
 287 
 288   int static_oop_field_count() const       { return (int)_static_oop_field_count; }


 391   void set_should_verify_class(bool value) { _should_verify_class = value; }
 392 
 393   // marking
 394   bool is_marked_dependent() const         { return _is_marked_dependent; }
 395   void set_is_marked_dependent(bool value) { _is_marked_dependent = value; }
 396 
 397   // initialization (virtuals from Klass)
 398   bool should_be_initialized() const;  // means that initialize should be called
 399   void initialize(TRAPS);
 400   void link_class(TRAPS);
 401   bool link_class_or_fail(TRAPS); // returns false on failure
 402   void unlink_class();
 403   void rewrite_class(TRAPS);
 404   void relocate_and_link_methods(TRAPS);
 405   methodOop class_initializer();
 406 
 407   // set the class to initialized if no static initializer is present
 408   void eager_initialize(Thread *thread);
 409 
 410   // reference type
 411   ReferenceType reference_type() const     { return (ReferenceType)_reference_type; }
 412   void set_reference_type(ReferenceType t) { _reference_type = (u1)t; }
 413 
 414   static ByteSize reference_type_offset() { return in_ByteSize(sizeof(klassOopDesc) + offset_of(instanceKlass, _reference_type)); }
 415 
 416   // find local field, returns true if found
 417   bool find_local_field(Symbol* name, Symbol* sig, fieldDescriptor* fd) const;
 418   // find field in direct superinterfaces, returns the interface in which the field is defined
 419   klassOop find_interface_field(Symbol* name, Symbol* sig, fieldDescriptor* fd) const;
 420   // find field according to JVM spec 5.4.3.2, returns the klass in which the field is defined
 421   klassOop find_field(Symbol* name, Symbol* sig, fieldDescriptor* fd) const;
 422   // find instance or static fields according to JVM spec 5.4.3.2, returns the klass in which the field is defined
 423   klassOop find_field(Symbol* name, Symbol* sig, bool is_static, fieldDescriptor* fd) const;
 424 
 425   // find a non-static or static field given its offset within the class.
 426   bool contains_field_offset(int offset) {
 427     return instanceOopDesc::contains_field_offset(offset, nonstatic_field_size());
 428   }
 429 
 430   bool find_local_field_from_offset(int offset, bool is_static, fieldDescriptor* fd) const;
 431   bool find_field_from_offset(int offset, bool is_static, fieldDescriptor* fd) const;
 432