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