228 bool _is_marked_dependent; // used for marking during flushing and deoptimization
229
230 enum {
231 _misc_rewritten = 1 << 0, // methods rewritten.
232 _misc_has_nonstatic_fields = 1 << 1, // for sizing with UseCompressedOops
233 _misc_should_verify_class = 1 << 2, // allow caching of preverification
234 _misc_is_anonymous = 1 << 3, // has embedded _host_klass field
235 _misc_is_contended = 1 << 4, // marked with contended annotation
236 _misc_has_default_methods = 1 << 5 // class/superclass/implemented interfaces has default methods
237 };
238 u2 _misc_flags;
239 u2 _minor_version; // minor version number of class file
240 u2 _major_version; // major version number of class file
241 Thread* _init_thread; // Pointer to current thread doing initialization (to handle recusive initialization)
242 int _vtable_len; // length of Java vtable (in words)
243 int _itable_len; // length of Java itable (in words)
244 OopMapCache* volatile _oop_map_cache; // OopMapCache for all methods in the klass (allocated lazily)
245 MemberNameTable* _member_names; // Member names
246 JNIid* _jni_ids; // First JNI identifier for static fields in this class
247 jmethodID* _methods_jmethod_ids; // jmethodIDs corresponding to method_idnum, or NULL if none
248 int* _methods_cached_itable_indices; // itable_index cache for JNI invoke corresponding to methods idnum, or NULL
249 nmethodBucket* _dependencies; // list of dependent nmethods
250 nmethod* _osr_nmethods_head; // Head of list of on-stack replacement nmethods for this class
251 BreakpointInfo* _breakpoints; // bpt lists, managed by Method*
252 // Array of interesting part(s) of the previous version(s) of this
253 // InstanceKlass. See PreviousVersionWalker below.
254 GrowableArray<PreviousVersionNode *>* _previous_versions;
255 // JVMTI fields can be moved to their own structure - see 6315920
256 // JVMTI: cached class file, before retransformable agent modified it in CFLH
257 JvmtiCachedClassFileData* _cached_class_file;
258
259 volatile u2 _idnum_allocated_count; // JNI/JVMTI: increments with the addition of methods, old ids don't change
260
261 // Class states are defined as ClassState (see above).
262 // Place the _init_state here to utilize the unused 2-byte after
263 // _idnum_allocated_count.
264 u1 _init_state; // state of class
265 u1 _reference_type; // reference type
266
267 JvmtiCachedClassFieldMap* _jvmti_cached_class_field_map; // JVMTI: used during heap iteration
268
673 u2 enclosing_method_class_index() {
674 return enclosing_method_data(enclosing_method_class_index_offset);
675 }
676 u2 enclosing_method_method_index() {
677 return enclosing_method_data(enclosing_method_method_index_offset);
678 }
679 void set_enclosing_method_indices(u2 class_index,
680 u2 method_index);
681
682 // jmethodID support
683 static jmethodID get_jmethod_id(instanceKlassHandle ik_h,
684 methodHandle method_h);
685 static jmethodID get_jmethod_id_fetch_or_update(instanceKlassHandle ik_h,
686 size_t idnum, jmethodID new_id, jmethodID* new_jmeths,
687 jmethodID* to_dealloc_id_p,
688 jmethodID** to_dealloc_jmeths_p);
689 static void get_jmethod_id_length_value(jmethodID* cache, size_t idnum,
690 size_t *length_p, jmethodID* id_p);
691 jmethodID jmethod_id_or_null(Method* method);
692
693 // cached itable index support
694 void set_cached_itable_index(size_t idnum, int index);
695 int cached_itable_index(size_t idnum);
696
697 // annotations support
698 Annotations* annotations() const { return _annotations; }
699 void set_annotations(Annotations* anno) { _annotations = anno; }
700
701 AnnotationArray* class_annotations() const {
702 return (_annotations != NULL) ? _annotations->class_annotations() : NULL;
703 }
704 Array<AnnotationArray*>* fields_annotations() const {
705 return (_annotations != NULL) ? _annotations->fields_annotations() : NULL;
706 }
707 AnnotationArray* class_type_annotations() const {
708 return (_annotations != NULL) ? _annotations->class_type_annotations() : NULL;
709 }
710 Array<AnnotationArray*>* fields_type_annotations() const {
711 return (_annotations != NULL) ? _annotations->fields_type_annotations() : NULL;
712 }
713 // allocation
714 instanceOop allocate_instance(TRAPS);
715
716 // additional member function to return a handle
977 private:
978 // initialization state
979 #ifdef ASSERT
980 void set_init_state(ClassState state);
981 #else
982 void set_init_state(ClassState state) { _init_state = (u1)state; }
983 #endif
984 void set_rewritten() { _misc_flags |= _misc_rewritten; }
985 void set_init_thread(Thread *thread) { _init_thread = thread; }
986
987 // The RedefineClasses() API can cause new method idnums to be needed
988 // which will cause the caches to grow. Safety requires different
989 // cache management logic if the caches can grow instead of just
990 // going from NULL to non-NULL.
991 bool idnum_can_increment() const { return has_been_redefined(); }
992 jmethodID* methods_jmethod_ids_acquire() const
993 { return (jmethodID*)OrderAccess::load_ptr_acquire(&_methods_jmethod_ids); }
994 void release_set_methods_jmethod_ids(jmethodID* jmeths)
995 { OrderAccess::release_store_ptr(&_methods_jmethod_ids, jmeths); }
996
997 int* methods_cached_itable_indices_acquire() const
998 { return (int*)OrderAccess::load_ptr_acquire(&_methods_cached_itable_indices); }
999 void release_set_methods_cached_itable_indices(int* indices)
1000 { OrderAccess::release_store_ptr(&_methods_cached_itable_indices, indices); }
1001
1002 // Lock during initialization
1003 public:
1004 // Lock for (1) initialization; (2) access to the ConstantPool of this class.
1005 // Must be one per class and it has to be a VM internal object so java code
1006 // cannot lock it (like the mirror).
1007 // It has to be an object not a Mutex because it's held through java calls.
1008 volatile oop init_lock() const;
1009 private:
1010
1011 // Static methods that are used to implement member methods where an exposed this pointer
1012 // is needed due to possible GCs
1013 static bool link_class_impl (instanceKlassHandle this_oop, bool throw_verifyerror, TRAPS);
1014 static bool verify_code (instanceKlassHandle this_oop, bool throw_verifyerror, TRAPS);
1015 static void initialize_impl (instanceKlassHandle this_oop, TRAPS);
1016 static void eager_initialize_impl (instanceKlassHandle this_oop);
1017 static void set_initialization_state_and_notify_impl (instanceKlassHandle this_oop, ClassState state, TRAPS);
1018 static void call_class_initializer_impl (instanceKlassHandle this_oop, TRAPS);
1019 static Klass* array_klass_impl (instanceKlassHandle this_oop, bool or_null, int n, TRAPS);
1020 static void do_local_static_fields_impl (instanceKlassHandle this_oop, void f(fieldDescriptor* fd, TRAPS), TRAPS);
1021 /* jni_id_for_impl for jfieldID only */
|
228 bool _is_marked_dependent; // used for marking during flushing and deoptimization
229
230 enum {
231 _misc_rewritten = 1 << 0, // methods rewritten.
232 _misc_has_nonstatic_fields = 1 << 1, // for sizing with UseCompressedOops
233 _misc_should_verify_class = 1 << 2, // allow caching of preverification
234 _misc_is_anonymous = 1 << 3, // has embedded _host_klass field
235 _misc_is_contended = 1 << 4, // marked with contended annotation
236 _misc_has_default_methods = 1 << 5 // class/superclass/implemented interfaces has default methods
237 };
238 u2 _misc_flags;
239 u2 _minor_version; // minor version number of class file
240 u2 _major_version; // major version number of class file
241 Thread* _init_thread; // Pointer to current thread doing initialization (to handle recusive initialization)
242 int _vtable_len; // length of Java vtable (in words)
243 int _itable_len; // length of Java itable (in words)
244 OopMapCache* volatile _oop_map_cache; // OopMapCache for all methods in the klass (allocated lazily)
245 MemberNameTable* _member_names; // Member names
246 JNIid* _jni_ids; // First JNI identifier for static fields in this class
247 jmethodID* _methods_jmethod_ids; // jmethodIDs corresponding to method_idnum, or NULL if none
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 Method*
251 // Array of interesting part(s) of the previous version(s) of this
252 // InstanceKlass. See PreviousVersionWalker below.
253 GrowableArray<PreviousVersionNode *>* _previous_versions;
254 // JVMTI fields can be moved to their own structure - see 6315920
255 // JVMTI: cached class file, before retransformable agent modified it in CFLH
256 JvmtiCachedClassFileData* _cached_class_file;
257
258 volatile u2 _idnum_allocated_count; // JNI/JVMTI: increments with the addition of methods, old ids don't change
259
260 // Class states are defined as ClassState (see above).
261 // Place the _init_state here to utilize the unused 2-byte after
262 // _idnum_allocated_count.
263 u1 _init_state; // state of class
264 u1 _reference_type; // reference type
265
266 JvmtiCachedClassFieldMap* _jvmti_cached_class_field_map; // JVMTI: used during heap iteration
267
672 u2 enclosing_method_class_index() {
673 return enclosing_method_data(enclosing_method_class_index_offset);
674 }
675 u2 enclosing_method_method_index() {
676 return enclosing_method_data(enclosing_method_method_index_offset);
677 }
678 void set_enclosing_method_indices(u2 class_index,
679 u2 method_index);
680
681 // jmethodID support
682 static jmethodID get_jmethod_id(instanceKlassHandle ik_h,
683 methodHandle method_h);
684 static jmethodID get_jmethod_id_fetch_or_update(instanceKlassHandle ik_h,
685 size_t idnum, jmethodID new_id, jmethodID* new_jmeths,
686 jmethodID* to_dealloc_id_p,
687 jmethodID** to_dealloc_jmeths_p);
688 static void get_jmethod_id_length_value(jmethodID* cache, size_t idnum,
689 size_t *length_p, jmethodID* id_p);
690 jmethodID jmethod_id_or_null(Method* method);
691
692 // annotations support
693 Annotations* annotations() const { return _annotations; }
694 void set_annotations(Annotations* anno) { _annotations = anno; }
695
696 AnnotationArray* class_annotations() const {
697 return (_annotations != NULL) ? _annotations->class_annotations() : NULL;
698 }
699 Array<AnnotationArray*>* fields_annotations() const {
700 return (_annotations != NULL) ? _annotations->fields_annotations() : NULL;
701 }
702 AnnotationArray* class_type_annotations() const {
703 return (_annotations != NULL) ? _annotations->class_type_annotations() : NULL;
704 }
705 Array<AnnotationArray*>* fields_type_annotations() const {
706 return (_annotations != NULL) ? _annotations->fields_type_annotations() : NULL;
707 }
708 // allocation
709 instanceOop allocate_instance(TRAPS);
710
711 // additional member function to return a handle
972 private:
973 // initialization state
974 #ifdef ASSERT
975 void set_init_state(ClassState state);
976 #else
977 void set_init_state(ClassState state) { _init_state = (u1)state; }
978 #endif
979 void set_rewritten() { _misc_flags |= _misc_rewritten; }
980 void set_init_thread(Thread *thread) { _init_thread = thread; }
981
982 // The RedefineClasses() API can cause new method idnums to be needed
983 // which will cause the caches to grow. Safety requires different
984 // cache management logic if the caches can grow instead of just
985 // going from NULL to non-NULL.
986 bool idnum_can_increment() const { return has_been_redefined(); }
987 jmethodID* methods_jmethod_ids_acquire() const
988 { return (jmethodID*)OrderAccess::load_ptr_acquire(&_methods_jmethod_ids); }
989 void release_set_methods_jmethod_ids(jmethodID* jmeths)
990 { OrderAccess::release_store_ptr(&_methods_jmethod_ids, jmeths); }
991
992 // Lock during initialization
993 public:
994 // Lock for (1) initialization; (2) access to the ConstantPool of this class.
995 // Must be one per class and it has to be a VM internal object so java code
996 // cannot lock it (like the mirror).
997 // It has to be an object not a Mutex because it's held through java calls.
998 volatile oop init_lock() const;
999 private:
1000
1001 // Static methods that are used to implement member methods where an exposed this pointer
1002 // is needed due to possible GCs
1003 static bool link_class_impl (instanceKlassHandle this_oop, bool throw_verifyerror, TRAPS);
1004 static bool verify_code (instanceKlassHandle this_oop, bool throw_verifyerror, TRAPS);
1005 static void initialize_impl (instanceKlassHandle this_oop, TRAPS);
1006 static void eager_initialize_impl (instanceKlassHandle this_oop);
1007 static void set_initialization_state_and_notify_impl (instanceKlassHandle this_oop, ClassState state, TRAPS);
1008 static void call_class_initializer_impl (instanceKlassHandle this_oop, TRAPS);
1009 static Klass* array_klass_impl (instanceKlassHandle this_oop, bool or_null, int n, TRAPS);
1010 static void do_local_static_fields_impl (instanceKlassHandle this_oop, void f(fieldDescriptor* fd, TRAPS), TRAPS);
1011 /* jni_id_for_impl for jfieldID only */
|