src/share/vm/oops/instanceKlass.hpp

Print this page




 171   typeArrayOop    _method_ordering;
 172   // Interface (klassOops) this class declares locally to implement.
 173   objArrayOop     _local_interfaces;
 174   // Interface (klassOops) this class implements transitively.
 175   objArrayOop     _transitive_interfaces;
 176   // Instance and static variable information, 5-tuples of shorts [access, name
 177   // index, sig index, initval index, offset].
 178   typeArrayOop    _fields;
 179   // Constant pool for this class.
 180   constantPoolOop _constants;
 181   // Class loader used to load this class, NULL if VM loader used.
 182   oop             _class_loader;
 183   // Protection domain.
 184   oop             _protection_domain;
 185   // Host class, which grants its access privileges to this class also.
 186   // This is only non-null for an anonymous class (JSR 292 enabled).
 187   // The host class is either named, or a previously loaded anonymous class.
 188   klassOop        _host_klass;
 189   // Class signers.
 190   objArrayOop     _signers;
 191   // inner_classes attribute.










 192   typeArrayOop    _inner_classes;
 193   // Implementors of this interface (not valid if it overflows)
 194   klassOop        _implementors[implementors_limit];
 195   // Annotations for this class, or null if none.
 196   typeArrayOop    _class_annotations;
 197   // Annotation objects (byte arrays) for fields, or null if no annotations.
 198   // Indices correspond to entries (not indices) in fields array.
 199   objArrayOop     _fields_annotations;
 200   // Annotation objects (byte arrays) for methods, or null if no annotations.
 201   // Index is the idnum, which is initially the same as the methods array index.
 202   objArrayOop     _methods_annotations;
 203   // Annotation objects (byte arrays) for methods' parameters, or null if no
 204   // such annotations.
 205   // Index is the idnum, which is initially the same as the methods array index.
 206   objArrayOop     _methods_parameter_annotations;
 207   // Annotation objects (byte arrays) for methods' default values, or null if no
 208   // such annotations.
 209   // Index is the idnum, which is initially the same as the methods array index.
 210   objArrayOop     _methods_default_annotations;
 211 


 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;


 334   typeArrayOop fields() const              { return _fields; }
 335 
 336   void set_fields(typeArrayOop f, u2 java_fields_count) {
 337     oop_store_without_check((oop*) &_fields, (oop) f);
 338     _java_fields_count = java_fields_count;
 339   }
 340 
 341   // inner classes
 342   typeArrayOop inner_classes() const       { return _inner_classes; }
 343   void set_inner_classes(typeArrayOop f)   { oop_store_without_check((oop*) &_inner_classes, (oop) f); }
 344 
 345   enum InnerClassAttributeOffset {
 346     // From http://mirror.eng/products/jdk/1.1/docs/guide/innerclasses/spec/innerclasses.doc10.html#18814
 347     inner_class_inner_class_info_offset = 0,
 348     inner_class_outer_class_info_offset = 1,
 349     inner_class_inner_name_offset = 2,
 350     inner_class_access_flags_offset = 3,
 351     inner_class_next_offset = 4
 352   };
 353 






 354   // method override check
 355   bool is_override(methodHandle super_method, Handle targetclassloader, Symbol* targetclassname, TRAPS);
 356 
 357   // package
 358   bool is_same_class_package(klassOop class2);
 359   bool is_same_class_package(oop classloader2, Symbol* classname2);
 360   static bool is_same_class_package(oop class_loader1, Symbol* class_name1, oop class_loader2, Symbol* class_name2);
 361 
 362   // find an enclosing class (defined where original code was, in jvm.cpp!)
 363   klassOop compute_enclosing_class(bool* inner_is_member, TRAPS) {
 364     instanceKlassHandle self(THREAD, this->as_klassOop());
 365     return compute_enclosing_class_impl(self, inner_is_member, THREAD);
 366   }
 367   static klassOop compute_enclosing_class_impl(instanceKlassHandle self,
 368                                                bool* inner_is_member, TRAPS);
 369 
 370   // tell if two classes have the same enclosing class (at package level)
 371   bool is_same_package_member(klassOop class2, TRAPS) {
 372     instanceKlassHandle self(THREAD, this->as_klassOop());
 373     return is_same_package_member_impl(self, class2, THREAD);


 516                                                         _cached_class_file_bytes = class_file_bytes; }
 517   jint get_cached_class_file_len()                    { return _cached_class_file_len; }
 518   unsigned char * get_cached_class_file_bytes()       { return _cached_class_file_bytes; }
 519 
 520   // JVMTI: Support for caching of field indices, types, and offsets
 521   void set_jvmti_cached_class_field_map(JvmtiCachedClassFieldMap* descriptor) {
 522     _jvmti_cached_class_field_map = descriptor;
 523   }
 524   JvmtiCachedClassFieldMap* jvmti_cached_class_field_map() const {
 525     return _jvmti_cached_class_field_map;
 526   }
 527 
 528   // for adding methods, constMethodOopDesc::UNSET_IDNUM means no more ids available
 529   inline u2 next_method_idnum();
 530   void set_initial_method_idnum(u2 value)             { _idnum_allocated_count = value; }
 531 
 532   // generics support
 533   Symbol* generic_signature() const                   { return _generic_signature; }
 534   void set_generic_signature(Symbol* sig)             { _generic_signature = sig; }
 535 
 536   u2 enclosing_method_class_index() const             { return _enclosing_method_class_index; }
 537   u2 enclosing_method_method_index() const            { return _enclosing_method_method_index; }





 538   void set_enclosing_method_indices(u2 class_index,
 539                                     u2 method_index)  { _enclosing_method_class_index  = class_index;
 540                                                         _enclosing_method_method_index = method_index; }
 541 
 542   // jmethodID support
 543   static jmethodID get_jmethod_id(instanceKlassHandle ik_h,
 544                      methodHandle method_h);
 545   static jmethodID get_jmethod_id_fetch_or_update(instanceKlassHandle ik_h,
 546                      size_t idnum, jmethodID new_id, jmethodID* new_jmeths,
 547                      jmethodID* to_dealloc_id_p,
 548                      jmethodID** to_dealloc_jmeths_p);
 549   static void get_jmethod_id_length_value(jmethodID* cache, size_t idnum,
 550                 size_t *length_p, jmethodID* id_p);
 551   jmethodID jmethod_id_or_null(methodOop method);
 552 
 553   // cached itable index support
 554   void set_cached_itable_index(size_t idnum, int index);
 555   int cached_itable_index(size_t idnum);
 556 
 557   // annotations support
 558   typeArrayOop class_annotations() const              { return _class_annotations; }
 559   objArrayOop fields_annotations() const              { return _fields_annotations; }
 560   objArrayOop methods_annotations() const             { return _methods_annotations; }




 171   typeArrayOop    _method_ordering;
 172   // Interface (klassOops) this class declares locally to implement.
 173   objArrayOop     _local_interfaces;
 174   // Interface (klassOops) this class implements transitively.
 175   objArrayOop     _transitive_interfaces;
 176   // Instance and static variable information, 5-tuples of shorts [access, name
 177   // index, sig index, initval index, offset].
 178   typeArrayOop    _fields;
 179   // Constant pool for this class.
 180   constantPoolOop _constants;
 181   // Class loader used to load this class, NULL if VM loader used.
 182   oop             _class_loader;
 183   // Protection domain.
 184   oop             _protection_domain;
 185   // Host class, which grants its access privileges to this class also.
 186   // This is only non-null for an anonymous class (JSR 292 enabled).
 187   // The host class is either named, or a previously loaded anonymous class.
 188   klassOop        _host_klass;
 189   // Class signers.
 190   objArrayOop     _signers;
 191   // The InnerClasses attribute and EnclosingMethod attribute. The 
 192   // _inner_classes is an array of shorts. If the class has InnerClasses 
 193   // attribute, then the _inner_classes array begins with 4-tuples of shorts
 194   // [inner_class_info_index, outer_class_info_index,
 195   // inner_name_index, inner_class_access_flags] for the InnerClasses
 196   // attribute. If the EnclosingMethod attribute exists, it occupies the
 197   // last two shorts [class_index, method_index] of the array. If only
 198   // the InnerClasses attribute exists, the _inner_classes array length is
 199   // number_of_inner_classes * 4. If the class has both InnerClasses 
 200   // and EnclosingMethod attributes the _inner_classes array length is 
 201   // number_of_inner_classes * 4 + enclosing_method_attribute_size.
 202   typeArrayOop    _inner_classes;
 203   // Implementors of this interface (not valid if it overflows)
 204   klassOop        _implementors[implementors_limit];
 205   // Annotations for this class, or null if none.
 206   typeArrayOop    _class_annotations;
 207   // Annotation objects (byte arrays) for fields, or null if no annotations.
 208   // Indices correspond to entries (not indices) in fields array.
 209   objArrayOop     _fields_annotations;
 210   // Annotation objects (byte arrays) for methods, or null if no annotations.
 211   // Index is the idnum, which is initially the same as the methods array index.
 212   objArrayOop     _methods_annotations;
 213   // Annotation objects (byte arrays) for methods' parameters, or null if no
 214   // such annotations.
 215   // Index is the idnum, which is initially the same as the methods array index.
 216   objArrayOop     _methods_parameter_annotations;
 217   // Annotation objects (byte arrays) for methods' default values, or null if no
 218   // such annotations.
 219   // Index is the idnum, which is initially the same as the methods array index.
 220   objArrayOop     _methods_default_annotations;
 221 


 244   bool            _is_marked_dependent;  // used for marking during flushing and deoptimization
 245   bool            _rewritten;            // methods rewritten.
 246   bool            _has_nonstatic_fields; // for sizing with UseCompressedOops
 247   bool            _should_verify_class;  // allow caching of preverification
 248   u2              _minor_version;        // minor version number of class file
 249   u2              _major_version;        // major version number of class file
 250   Thread*         _init_thread;          // Pointer to current thread doing initialization (to handle recusive initialization)
 251   int             _vtable_len;           // length of Java vtable (in words)
 252   int             _itable_len;           // length of Java itable (in words)
 253   OopMapCache*    volatile _oop_map_cache;   // OopMapCache for all methods in the klass (allocated lazily)
 254   JNIid*          _jni_ids;              // First JNI identifier for static fields in this class
 255   jmethodID*      _methods_jmethod_ids;  // jmethodIDs corresponding to method_idnum, or NULL if none
 256   int*            _methods_cached_itable_indices;  // itable_index cache for JNI invoke corresponding to methods idnum, or NULL
 257   nmethodBucket*  _dependencies;         // list of dependent nmethods
 258   nmethod*        _osr_nmethods_head;    // Head of list of on-stack replacement nmethods for this class
 259   BreakpointInfo* _breakpoints;          // bpt lists, managed by methodOop
 260   int             _nof_implementors;     // No of implementors of this interface (zero if not an interface)
 261   // Array of interesting part(s) of the previous version(s) of this
 262   // instanceKlass. See PreviousVersionWalker below.
 263   GrowableArray<PreviousVersionNode *>* _previous_versions;


 264   // JVMTI fields can be moved to their own structure - see 6315920
 265   unsigned char * _cached_class_file_bytes;       // JVMTI: cached class file, before retransformable agent modified it in CFLH
 266   jint            _cached_class_file_len;         // JVMTI: length of above
 267   JvmtiCachedClassFieldMap* _jvmti_cached_class_field_map;  // JVMTI: used during heap iteration
 268   volatile u2     _idnum_allocated_count;         // JNI/JVMTI: increments with the addition of methods, old ids don't change
 269 
 270   // Class states are defined as ClassState (see above).
 271   // Place the _init_state here to utilize the unused 2-byte after
 272   // _idnum_allocated_count.
 273   u1              _init_state;                    // state of class
 274 
 275   u1              _reference_type;                // reference type
 276 
 277   // embedded Java vtable follows here
 278   // embedded Java itables follows here
 279   // embedded static fields follows here
 280   // embedded nonstatic oop-map blocks follows here
 281 
 282   friend class instanceKlassKlass;
 283   friend class SystemDictionary;


 342   typeArrayOop fields() const              { return _fields; }
 343 
 344   void set_fields(typeArrayOop f, u2 java_fields_count) {
 345     oop_store_without_check((oop*) &_fields, (oop) f);
 346     _java_fields_count = java_fields_count;
 347   }
 348 
 349   // inner classes
 350   typeArrayOop inner_classes() const       { return _inner_classes; }
 351   void set_inner_classes(typeArrayOop f)   { oop_store_without_check((oop*) &_inner_classes, (oop) f); }
 352 
 353   enum InnerClassAttributeOffset {
 354     // From http://mirror.eng/products/jdk/1.1/docs/guide/innerclasses/spec/innerclasses.doc10.html#18814
 355     inner_class_inner_class_info_offset = 0,
 356     inner_class_outer_class_info_offset = 1,
 357     inner_class_inner_name_offset = 2,
 358     inner_class_access_flags_offset = 3,
 359     inner_class_next_offset = 4
 360   };
 361 
 362   enum EnclosingMethodAttributeOffset {
 363     enclosing_method_class_index_offset = 0,
 364     enclosing_method_method_index_offset = 1,
 365     enclosing_method_attribute_size = 2
 366   };
 367 
 368   // method override check
 369   bool is_override(methodHandle super_method, Handle targetclassloader, Symbol* targetclassname, TRAPS);
 370 
 371   // package
 372   bool is_same_class_package(klassOop class2);
 373   bool is_same_class_package(oop classloader2, Symbol* classname2);
 374   static bool is_same_class_package(oop class_loader1, Symbol* class_name1, oop class_loader2, Symbol* class_name2);
 375 
 376   // find an enclosing class (defined where original code was, in jvm.cpp!)
 377   klassOop compute_enclosing_class(bool* inner_is_member, TRAPS) {
 378     instanceKlassHandle self(THREAD, this->as_klassOop());
 379     return compute_enclosing_class_impl(self, inner_is_member, THREAD);
 380   }
 381   static klassOop compute_enclosing_class_impl(instanceKlassHandle self,
 382                                                bool* inner_is_member, TRAPS);
 383 
 384   // tell if two classes have the same enclosing class (at package level)
 385   bool is_same_package_member(klassOop class2, TRAPS) {
 386     instanceKlassHandle self(THREAD, this->as_klassOop());
 387     return is_same_package_member_impl(self, class2, THREAD);


 530                                                         _cached_class_file_bytes = class_file_bytes; }
 531   jint get_cached_class_file_len()                    { return _cached_class_file_len; }
 532   unsigned char * get_cached_class_file_bytes()       { return _cached_class_file_bytes; }
 533 
 534   // JVMTI: Support for caching of field indices, types, and offsets
 535   void set_jvmti_cached_class_field_map(JvmtiCachedClassFieldMap* descriptor) {
 536     _jvmti_cached_class_field_map = descriptor;
 537   }
 538   JvmtiCachedClassFieldMap* jvmti_cached_class_field_map() const {
 539     return _jvmti_cached_class_field_map;
 540   }
 541 
 542   // for adding methods, constMethodOopDesc::UNSET_IDNUM means no more ids available
 543   inline u2 next_method_idnum();
 544   void set_initial_method_idnum(u2 value)             { _idnum_allocated_count = value; }
 545 
 546   // generics support
 547   Symbol* generic_signature() const                   { return _generic_signature; }
 548   void set_generic_signature(Symbol* sig)             { _generic_signature = sig; }
 549 
 550   u2 enclosing_method_data(int offset);
 551   u2 enclosing_method_class_index() {
 552     return enclosing_method_data(enclosing_method_class_index_offset);
 553   }
 554   u2 enclosing_method_method_index() {
 555     return enclosing_method_data(enclosing_method_method_index_offset);
 556   }
 557   void set_enclosing_method_indices(u2 class_index,
 558                                     u2 method_index);

 559 
 560   // jmethodID support
 561   static jmethodID get_jmethod_id(instanceKlassHandle ik_h,
 562                      methodHandle method_h);
 563   static jmethodID get_jmethod_id_fetch_or_update(instanceKlassHandle ik_h,
 564                      size_t idnum, jmethodID new_id, jmethodID* new_jmeths,
 565                      jmethodID* to_dealloc_id_p,
 566                      jmethodID** to_dealloc_jmeths_p);
 567   static void get_jmethod_id_length_value(jmethodID* cache, size_t idnum,
 568                 size_t *length_p, jmethodID* id_p);
 569   jmethodID jmethod_id_or_null(methodOop method);
 570 
 571   // cached itable index support
 572   void set_cached_itable_index(size_t idnum, int index);
 573   int cached_itable_index(size_t idnum);
 574 
 575   // annotations support
 576   typeArrayOop class_annotations() const              { return _class_annotations; }
 577   objArrayOop fields_annotations() const              { return _fields_annotations; }
 578   objArrayOop methods_annotations() const             { return _methods_annotations; }