< prev index next >

src/hotspot/share/oops/instanceKlass.hpp


51 //    [EMBEDDED Java vtable             ] size in words = vtable_len                                                                 
52 //    [EMBEDDED nonstatic oop-map blocks] size in words = nonstatic_oop_map_size                                                     
53 //      The embedded nonstatic oop-map blocks are short pairs (offset, length)                                                       
54 //      indicating where oops are located in instances of this klass.                                                                
55 //    [EMBEDDED implementor of the interface] only exist for interface                                                               
56 //    [EMBEDDED unsafe_anonymous_host klass] only exist for an unsafe anonymous class (JSR 292 enabled)                              
57 //    [EMBEDDED fingerprint       ] only if should_store_fingerprint()==true                                                         
58 
59 
60 // forward declaration for class -- see below for definition                                                                         
61 #if INCLUDE_JVMTI                                                                                                                    
62 class BreakpointInfo;                                                                                                                
63 #endif                                                                                                                               
64 class ClassFileParser;                                                                                                               
65 class KlassDepChange;                                                                                                                
66 class DependencyContext;                                                                                                             
67 class fieldDescriptor;                                                                                                               
68 class jniIdMapBase;                                                                                                                  
69 class JNIid;                                                                                                                         
70 class JvmtiCachedClassFieldMap;                                                                                                      
                                                                                                                                     
71 class SuperTypeClosure;                                                                                                              
72 
73 // This is used in iterators below.                                                                                                  
74 class FieldClosure: public StackObj {                                                                                                
75 public:                                                                                                                              
76   virtual void do_field(fieldDescriptor* fd) = 0;                                                                                    
77 };                                                                                                                                   
78 
79 #ifndef PRODUCT                                                                                                                      
80 // Print fields.                                                                                                                     
81 // If "obj" argument to constructor is NULL, prints static fields, otherwise prints non-static fields.                               
82 class FieldPrinter: public FieldClosure {                                                                                            
83    oop _obj;                                                                                                                         
84    outputStream* _st;                                                                                                                
85  public:                                                                                                                             
86    FieldPrinter(outputStream* st, oop obj = NULL) : _obj(obj), _st(st) {}                                                            
87    void do_field(fieldDescriptor* fd);                                                                                               
88 };                                                                                                                                   
89 #endif  // !PRODUCT                                                                                                                  

51 //    [EMBEDDED Java vtable             ] size in words = vtable_len
52 //    [EMBEDDED nonstatic oop-map blocks] size in words = nonstatic_oop_map_size
53 //      The embedded nonstatic oop-map blocks are short pairs (offset, length)
54 //      indicating where oops are located in instances of this klass.
55 //    [EMBEDDED implementor of the interface] only exist for interface
56 //    [EMBEDDED unsafe_anonymous_host klass] only exist for an unsafe anonymous class (JSR 292 enabled)
57 //    [EMBEDDED fingerprint       ] only if should_store_fingerprint()==true
58 
59 
60 // forward declaration for class -- see below for definition
61 #if INCLUDE_JVMTI
62 class BreakpointInfo;
63 #endif
64 class ClassFileParser;
65 class KlassDepChange;
66 class DependencyContext;
67 class fieldDescriptor;
68 class jniIdMapBase;
69 class JNIid;
70 class JvmtiCachedClassFieldMap;
71 class nmethodBucket;
72 class SuperTypeClosure;
73 
74 // This is used in iterators below.
75 class FieldClosure: public StackObj {
76 public:
77   virtual void do_field(fieldDescriptor* fd) = 0;
78 };
79 
80 #ifndef PRODUCT
81 // Print fields.
82 // If "obj" argument to constructor is NULL, prints static fields, otherwise prints non-static fields.
83 class FieldPrinter: public FieldClosure {
84    oop _obj;
85    outputStream* _st;
86  public:
87    FieldPrinter(outputStream* st, oop obj = NULL) : _obj(obj), _st(st) {}
88    void do_field(fieldDescriptor* fd);
89 };
90 #endif  // !PRODUCT

