src/share/vm/oops/instanceKlass.hpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File hotspot Sdiff src/share/vm/oops

src/share/vm/oops/instanceKlass.hpp

Print this page




  87  public:
  88   // Byte offset of the first oop mapped by this block.
  89   int offset() const          { return _offset; }
  90   void set_offset(int offset) { _offset = offset; }
  91 
  92   // Number of oops in this block.
  93   uint count() const         { return _count; }
  94   void set_count(uint count) { _count = count; }
  95 
  96   // sizeof(OopMapBlock) in HeapWords.
  97   static const int size_in_words() {
  98     return align_size_up(int(sizeof(OopMapBlock)), HeapWordSize) >>
  99       LogHeapWordSize;
 100   }
 101 
 102  private:
 103   int  _offset;
 104   uint _count;
 105 };
 106 


























































 107 struct JvmtiCachedClassFileData;
 108 
 109 class InstanceKlass: public Klass {
 110   friend class VMStructs;
 111   friend class ClassFileParser;
 112   friend class CompileReplay;
 113 
 114  protected:
 115   // Constructor
 116   InstanceKlass(int vtable_len,
 117                 int itable_len,
 118                 int static_field_size,
 119                 int nonstatic_oop_map_size,
 120                 unsigned kind,
 121                 ReferenceType rt,
 122                 AccessFlags access_flags,
 123                 bool is_anonymous);
 124  public:
 125   static InstanceKlass* allocate_instance_klass(
 126                                           ClassLoaderData* loader_data,


 181   // if this class is unloaded.
 182   Symbol*         _array_name;
 183 
 184   // Number of heapOopSize words used by non-static fields in this klass
 185   // (including inherited fields but after header_size()).
 186   int             _nonstatic_field_size;
 187   int             _static_field_size;    // number words used by static fields (oop and non-oop) in this klass
 188   // Constant pool index to the utf8 entry of the Generic signature,
 189   // or 0 if none.
 190   u2              _generic_signature_index;
 191   // Constant pool index to the utf8 entry for the name of source file
 192   // containing this klass, 0 if not specified.
 193   u2              _source_file_name_index;
 194   u2              _static_oop_field_count;// number of static oop fields in this klass
 195   u2              _java_fields_count;    // The number of declared Java fields
 196   int             _nonstatic_oop_map_size;// size in words of nonstatic oop map blocks
 197 
 198   // _is_marked_dependent can be set concurrently, thus cannot be part of the
 199   // _misc_flags.
 200   bool            _is_marked_dependent;  // used for marking during flushing and deoptimization
 201   bool            _has_unloaded_dependent;
 202 
 203   // The low two bits of _misc_flags contains the kind field.
 204   // This can be used to quickly discriminate among the four kinds of
 205   // InstanceKlass.
 206 
 207   static const unsigned _misc_kind_field_size = 2;
 208   static const unsigned _misc_kind_field_pos  = 0;
 209   static const unsigned _misc_kind_field_mask = (1u << _misc_kind_field_size) - 1u;
 210 
 211   static const unsigned _misc_kind_other        = 0; // concrete InstanceKlass
 212   static const unsigned _misc_kind_reference    = 1; // InstanceRefKlass
 213   static const unsigned _misc_kind_class_loader = 2; // InstanceClassLoaderKlass
 214   static const unsigned _misc_kind_mirror       = 3; // InstanceMirrorKlass
 215 
 216   // Start after _misc_kind field.
 217   enum {
 218     _misc_rewritten                = 1 << 2, // methods rewritten.
 219     _misc_has_nonstatic_fields     = 1 << 3, // for sizing with UseCompressedOops
 220     _misc_should_verify_class      = 1 << 4, // allow caching of preverification
 221     _misc_is_anonymous             = 1 << 5, // has embedded _host_klass field
 222     _misc_is_contended             = 1 << 6, // marked with contended annotation
 223     _misc_has_default_methods      = 1 << 7, // class/superclass/implemented interfaces has default methods
 224     _misc_declares_default_methods = 1 << 8, // directly declares default methods (any access)
 225     _misc_has_been_redefined       = 1 << 9, // class has been redefined
 226     _misc_is_scratch_class         = 1 << 10 // class is the redefined scratch class
 227   };
 228   u2              _misc_flags;
 229   u2              _minor_version;        // minor version number of class file
 230   u2              _major_version;        // major version number of class file
 231   Thread*         _init_thread;          // Pointer to current thread doing initialization (to handle recusive initialization)
 232   int             _vtable_len;           // length of Java vtable (in words)
 233   int             _itable_len;           // length of Java itable (in words)
 234   OopMapCache*    volatile _oop_map_cache;   // OopMapCache for all methods in the klass (allocated lazily)
 235   MemberNameTable* _member_names;        // Member names
 236   JNIid*          _jni_ids;              // First JNI identifier for static fields in this class
 237   jmethodID*      _methods_jmethod_ids;  // jmethodIDs corresponding to method_idnum, or NULL if none
 238   nmethodBucket*  _dependencies;         // list of dependent nmethods
 239   nmethod*        _osr_nmethods_head;    // Head of list of on-stack replacement nmethods for this class
 240   BreakpointInfo* _breakpoints;          // bpt lists, managed by Method*
 241   // Linked instanceKlasses of previous versions
 242   InstanceKlass* _previous_versions;
 243   // JVMTI fields can be moved to their own structure - see 6315920
 244   // JVMTI: cached class file, before retransformable agent modified it in CFLH
 245   JvmtiCachedClassFileData* _cached_class_file;
 246 
 247   volatile u2     _idnum_allocated_count;         // JNI/JVMTI: increments with the addition of methods, old ids don't change
 248 
 249   // Class states are defined as ClassState (see above).
 250   // Place the _init_state here to utilize the unused 2-byte after
 251   // _idnum_allocated_count.
 252   u1              _init_state;                    // state of class
 253   u1              _reference_type;                // reference type
 254 
 255   JvmtiCachedClassFieldMap* _jvmti_cached_class_field_map;  // JVMTI: used during heap iteration
 256 
 257   NOT_PRODUCT(int _verify_count;)  // to avoid redundant verifies
 258 


 451   bool is_reentrant_initialization(Thread *thread)  { return thread == _init_thread; }
 452   ClassState  init_state()                 { return (ClassState)_init_state; }
 453   bool is_rewritten() const                { return (_misc_flags & _misc_rewritten) != 0; }
 454 
 455   // defineClass specified verification
 456   bool should_verify_class() const         {
 457     return (_misc_flags & _misc_should_verify_class) != 0;
 458   }
 459   void set_should_verify_class(bool value) {
 460     if (value) {
 461       _misc_flags |= _misc_should_verify_class;
 462     } else {
 463       _misc_flags &= ~_misc_should_verify_class;
 464     }
 465   }
 466 
 467   // marking
 468   bool is_marked_dependent() const         { return _is_marked_dependent; }
 469   void set_is_marked_dependent(bool value) { _is_marked_dependent = value; }
 470 
 471   bool has_unloaded_dependent() const         { return _has_unloaded_dependent; }
 472   void set_has_unloaded_dependent(bool value) { _has_unloaded_dependent = value; }
 473 
 474   // initialization (virtuals from Klass)
 475   bool should_be_initialized() const;  // means that initialize should be called
 476   void initialize(TRAPS);
 477   void link_class(TRAPS);
 478   bool link_class_or_fail(TRAPS); // returns false on failure
 479   void unlink_class();
 480   void rewrite_class(TRAPS);
 481   void link_methods(TRAPS);
 482   Method* class_initializer();
 483 
 484   // set the class to initialized if no static initializer is present
 485   void eager_initialize(Thread *thread);
 486 
 487   // reference type
 488   ReferenceType reference_type() const     { return (ReferenceType)_reference_type; }
 489   void set_reference_type(ReferenceType t) {
 490     assert(t == (u1)t, "overflow");
 491     _reference_type = (u1)t;
 492   }
 493 


 821   virtual void check_valid_for_instantiation(bool throwError, TRAPS);
 822 
 823   // initialization
 824   void call_class_initializer(TRAPS);
 825   void set_initialization_state_and_notify(ClassState state, TRAPS);
 826 
 827   // OopMapCache support
 828   OopMapCache* oop_map_cache()               { return _oop_map_cache; }
 829   void set_oop_map_cache(OopMapCache *cache) { _oop_map_cache = cache; }
 830   void mask_for(methodHandle method, int bci, InterpreterOopMap* entry);
 831 
 832   // JNI identifier support (for static fields - for jni performance)
 833   JNIid* jni_ids()                               { return _jni_ids; }
 834   void set_jni_ids(JNIid* ids)                   { _jni_ids = ids; }
 835   JNIid* jni_id_for(int offset);
 836 
 837   // maintenance of deoptimization dependencies
 838   int mark_dependent_nmethods(DepChange& changes);
 839   void add_dependent_nmethod(nmethod* nm);
 840   void remove_dependent_nmethod(nmethod* nm, bool delete_immediately);

 841 
 842   // On-stack replacement support
 843   nmethod* osr_nmethods_head() const         { return _osr_nmethods_head; };
 844   void set_osr_nmethods_head(nmethod* h)     { _osr_nmethods_head = h; };
 845   void add_osr_nmethod(nmethod* n);
 846   void remove_osr_nmethod(nmethod* n);
 847   int mark_osr_nmethods(const Method* m);
 848   nmethod* lookup_osr_nmethod(const Method* m, int bci, int level, bool match_level) const;
 849 
 850   // Breakpoint support (see methods on Method* for details)
 851   BreakpointInfo* breakpoints() const       { return _breakpoints; };
 852   void set_breakpoints(BreakpointInfo* bps) { _breakpoints = bps; };
 853 
 854   // support for stub routines
 855   static ByteSize init_state_offset()  { return in_ByteSize(offset_of(InstanceKlass, _init_state)); }
 856   TRACE_DEFINE_OFFSET;
 857   static ByteSize init_thread_offset() { return in_ByteSize(offset_of(InstanceKlass, _init_thread)); }
 858 
 859   // subclass/subinterface checks
 860   bool implements_interface(Klass* k) const;


1007   //  - the class has a finalizer (if !RegisterFinalizersAtInit)
1008   //  - the class size is larger than FastAllocateSizeLimit
1009   //  - the class is java/lang/Class, which cannot be allocated directly
1010   bool can_be_fastpath_allocated() const {
1011     return !layout_helper_needs_slow_path(layout_helper());
1012   }
1013 
1014   // Java vtable/itable
1015   klassVtable* vtable() const;        // return new klassVtable wrapper
1016   inline Method* method_at_vtable(int index);
1017   klassItable* itable() const;        // return new klassItable wrapper
1018   Method* method_at_itable(Klass* holder, int index, TRAPS);
1019 
1020 #if INCLUDE_JVMTI
1021   void adjust_default_methods(InstanceKlass* holder, bool* trace_name_printed);
1022 #endif // INCLUDE_JVMTI
1023 
1024   void clean_weak_instanceklass_links(BoolObjectClosure* is_alive);
1025   void clean_implementors_list(BoolObjectClosure* is_alive);
1026   void clean_method_data(BoolObjectClosure* is_alive);
1027   void clean_dependent_nmethods();
1028 
1029   // Explicit metaspace deallocation of fields
1030   // For RedefineClasses and class file parsing errors, we need to deallocate
1031   // instanceKlasses and the metadata they point to.
1032   void deallocate_contents(ClassLoaderData* loader_data);
1033   static void deallocate_methods(ClassLoaderData* loader_data,
1034                                  Array<Method*>* methods);
1035   void static deallocate_interfaces(ClassLoaderData* loader_data,
1036                                     Klass* super_klass,
1037                                     Array<Klass*>* local_interfaces,
1038                                     Array<Klass*>* transitive_interfaces);
1039 
1040   // The constant pool is on stack if any of the methods are executing or
1041   // referenced by handles.
1042   bool on_stack() const { return _constants->on_stack(); }
1043 
1044   // callbacks for actions during class unloading
1045   static void notify_unload_class(InstanceKlass* ik);
1046   static void release_C_heap_structures(InstanceKlass* ik);
1047 


1319 
1320 
1321 //
1322 // nmethodBucket is used to record dependent nmethods for
1323 // deoptimization.  nmethod dependencies are actually <klass, method>
1324 // pairs but we really only care about the klass part for purposes of
1325 // finding nmethods which might need to be deoptimized.  Instead of
1326 // recording the method, a count of how many times a particular nmethod
1327 // was recorded is kept.  This ensures that any recording errors are
1328 // noticed since an nmethod should be removed as many times are it's
1329 // added.
1330 //
1331 class nmethodBucket: public CHeapObj<mtClass> {
1332   friend class VMStructs;
1333  private:
1334   nmethod*       _nmethod;
1335   int            _count;
1336   nmethodBucket* _next;
1337 
1338  public:
1339   nmethodBucket(nmethod* nmethod, nmethodBucket* next) {
1340     _nmethod = nmethod;
1341     _next = next;
1342     _count = 1;
1343   }
1344   int count()                             { return _count; }
1345   int increment()                         { _count += 1; return _count; }
1346   int decrement();
1347   nmethodBucket* next()                   { return _next; }
1348   void set_next(nmethodBucket* b)         { _next = b; }
1349   nmethod* get_nmethod()                  { return _nmethod; }
1350 
1351   static int mark_dependent_nmethods(nmethodBucket* deps, DepChange& changes);
1352   static nmethodBucket* add_dependent_nmethod(nmethodBucket* deps, nmethod* nm);
1353   static bool remove_dependent_nmethod(nmethodBucket** deps, nmethod* nm, bool delete_immediately);
1354   static bool remove_dependent_nmethod(nmethodBucket* deps, nmethod* nm);
1355   static nmethodBucket* clean_dependent_nmethods(nmethodBucket* deps);
1356 #ifndef PRODUCT
1357   static void print_dependent_nmethods(nmethodBucket* deps, bool verbose);
1358   static bool is_dependent_nmethod(nmethodBucket* deps, nmethod* nm);
1359 #endif //PRODUCT
1360 };
1361 
1362 // An iterator that's used to access the inner classes indices in the
1363 // InstanceKlass::_inner_classes array.
1364 class InnerClassesIterator : public StackObj {
1365  private:
1366   Array<jushort>* _inner_classes;
1367   int _length;
1368   int _idx;
1369  public:
1370 
1371   InnerClassesIterator(instanceKlassHandle k) {
1372     _inner_classes = k->inner_classes();
1373     if (k->inner_classes() != NULL) {
1374       _length = _inner_classes->length();
1375       // The inner class array's length should be the multiple of
1376       // inner_class_next_offset if it only contains the InnerClasses
1377       // attribute data, or it should be
1378       // n*inner_class_next_offset+enclosing_method_attribute_size
1379       // if it also contains the EnclosingMethod data.




  87  public:
  88   // Byte offset of the first oop mapped by this block.
  89   int offset() const          { return _offset; }
  90   void set_offset(int offset) { _offset = offset; }
  91 
  92   // Number of oops in this block.
  93   uint count() const         { return _count; }
  94   void set_count(uint count) { _count = count; }
  95 
  96   // sizeof(OopMapBlock) in HeapWords.
  97   static const int size_in_words() {
  98     return align_size_up(int(sizeof(OopMapBlock)), HeapWordSize) >>
  99       LogHeapWordSize;
 100   }
 101 
 102  private:
 103   int  _offset;
 104   uint _count;
 105 };
 106 
 107 // Utility class to manipulate nmethod dependency context.
 108 // The context consists of nmethodBucket* (a head of a linked list)
 109 // and a boolean flag (does the list contains stale entries). The structure is
 110 // encoded as an intptr_t: lower bit is used for the flag. It is possible since
 111 // nmethodBucket* is aligned - the structure is malloc'ed in C heap.
 112 // Dependency context can be attached either to an InstanceKlass (_dep_context field)
 113 // or CallSiteContext oop for call_site_target dependencies (see javaClasses.hpp).
 114 // DependencyContext class operates on some location which holds a intptr_t value.
 115 class DependencyContext : public StackObj {
 116   friend class VMStructs;
 117  private:
 118   enum TagBits { _has_unloaded_bit = 1, _has_unloaded_mask = 1 };
 119 
 120   intptr_t* _dependency_context_addr;
 121 
 122   void set_dependencies(nmethodBucket* b) {
 123     assert((intptr_t(b) & _has_unloaded_mask) == 0, "should be aligned");
 124     if (has_unloaded_dependent()) {
 125       *_dependency_context_addr = intptr_t(b) | _has_unloaded_mask;
 126     } else {
 127       *_dependency_context_addr = intptr_t(b);
 128     }
 129   }
 130 
 131   void set_has_unloaded_dependent(bool value) {
 132     intptr_t b = (intptr_t)dependencies();
 133     *_dependency_context_addr = (b | _has_unloaded_mask);
 134   }
 135 
 136  public:
 137   DependencyContext(intptr_t* addr) : _dependency_context_addr(addr) {}
 138 
 139   static const intptr_t EMPTY = 0; // dependencies = NULL, has_unloaded_dependent = false
 140 
 141   nmethodBucket* dependencies() {
 142     intptr_t value = *_dependency_context_addr;
 143     return (nmethodBucket*) (value & ~_has_unloaded_mask);
 144   }
 145 
 146   bool has_unloaded_dependent() const {
 147     intptr_t value = *_dependency_context_addr;
 148     return (value & _has_unloaded_mask) != 0;
 149   };
 150 
 151   int  mark_dependent_nmethods(DepChange& changes);
 152   void add_dependent_nmethod(nmethod* nm);
 153   void remove_dependent_nmethod(nmethod* nm, bool delete_immediately = false);
 154   void purge();
 155   int  clear();
 156 
 157 #ifndef PRODUCT
 158   void print_dependent_nmethods(bool verbose);
 159   bool is_dependent_nmethod(nmethod* nm);
 160   bool has_stale_entries();
 161   void wipe();
 162 #endif //PRODUCT
 163 };
 164 
 165 struct JvmtiCachedClassFileData;
 166 
 167 class InstanceKlass: public Klass {
 168   friend class VMStructs;
 169   friend class ClassFileParser;
 170   friend class CompileReplay;
 171 
 172  protected:
 173   // Constructor
 174   InstanceKlass(int vtable_len,
 175                 int itable_len,
 176                 int static_field_size,
 177                 int nonstatic_oop_map_size,
 178                 unsigned kind,
 179                 ReferenceType rt,
 180                 AccessFlags access_flags,
 181                 bool is_anonymous);
 182  public:
 183   static InstanceKlass* allocate_instance_klass(
 184                                           ClassLoaderData* loader_data,


 239   // if this class is unloaded.
 240   Symbol*         _array_name;
 241 
 242   // Number of heapOopSize words used by non-static fields in this klass
 243   // (including inherited fields but after header_size()).
 244   int             _nonstatic_field_size;
 245   int             _static_field_size;    // number words used by static fields (oop and non-oop) in this klass
 246   // Constant pool index to the utf8 entry of the Generic signature,
 247   // or 0 if none.
 248   u2              _generic_signature_index;
 249   // Constant pool index to the utf8 entry for the name of source file
 250   // containing this klass, 0 if not specified.
 251   u2              _source_file_name_index;
 252   u2              _static_oop_field_count;// number of static oop fields in this klass
 253   u2              _java_fields_count;    // The number of declared Java fields
 254   int             _nonstatic_oop_map_size;// size in words of nonstatic oop map blocks
 255 
 256   // _is_marked_dependent can be set concurrently, thus cannot be part of the
 257   // _misc_flags.
 258   bool            _is_marked_dependent;  // used for marking during flushing and deoptimization

 259 
 260   // The low two bits of _misc_flags contains the kind field.
 261   // This can be used to quickly discriminate among the four kinds of
 262   // InstanceKlass.
 263 
 264   static const unsigned _misc_kind_field_size = 2;
 265   static const unsigned _misc_kind_field_pos  = 0;
 266   static const unsigned _misc_kind_field_mask = (1u << _misc_kind_field_size) - 1u;
 267 
 268   static const unsigned _misc_kind_other        = 0; // concrete InstanceKlass
 269   static const unsigned _misc_kind_reference    = 1; // InstanceRefKlass
 270   static const unsigned _misc_kind_class_loader = 2; // InstanceClassLoaderKlass
 271   static const unsigned _misc_kind_mirror       = 3; // InstanceMirrorKlass
 272 
 273   // Start after _misc_kind field.
 274   enum {
 275     _misc_rewritten                = 1 << 2, // methods rewritten.
 276     _misc_has_nonstatic_fields     = 1 << 3, // for sizing with UseCompressedOops
 277     _misc_should_verify_class      = 1 << 4, // allow caching of preverification
 278     _misc_is_anonymous             = 1 << 5, // has embedded _host_klass field
 279     _misc_is_contended             = 1 << 6, // marked with contended annotation
 280     _misc_has_default_methods      = 1 << 7, // class/superclass/implemented interfaces has default methods
 281     _misc_declares_default_methods = 1 << 8, // directly declares default methods (any access)
 282     _misc_has_been_redefined       = 1 << 9, // class has been redefined
 283     _misc_is_scratch_class         = 1 << 10 // class is the redefined scratch class
 284   };
 285   u2              _misc_flags;
 286   u2              _minor_version;        // minor version number of class file
 287   u2              _major_version;        // major version number of class file
 288   Thread*         _init_thread;          // Pointer to current thread doing initialization (to handle recusive initialization)
 289   int             _vtable_len;           // length of Java vtable (in words)
 290   int             _itable_len;           // length of Java itable (in words)
 291   OopMapCache*    volatile _oop_map_cache;   // OopMapCache for all methods in the klass (allocated lazily)
 292   MemberNameTable* _member_names;        // Member names
 293   JNIid*          _jni_ids;              // First JNI identifier for static fields in this class
 294   jmethodID*      _methods_jmethod_ids;  // jmethodIDs corresponding to method_idnum, or NULL if none
 295   intptr_t        _dep_context;          // packed DependencyContext structure
 296   nmethod*        _osr_nmethods_head;    // Head of list of on-stack replacement nmethods for this class
 297   BreakpointInfo* _breakpoints;          // bpt lists, managed by Method*
 298   // Linked instanceKlasses of previous versions
 299   InstanceKlass* _previous_versions;
 300   // JVMTI fields can be moved to their own structure - see 6315920
 301   // JVMTI: cached class file, before retransformable agent modified it in CFLH
 302   JvmtiCachedClassFileData* _cached_class_file;
 303 
 304   volatile u2     _idnum_allocated_count;         // JNI/JVMTI: increments with the addition of methods, old ids don't change
 305 
 306   // Class states are defined as ClassState (see above).
 307   // Place the _init_state here to utilize the unused 2-byte after
 308   // _idnum_allocated_count.
 309   u1              _init_state;                    // state of class
 310   u1              _reference_type;                // reference type
 311 
 312   JvmtiCachedClassFieldMap* _jvmti_cached_class_field_map;  // JVMTI: used during heap iteration
 313 
 314   NOT_PRODUCT(int _verify_count;)  // to avoid redundant verifies
 315 


 508   bool is_reentrant_initialization(Thread *thread)  { return thread == _init_thread; }
 509   ClassState  init_state()                 { return (ClassState)_init_state; }
 510   bool is_rewritten() const                { return (_misc_flags & _misc_rewritten) != 0; }
 511 
 512   // defineClass specified verification
 513   bool should_verify_class() const         {
 514     return (_misc_flags & _misc_should_verify_class) != 0;
 515   }
 516   void set_should_verify_class(bool value) {
 517     if (value) {
 518       _misc_flags |= _misc_should_verify_class;
 519     } else {
 520       _misc_flags &= ~_misc_should_verify_class;
 521     }
 522   }
 523 
 524   // marking
 525   bool is_marked_dependent() const         { return _is_marked_dependent; }
 526   void set_is_marked_dependent(bool value) { _is_marked_dependent = value; }
 527 



 528   // initialization (virtuals from Klass)
 529   bool should_be_initialized() const;  // means that initialize should be called
 530   void initialize(TRAPS);
 531   void link_class(TRAPS);
 532   bool link_class_or_fail(TRAPS); // returns false on failure
 533   void unlink_class();
 534   void rewrite_class(TRAPS);
 535   void link_methods(TRAPS);
 536   Method* class_initializer();
 537 
 538   // set the class to initialized if no static initializer is present
 539   void eager_initialize(Thread *thread);
 540 
 541   // reference type
 542   ReferenceType reference_type() const     { return (ReferenceType)_reference_type; }
 543   void set_reference_type(ReferenceType t) {
 544     assert(t == (u1)t, "overflow");
 545     _reference_type = (u1)t;
 546   }
 547 


 875   virtual void check_valid_for_instantiation(bool throwError, TRAPS);
 876 
 877   // initialization
 878   void call_class_initializer(TRAPS);
 879   void set_initialization_state_and_notify(ClassState state, TRAPS);
 880 
 881   // OopMapCache support
 882   OopMapCache* oop_map_cache()               { return _oop_map_cache; }
 883   void set_oop_map_cache(OopMapCache *cache) { _oop_map_cache = cache; }
 884   void mask_for(methodHandle method, int bci, InterpreterOopMap* entry);
 885 
 886   // JNI identifier support (for static fields - for jni performance)
 887   JNIid* jni_ids()                               { return _jni_ids; }
 888   void set_jni_ids(JNIid* ids)                   { _jni_ids = ids; }
 889   JNIid* jni_id_for(int offset);
 890 
 891   // maintenance of deoptimization dependencies
 892   int mark_dependent_nmethods(DepChange& changes);
 893   void add_dependent_nmethod(nmethod* nm);
 894   void remove_dependent_nmethod(nmethod* nm, bool delete_immediately);
 895   void clean_dependent_nmethods();
 896 
 897   // On-stack replacement support
 898   nmethod* osr_nmethods_head() const         { return _osr_nmethods_head; };
 899   void set_osr_nmethods_head(nmethod* h)     { _osr_nmethods_head = h; };
 900   void add_osr_nmethod(nmethod* n);
 901   void remove_osr_nmethod(nmethod* n);
 902   int mark_osr_nmethods(const Method* m);
 903   nmethod* lookup_osr_nmethod(const Method* m, int bci, int level, bool match_level) const;
 904 
 905   // Breakpoint support (see methods on Method* for details)
 906   BreakpointInfo* breakpoints() const       { return _breakpoints; };
 907   void set_breakpoints(BreakpointInfo* bps) { _breakpoints = bps; };
 908 
 909   // support for stub routines
 910   static ByteSize init_state_offset()  { return in_ByteSize(offset_of(InstanceKlass, _init_state)); }
 911   TRACE_DEFINE_OFFSET;
 912   static ByteSize init_thread_offset() { return in_ByteSize(offset_of(InstanceKlass, _init_thread)); }
 913 
 914   // subclass/subinterface checks
 915   bool implements_interface(Klass* k) const;


1062   //  - the class has a finalizer (if !RegisterFinalizersAtInit)
1063   //  - the class size is larger than FastAllocateSizeLimit
1064   //  - the class is java/lang/Class, which cannot be allocated directly
1065   bool can_be_fastpath_allocated() const {
1066     return !layout_helper_needs_slow_path(layout_helper());
1067   }
1068 
1069   // Java vtable/itable
1070   klassVtable* vtable() const;        // return new klassVtable wrapper
1071   inline Method* method_at_vtable(int index);
1072   klassItable* itable() const;        // return new klassItable wrapper
1073   Method* method_at_itable(Klass* holder, int index, TRAPS);
1074 
1075 #if INCLUDE_JVMTI
1076   void adjust_default_methods(InstanceKlass* holder, bool* trace_name_printed);
1077 #endif // INCLUDE_JVMTI
1078 
1079   void clean_weak_instanceklass_links(BoolObjectClosure* is_alive);
1080   void clean_implementors_list(BoolObjectClosure* is_alive);
1081   void clean_method_data(BoolObjectClosure* is_alive);

1082 
1083   // Explicit metaspace deallocation of fields
1084   // For RedefineClasses and class file parsing errors, we need to deallocate
1085   // instanceKlasses and the metadata they point to.
1086   void deallocate_contents(ClassLoaderData* loader_data);
1087   static void deallocate_methods(ClassLoaderData* loader_data,
1088                                  Array<Method*>* methods);
1089   void static deallocate_interfaces(ClassLoaderData* loader_data,
1090                                     Klass* super_klass,
1091                                     Array<Klass*>* local_interfaces,
1092                                     Array<Klass*>* transitive_interfaces);
1093 
1094   // The constant pool is on stack if any of the methods are executing or
1095   // referenced by handles.
1096   bool on_stack() const { return _constants->on_stack(); }
1097 
1098   // callbacks for actions during class unloading
1099   static void notify_unload_class(InstanceKlass* ik);
1100   static void release_C_heap_structures(InstanceKlass* ik);
1101 


1373 
1374 
1375 //
1376 // nmethodBucket is used to record dependent nmethods for
1377 // deoptimization.  nmethod dependencies are actually <klass, method>
1378 // pairs but we really only care about the klass part for purposes of
1379 // finding nmethods which might need to be deoptimized.  Instead of
1380 // recording the method, a count of how many times a particular nmethod
1381 // was recorded is kept.  This ensures that any recording errors are
1382 // noticed since an nmethod should be removed as many times are it's
1383 // added.
1384 //
1385 class nmethodBucket: public CHeapObj<mtClass> {
1386   friend class VMStructs;
1387  private:
1388   nmethod*       _nmethod;
1389   int            _count;
1390   nmethodBucket* _next;
1391 
1392  public:
1393   nmethodBucket(nmethod* nmethod, nmethodBucket* next) :
1394    _nmethod(nmethod), _next(next), _count(1) {}
1395 


1396   int count()                             { return _count; }
1397   int increment()                         { _count += 1; return _count; }
1398   int decrement();
1399   nmethodBucket* next()                   { return _next; }
1400   void set_next(nmethodBucket* b)         { _next = b; }
1401   nmethod* get_nmethod()                  { return _nmethod; }










1402 };
1403 
1404 // An iterator that's used to access the inner classes indices in the
1405 // InstanceKlass::_inner_classes array.
1406 class InnerClassesIterator : public StackObj {
1407  private:
1408   Array<jushort>* _inner_classes;
1409   int _length;
1410   int _idx;
1411  public:
1412 
1413   InnerClassesIterator(instanceKlassHandle k) {
1414     _inner_classes = k->inner_classes();
1415     if (k->inner_classes() != NULL) {
1416       _length = _inner_classes->length();
1417       // The inner class array's length should be the multiple of
1418       // inner_class_next_offset if it only contains the InnerClasses
1419       // attribute data, or it should be
1420       // n*inner_class_next_offset+enclosing_method_attribute_size
1421       // if it also contains the EnclosingMethod data.


src/share/vm/oops/instanceKlass.hpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File