src/share/vm/oops/instanceKlass.hpp

Print this page
rev 6796 : [mq]: templateOopIterate
rev 6798 : [mq]: oneSwitch
rev 6800 : [mq]: replaceTemplateDispatchWithMacroDispatch


 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                 ReferenceType rt,
 121                 AccessFlags access_flags,
 122                 bool is_anonymous);

 123  public:
 124   static InstanceKlass* allocate_instance_klass(
 125                                           ClassLoaderData* loader_data,
 126                                           int vtable_len,
 127                                           int itable_len,
 128                                           int static_field_size,
 129                                           int nonstatic_oop_map_size,
 130                                           ReferenceType rt,
 131                                           AccessFlags access_flags,
 132                                           Symbol* name,
 133                                           Klass* super_klass,
 134                                           bool is_anonymous,
 135                                           TRAPS);
 136 
 137   InstanceKlass() { assert(DumpSharedSpaces || UseSharedSpaces, "only for CDS"); }
 138 
 139   // See "The Java Virtual Machine Specification" section 2.16.2-5 for a detailed description
 140   // of the class loading & initialization procedure, and the use of the states.
 141   enum ClassState {
 142     allocated,                          // allocated (but not yet linked)
 143     loaded,                             // loaded and inserted in class hierarchy (but not linked yet)
 144     linked,                             // successfully linked/verified (but not initialized yet)
 145     being_initialized,                  // currently running class initializer
 146     fully_initialized,                  // initialized (successfull final state)
 147     initialization_error                // error happened during initialization
 148   };
 149 
 150   static int number_of_instance_classes() { return _total_instanceKlass_count; }
 151 
 152  private:
 153   static volatile int _total_instanceKlass_count;
 154 
 155  protected:
 156   // Annotations for this class
 157   Annotations*    _annotations;


 936                                  Array<Method*>* methods);
 937   void static deallocate_interfaces(ClassLoaderData* loader_data,
 938                                     Klass* super_klass,
 939                                     Array<Klass*>* local_interfaces,
 940                                     Array<Klass*>* transitive_interfaces);
 941 
 942   // The constant pool is on stack if any of the methods are executing or
 943   // referenced by handles.
 944   bool on_stack() const { return _constants->on_stack(); }
 945 
 946   // callbacks for actions during class unloading
 947   static void notify_unload_class(InstanceKlass* ik);
 948   static void release_C_heap_structures(InstanceKlass* ik);
 949 
 950   // Parallel Scavenge and Parallel Old
 951   PARALLEL_GC_DECLS
 952 
 953   // Naming
 954   const char* signature_name() const;
 955 
 956   // Iterators
 957   int oop_oop_iterate(oop obj, ExtendedOopClosure* blk) {
 958     return oop_oop_iterate_v(obj, blk);
 959   }
 960 
 961   int oop_oop_iterate_m(oop obj, ExtendedOopClosure* blk, MemRegion mr) {
 962     return oop_oop_iterate_v_m(obj, blk, mr);
 963   }
 964 
 965 #define InstanceKlass_OOP_OOP_ITERATE_DECL(OopClosureType, nv_suffix)      \
 966   int  oop_oop_iterate##nv_suffix(oop obj, OopClosureType* blk);           \
 967   int  oop_oop_iterate##nv_suffix##_m(oop obj, OopClosureType* blk,        \
 968                                       MemRegion mr);
 969 
 970   ALL_OOP_OOP_ITERATE_CLOSURES_1(InstanceKlass_OOP_OOP_ITERATE_DECL)
 971   ALL_OOP_OOP_ITERATE_CLOSURES_2(InstanceKlass_OOP_OOP_ITERATE_DECL)
 972 
 973 #if INCLUDE_ALL_GCS
 974 #define InstanceKlass_OOP_OOP_ITERATE_BACKWARDS_DECL(OopClosureType, nv_suffix) \
 975   int  oop_oop_iterate_backwards##nv_suffix(oop obj, OopClosureType* blk);
 976 
 977   ALL_OOP_OOP_ITERATE_CLOSURES_1(InstanceKlass_OOP_OOP_ITERATE_BACKWARDS_DECL)
 978   ALL_OOP_OOP_ITERATE_CLOSURES_2(InstanceKlass_OOP_OOP_ITERATE_BACKWARDS_DECL)
 979 #endif // INCLUDE_ALL_GCS
 980 
 981   u2 idnum_allocated_count() const      { return _idnum_allocated_count; }
 982 
 983 private:
 984   // initialization state
 985 #ifdef ASSERT
 986   void set_init_state(ClassState state);
 987 #else
 988   void set_init_state(ClassState state) { _init_state = (u1)state; }
 989 #endif
 990   void set_rewritten()                  { _misc_flags |= _misc_rewritten; }
 991   void set_init_thread(Thread *thread)  { _init_thread = thread; }
 992 
 993   // The RedefineClasses() API can cause new method idnums to be needed
 994   // which will cause the caches to grow. Safety requires different
 995   // cache management logic if the caches can grow instead of just
 996   // going from NULL to non-NULL.
 997   bool idnum_can_increment() const      { return has_been_redefined(); }
 998   jmethodID* methods_jmethod_ids_acquire() const




 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                 ReferenceType rt,
 121                 AccessFlags access_flags,
 122                 bool is_anonymous,
 123                 DispatchTag tag = _instance);
 124  public:
 125   static InstanceKlass* allocate_instance_klass(
 126                                           ClassLoaderData* loader_data,
 127                                           int vtable_len,
 128                                           int itable_len,
 129                                           int static_field_size,
 130                                           int nonstatic_oop_map_size,
 131                                           ReferenceType rt,
 132                                           AccessFlags access_flags,
 133                                           Symbol* name,
 134                                           Klass* super_klass,
 135                                           bool is_anonymous,
 136                                           TRAPS);
 137 
 138   InstanceKlass(DispatchTag tag = _instance) : Klass(tag) { assert(DumpSharedSpaces || UseSharedSpaces, "only for CDS"); }
 139 
 140   // See "The Java Virtual Machine Specification" section 2.16.2-5 for a detailed description
 141   // of the class loading & initialization procedure, and the use of the states.
 142   enum ClassState {
 143     allocated,                          // allocated (but not yet linked)
 144     loaded,                             // loaded and inserted in class hierarchy (but not linked yet)
 145     linked,                             // successfully linked/verified (but not initialized yet)
 146     being_initialized,                  // currently running class initializer
 147     fully_initialized,                  // initialized (successfull final state)
 148     initialization_error                // error happened during initialization
 149   };
 150 
 151   static int number_of_instance_classes() { return _total_instanceKlass_count; }
 152 
 153  private:
 154   static volatile int _total_instanceKlass_count;
 155 
 156  protected:
 157   // Annotations for this class
 158   Annotations*    _annotations;


 937                                  Array<Method*>* methods);
 938   void static deallocate_interfaces(ClassLoaderData* loader_data,
 939                                     Klass* super_klass,
 940                                     Array<Klass*>* local_interfaces,
 941                                     Array<Klass*>* transitive_interfaces);
 942 
 943   // The constant pool is on stack if any of the methods are executing or
 944   // referenced by handles.
 945   bool on_stack() const { return _constants->on_stack(); }
 946 
 947   // callbacks for actions during class unloading
 948   static void notify_unload_class(InstanceKlass* ik);
 949   static void release_C_heap_structures(InstanceKlass* ik);
 950 
 951   // Parallel Scavenge and Parallel Old
 952   PARALLEL_GC_DECLS
 953 
 954   // Naming
 955   const char* signature_name() const;
 956 
 957   template <bool nv, typename OopClosureType>
 958   int oop_oop_iterate(oop obj, OopClosureType* blk);


 959 
 960   template <bool nv, typename OopClosureType>
 961   int oop_oop_iterate_m(oop obj, OopClosureType* blk, MemRegion mr);









 962 
 963 #if INCLUDE_ALL_GCS
 964   template <bool nv, typename OopClosureType>
 965   int  oop_oop_iterate_backwards(oop obj, OopClosureType* blk);



 966 #endif // INCLUDE_ALL_GCS
 967 
 968   u2 idnum_allocated_count() const      { return _idnum_allocated_count; }
 969 
 970 private:
 971   // initialization state
 972 #ifdef ASSERT
 973   void set_init_state(ClassState state);
 974 #else
 975   void set_init_state(ClassState state) { _init_state = (u1)state; }
 976 #endif
 977   void set_rewritten()                  { _misc_flags |= _misc_rewritten; }
 978   void set_init_thread(Thread *thread)  { _init_thread = thread; }
 979 
 980   // The RedefineClasses() API can cause new method idnums to be needed
 981   // which will cause the caches to grow. Safety requires different
 982   // cache management logic if the caches can grow instead of just
 983   // going from NULL to non-NULL.
 984   bool idnum_can_increment() const      { return has_been_redefined(); }
 985   jmethodID* methods_jmethod_ids_acquire() const