231     _misc_declares_nonstatic_concrete_methods = 1 << 8,  // directly declares non-static, concrete methods                           
232     _misc_has_been_redefined                  = 1 << 9,  // class has been redefined                                                 
233     _misc_has_passed_fingerprint_check        = 1 << 10, // when this class was loaded, the fingerprint computed from its            
234                                                          // code source was found to be matching the value recorded by AOT.          
235     _misc_is_scratch_class                    = 1 << 11, // class is the redefined scratch class                                     
236     _misc_is_shared_boot_class                = 1 << 12, // defining class loader is boot class loader                               
237     _misc_is_shared_platform_class            = 1 << 13, // defining class loader is platform class loader                           
238     _misc_is_shared_app_class                 = 1 << 14, // defining class loader is app class loader                                
239     _misc_has_resolved_methods                = 1 << 15  // resolved methods table entries added for this class                      
240   };                                                                                                                                 
241   u2 loader_type_bits() {                                                                                                            
242     return _misc_is_shared_boot_class|_misc_is_shared_platform_class|_misc_is_shared_app_class;                                      
243   }                                                                                                                                  
244   u2              _misc_flags;                                                                                                       
245   u2              _minor_version;        // minor version number of class file                                                       
246   u2              _major_version;        // major version number of class file                                                       
247   Thread*         _init_thread;          // Pointer to current thread doing initialization (to handle recusive initialization)       
248   OopMapCache*    volatile _oop_map_cache;   // OopMapCache for all methods in the klass (allocated lazily)                          
249   JNIid*          _jni_ids;              // First JNI identifier for static fields in this class                                     
250   jmethodID*      volatile _methods_jmethod_ids;  // jmethodIDs corresponding to method_idnum, or NULL if none                       
251   intptr_t        _dep_context;          // packed DependencyContext structure                                                       
                                                                                                                                     
252   nmethod*        _osr_nmethods_head;    // Head of list of on-stack replacement nmethods for this class                             
253 #if INCLUDE_JVMTI                                                                                                                    
254   BreakpointInfo* _breakpoints;          // bpt lists, managed by Method*                                                            
255   // Linked instanceKlasses of previous versions                                                                                     
256   InstanceKlass* _previous_versions;                                                                                                 
257   // JVMTI fields can be moved to their own structure - see 6315920                                                                  
258   // JVMTI: cached class file, before retransformable agent modified it in CFLH                                                      
259   JvmtiCachedClassFileData* _cached_class_file;                                                                                      
260 #endif                                                                                                                               
261 
262   volatile u2     _idnum_allocated_count;         // JNI/JVMTI: increments with the addition of methods, old ids don't change        
263 
264   // Class states are defined as ClassState (see above).                                                                             
265   // Place the _init_state here to utilize the unused 2-byte after                                                                   
266   // _idnum_allocated_count.                                                                                                         
267   u1              _init_state;                    // state of class                                                                  
268   u1              _reference_type;                // reference type                                                                  
269 
270   u2              _this_class_index;              // constant pool entry                                                             

232     _misc_declares_nonstatic_concrete_methods = 1 << 8,  // directly declares non-static, concrete methods
233     _misc_has_been_redefined                  = 1 << 9,  // class has been redefined
234     _misc_has_passed_fingerprint_check        = 1 << 10, // when this class was loaded, the fingerprint computed from its
235                                                          // code source was found to be matching the value recorded by AOT.
236     _misc_is_scratch_class                    = 1 << 11, // class is the redefined scratch class
237     _misc_is_shared_boot_class                = 1 << 12, // defining class loader is boot class loader
238     _misc_is_shared_platform_class            = 1 << 13, // defining class loader is platform class loader
239     _misc_is_shared_app_class                 = 1 << 14, // defining class loader is app class loader
240     _misc_has_resolved_methods                = 1 << 15  // resolved methods table entries added for this class
241   };
242   u2 loader_type_bits() {
243     return _misc_is_shared_boot_class|_misc_is_shared_platform_class|_misc_is_shared_app_class;
244   }
245   u2              _misc_flags;
246   u2              _minor_version;        // minor version number of class file
247   u2              _major_version;        // major version number of class file
248   Thread*         _init_thread;          // Pointer to current thread doing initialization (to handle recusive initialization)
249   OopMapCache*    volatile _oop_map_cache;   // OopMapCache for all methods in the klass (allocated lazily)
250   JNIid*          _jni_ids;              // First JNI identifier for static fields in this class
251   jmethodID*      volatile _methods_jmethod_ids;  // jmethodIDs corresponding to method_idnum, or NULL if none
252   nmethodBucket*  volatile _dep_context;          // packed DependencyContext structure
253   uint64_t        volatile _dep_context_last_cleaned;
254   nmethod*        _osr_nmethods_head;    // Head of list of on-stack replacement nmethods for this class
255 #if INCLUDE_JVMTI
256   BreakpointInfo* _breakpoints;          // bpt lists, managed by Method*
257   // Linked instanceKlasses of previous versions
258   InstanceKlass* _previous_versions;
259   // JVMTI fields can be moved to their own structure - see 6315920
260   // JVMTI: cached class file, before retransformable agent modified it in CFLH
261   JvmtiCachedClassFileData* _cached_class_file;
262 #endif
263 
264   volatile u2     _idnum_allocated_count;         // JNI/JVMTI: increments with the addition of methods, old ids don't change
265 
266   // Class states are defined as ClassState (see above).
267   // Place the _init_state here to utilize the unused 2-byte after
268   // _idnum_allocated_count.
269   u1              _init_state;                    // state of class
270   u1              _reference_type;                // reference type
271 
272   u2              _this_class_index;              // constant pool entry

958   virtual void check_valid_for_instantiation(bool throwError, TRAPS);                                                                
959 
960   // initialization                                                                                                                  
961   void call_class_initializer(TRAPS);                                                                                                
962   void set_initialization_state_and_notify(ClassState state, TRAPS);                                                                 
963 
964   // OopMapCache support                                                                                                             
965   OopMapCache* oop_map_cache()               { return _oop_map_cache; }                                                              
966   void set_oop_map_cache(OopMapCache *cache) { _oop_map_cache = cache; }                                                             
967   void mask_for(const methodHandle& method, int bci, InterpreterOopMap* entry);                                                      
968 
969   // JNI identifier support (for static fields - for jni performance)                                                                
970   JNIid* jni_ids()                               { return _jni_ids; }                                                                
971   void set_jni_ids(JNIid* ids)                   { _jni_ids = ids; }                                                                 
972   JNIid* jni_id_for(int offset);                                                                                                     
973 
974   // maintenance of deoptimization dependencies                                                                                      
975   inline DependencyContext dependencies();                                                                                           
976   int  mark_dependent_nmethods(KlassDepChange& changes);                                                                             
977   void add_dependent_nmethod(nmethod* nm);                                                                                           
978   void remove_dependent_nmethod(nmethod* nm, bool delete_immediately);                                                               
                                                                                                                                     
979 
980   // On-stack replacement support                                                                                                    
981   nmethod* osr_nmethods_head() const         { return _osr_nmethods_head; };                                                         
982   void set_osr_nmethods_head(nmethod* h)     { _osr_nmethods_head = h; };                                                            
983   void add_osr_nmethod(nmethod* n);                                                                                                  
984   bool remove_osr_nmethod(nmethod* n);                                                                                               
985   int mark_osr_nmethods(const Method* m);                                                                                            
986   nmethod* lookup_osr_nmethod(const Method* m, int bci, int level, bool match_level) const;                                          
987 
988 #if INCLUDE_JVMTI                                                                                                                    
989   // Breakpoint support (see methods on Method* for details)                                                                         
990   BreakpointInfo* breakpoints() const       { return _breakpoints; };                                                                
991   void set_breakpoints(BreakpointInfo* bps) { _breakpoints = bps; };                                                                 
992 #endif                                                                                                                               
993 
994   // support for stub routines                                                                                                       
995   static ByteSize init_state_offset()  { return in_ByteSize(offset_of(InstanceKlass, _init_state)); }                                
996   JFR_ONLY(DEFINE_KLASS_TRACE_ID_OFFSET;)                                                                                            
997   static ByteSize init_thread_offset() { return in_ByteSize(offset_of(InstanceKlass, _init_thread)); }                               

960   virtual void check_valid_for_instantiation(bool throwError, TRAPS);
961 
962   // initialization
963   void call_class_initializer(TRAPS);
964   void set_initialization_state_and_notify(ClassState state, TRAPS);
965 
966   // OopMapCache support
967   OopMapCache* oop_map_cache()               { return _oop_map_cache; }
968   void set_oop_map_cache(OopMapCache *cache) { _oop_map_cache = cache; }
969   void mask_for(const methodHandle& method, int bci, InterpreterOopMap* entry);
970 
971   // JNI identifier support (for static fields - for jni performance)
972   JNIid* jni_ids()                               { return _jni_ids; }
973   void set_jni_ids(JNIid* ids)                   { _jni_ids = ids; }
974   JNIid* jni_id_for(int offset);
975 
976   // maintenance of deoptimization dependencies
977   inline DependencyContext dependencies();
978   int  mark_dependent_nmethods(KlassDepChange& changes);
979   void add_dependent_nmethod(nmethod* nm);
980   void remove_dependent_nmethod(nmethod* nm);
981   void clean_dependency_context();
982 
983   // On-stack replacement support
984   nmethod* osr_nmethods_head() const         { return _osr_nmethods_head; };
985   void set_osr_nmethods_head(nmethod* h)     { _osr_nmethods_head = h; };
986   void add_osr_nmethod(nmethod* n);
987   bool remove_osr_nmethod(nmethod* n);
988   int mark_osr_nmethods(const Method* m);
989   nmethod* lookup_osr_nmethod(const Method* m, int bci, int level, bool match_level) const;
990 
991 #if INCLUDE_JVMTI
992   // Breakpoint support (see methods on Method* for details)
993   BreakpointInfo* breakpoints() const       { return _breakpoints; };
994   void set_breakpoints(BreakpointInfo* bps) { _breakpoints = bps; };
995 #endif
996 
997   // support for stub routines
998   static ByteSize init_state_offset()  { return in_ByteSize(offset_of(InstanceKlass, _init_state)); }
999   JFR_ONLY(DEFINE_KLASS_TRACE_ID_OFFSET;)
1000   static ByteSize init_thread_offset() { return in_ByteSize(offset_of(InstanceKlass, _init_thread)); }
< prev index next >