Mercurial > hg > truffle
comparison src/share/vm/oops/instanceKlass.hpp @ 12355:cefad50507d8
Merge with hs25-b53
author | Gilles Duboscq <duboscq@ssw.jku.at> |
---|---|
date | Fri, 11 Oct 2013 10:38:03 +0200 |
parents | 6b0fd0964b87 0f37d1badced |
children | 096c224171c4 |
comparison
equal
deleted
inserted
replaced
12058:ccb4f2af2319 | 12355:cefad50507d8 |
---|---|
199 // number_of_inner_classes * 4. If the class has both InnerClasses | 199 // number_of_inner_classes * 4. If the class has both InnerClasses |
200 // and EnclosingMethod attributes the _inner_classes array length is | 200 // and EnclosingMethod attributes the _inner_classes array length is |
201 // number_of_inner_classes * 4 + enclosing_method_attribute_size. | 201 // number_of_inner_classes * 4 + enclosing_method_attribute_size. |
202 Array<jushort>* _inner_classes; | 202 Array<jushort>* _inner_classes; |
203 | 203 |
204 // Name of source file containing this klass, NULL if not specified. | |
205 Symbol* _source_file_name; | |
206 // the source debug extension for this klass, NULL if not specified. | 204 // the source debug extension for this klass, NULL if not specified. |
207 // Specified as UTF-8 string without terminating zero byte in the classfile, | 205 // Specified as UTF-8 string without terminating zero byte in the classfile, |
208 // it is stored in the instanceklass as a NULL-terminated UTF-8 string | 206 // it is stored in the instanceklass as a NULL-terminated UTF-8 string |
209 char* _source_debug_extension; | 207 char* _source_debug_extension; |
210 // Generic signature, or null if none. | |
211 Symbol* _generic_signature; | |
212 // Array name derived from this class which needs unreferencing | 208 // Array name derived from this class which needs unreferencing |
213 // if this class is unloaded. | 209 // if this class is unloaded. |
214 Symbol* _array_name; | 210 Symbol* _array_name; |
215 | 211 |
216 // Number of heapOopSize words used by non-static fields in this klass | 212 // Number of heapOopSize words used by non-static fields in this klass |
217 // (including inherited fields but after header_size()). | 213 // (including inherited fields but after header_size()). |
218 int _nonstatic_field_size; | 214 int _nonstatic_field_size; |
219 int _static_field_size; // number words used by static fields (oop and non-oop) in this klass | 215 int _static_field_size; // number words used by static fields (oop and non-oop) in this klass |
216 // Constant pool index to the utf8 entry of the Generic signature, | |
217 // or 0 if none. | |
218 u2 _generic_signature_index; | |
219 // Constant pool index to the utf8 entry for the name of source file | |
220 // containing this klass, 0 if not specified. | |
221 u2 _source_file_name_index; | |
220 u2 _static_oop_field_count;// number of static oop fields in this klass | 222 u2 _static_oop_field_count;// number of static oop fields in this klass |
221 u2 _java_fields_count; // The number of declared Java fields | 223 u2 _java_fields_count; // The number of declared Java fields |
222 int _nonstatic_oop_map_size;// size in words of nonstatic oop map blocks | 224 int _nonstatic_oop_map_size;// size in words of nonstatic oop map blocks |
223 | 225 |
224 // _is_marked_dependent can be set concurrently, thus cannot be part of the | 226 // _is_marked_dependent can be set concurrently, thus cannot be part of the |
241 int _itable_len; // length of Java itable (in words) | 243 int _itable_len; // length of Java itable (in words) |
242 OopMapCache* volatile _oop_map_cache; // OopMapCache for all methods in the klass (allocated lazily) | 244 OopMapCache* volatile _oop_map_cache; // OopMapCache for all methods in the klass (allocated lazily) |
243 MemberNameTable* _member_names; // Member names | 245 MemberNameTable* _member_names; // Member names |
244 JNIid* _jni_ids; // First JNI identifier for static fields in this class | 246 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 | 247 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 nmethodBucket* _dependencies; // list of dependent nmethods |
248 nmethod* _osr_nmethods_head; // Head of list of on-stack replacement nmethods for this class | 249 nmethod* _osr_nmethods_head; // Head of list of on-stack replacement nmethods for this class |
249 BreakpointInfo* _breakpoints; // bpt lists, managed by Method* | 250 BreakpointInfo* _breakpoints; // bpt lists, managed by Method* |
250 // Array of interesting part(s) of the previous version(s) of this | 251 // Array of interesting part(s) of the previous version(s) of this |
251 // InstanceKlass. See PreviousVersionWalker below. | 252 // InstanceKlass. See PreviousVersionWalker below. |
568 _misc_flags &= ~_misc_is_contended; | 569 _misc_flags &= ~_misc_is_contended; |
569 } | 570 } |
570 } | 571 } |
571 | 572 |
572 // source file name | 573 // source file name |
573 Symbol* source_file_name() const { return _source_file_name; } | 574 Symbol* source_file_name() const { |
574 void set_source_file_name(Symbol* n); | 575 return (_source_file_name_index == 0) ? |
576 (Symbol*)NULL : _constants->symbol_at(_source_file_name_index); | |
577 } | |
578 u2 source_file_name_index() const { | |
579 return _source_file_name_index; | |
580 } | |
581 void set_source_file_name_index(u2 sourcefile_index) { | |
582 _source_file_name_index = sourcefile_index; | |
583 } | |
575 | 584 |
576 // minor and major version numbers of class file | 585 // minor and major version numbers of class file |
577 u2 minor_version() const { return _minor_version; } | 586 u2 minor_version() const { return _minor_version; } |
578 void set_minor_version(u2 minor_version) { _minor_version = minor_version; } | 587 void set_minor_version(u2 minor_version) { _minor_version = minor_version; } |
579 u2 major_version() const { return _major_version; } | 588 u2 major_version() const { return _major_version; } |
646 // for adding methods, ConstMethod::UNSET_IDNUM means no more ids available | 655 // for adding methods, ConstMethod::UNSET_IDNUM means no more ids available |
647 inline u2 next_method_idnum(); | 656 inline u2 next_method_idnum(); |
648 void set_initial_method_idnum(u2 value) { _idnum_allocated_count = value; } | 657 void set_initial_method_idnum(u2 value) { _idnum_allocated_count = value; } |
649 | 658 |
650 // generics support | 659 // generics support |
651 Symbol* generic_signature() const { return _generic_signature; } | 660 Symbol* generic_signature() const { |
652 void set_generic_signature(Symbol* sig) { _generic_signature = sig; } | 661 return (_generic_signature_index == 0) ? |
662 (Symbol*)NULL : _constants->symbol_at(_generic_signature_index); | |
663 } | |
664 u2 generic_signature_index() const { | |
665 return _generic_signature_index; | |
666 } | |
667 void set_generic_signature_index(u2 sig_index) { | |
668 _generic_signature_index = sig_index; | |
669 } | |
653 | 670 |
654 u2 enclosing_method_data(int offset); | 671 u2 enclosing_method_data(int offset); |
655 u2 enclosing_method_class_index() { | 672 u2 enclosing_method_class_index() { |
656 return enclosing_method_data(enclosing_method_class_index_offset); | 673 return enclosing_method_data(enclosing_method_class_index_offset); |
657 } | 674 } |
669 jmethodID* to_dealloc_id_p, | 686 jmethodID* to_dealloc_id_p, |
670 jmethodID** to_dealloc_jmeths_p); | 687 jmethodID** to_dealloc_jmeths_p); |
671 static void get_jmethod_id_length_value(jmethodID* cache, size_t idnum, | 688 static void get_jmethod_id_length_value(jmethodID* cache, size_t idnum, |
672 size_t *length_p, jmethodID* id_p); | 689 size_t *length_p, jmethodID* id_p); |
673 jmethodID jmethod_id_or_null(Method* method); | 690 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 | 691 |
679 // annotations support | 692 // annotations support |
680 Annotations* annotations() const { return _annotations; } | 693 Annotations* annotations() const { return _annotations; } |
681 void set_annotations(Annotations* anno) { _annotations = anno; } | 694 void set_annotations(Annotations* anno) { _annotations = anno; } |
682 | 695 |
973 bool idnum_can_increment() const { return has_been_redefined(); } | 986 bool idnum_can_increment() const { return has_been_redefined(); } |
974 jmethodID* methods_jmethod_ids_acquire() const | 987 jmethodID* methods_jmethod_ids_acquire() const |
975 { return (jmethodID*)OrderAccess::load_ptr_acquire(&_methods_jmethod_ids); } | 988 { return (jmethodID*)OrderAccess::load_ptr_acquire(&_methods_jmethod_ids); } |
976 void release_set_methods_jmethod_ids(jmethodID* jmeths) | 989 void release_set_methods_jmethod_ids(jmethodID* jmeths) |
977 { OrderAccess::release_store_ptr(&_methods_jmethod_ids, jmeths); } | 990 { 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 | 991 |
984 // Lock during initialization | 992 // Lock during initialization |
985 public: | 993 public: |
986 // Lock for (1) initialization; (2) access to the ConstantPool of this class. | 994 // 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 | 995 // Must be one per class and it has to be a VM internal object so java code |
1116 | 1124 |
1117 class BreakpointInfo; | 1125 class BreakpointInfo; |
1118 | 1126 |
1119 | 1127 |
1120 // A collection point for interesting information about the previous | 1128 // A collection point for interesting information about the previous |
1121 // version(s) of an InstanceKlass. This class uses weak references to | 1129 // version(s) of an InstanceKlass. A GrowableArray of PreviousVersionNodes |
1122 // the information so that the information may be collected as needed | 1130 // is attached to the InstanceKlass as needed. See PreviousVersionWalker below. |
1123 // by the system. If the information is shared, then a regular | |
1124 // reference must be used because a weak reference would be seen as | |
1125 // collectible. A GrowableArray of PreviousVersionNodes is attached | |
1126 // to the InstanceKlass as needed. See PreviousVersionWalker below. | |
1127 class PreviousVersionNode : public CHeapObj<mtClass> { | 1131 class PreviousVersionNode : public CHeapObj<mtClass> { |
1128 private: | 1132 private: |
1129 // A shared ConstantPool is never collected so we'll always have | 1133 ConstantPool* _prev_constant_pool; |
1130 // a reference to it so we can update items in the cache. We'll | |
1131 // have a weak reference to a non-shared ConstantPool until all | |
1132 // of the methods (EMCP or obsolete) have been collected; the | |
1133 // non-shared ConstantPool becomes collectible at that point. | |
1134 ConstantPool* _prev_constant_pool; // regular or weak reference | |
1135 bool _prev_cp_is_weak; // true if not a shared ConstantPool | |
1136 | 1134 |
1137 // If the previous version of the InstanceKlass doesn't have any | 1135 // If the previous version of the InstanceKlass doesn't have any |
1138 // EMCP methods, then _prev_EMCP_methods will be NULL. If all the | 1136 // EMCP methods, then _prev_EMCP_methods will be NULL. If all the |
1139 // EMCP methods have been collected, then _prev_EMCP_methods can | 1137 // EMCP methods have been collected, then _prev_EMCP_methods can |
1140 // have a length of zero. | 1138 // have a length of zero. |
1141 GrowableArray<Method*>* _prev_EMCP_methods; | 1139 GrowableArray<Method*>* _prev_EMCP_methods; |
1142 | 1140 |
1143 public: | 1141 public: |
1144 PreviousVersionNode(ConstantPool* prev_constant_pool, bool prev_cp_is_weak, | 1142 PreviousVersionNode(ConstantPool* prev_constant_pool, |
1145 GrowableArray<Method*>* prev_EMCP_methods); | 1143 GrowableArray<Method*>* prev_EMCP_methods); |
1146 ~PreviousVersionNode(); | 1144 ~PreviousVersionNode(); |
1147 ConstantPool* prev_constant_pool() const { | 1145 ConstantPool* prev_constant_pool() const { |
1148 return _prev_constant_pool; | 1146 return _prev_constant_pool; |
1149 } | 1147 } |
1150 GrowableArray<Method*>* prev_EMCP_methods() const { | 1148 GrowableArray<Method*>* prev_EMCP_methods() const { |
1151 return _prev_EMCP_methods; | 1149 return _prev_EMCP_methods; |
1152 } | 1150 } |
1153 }; | 1151 }; |
1154 | 1152 |
1155 | 1153 |
1156 // A Handle-ized version of PreviousVersionNode. | 1154 // Helper object for walking previous versions. |
1157 class PreviousVersionInfo : public ResourceObj { | |
1158 private: | |
1159 constantPoolHandle _prev_constant_pool_handle; | |
1160 // If the previous version of the InstanceKlass doesn't have any | |
1161 // EMCP methods, then _prev_EMCP_methods will be NULL. Since the | |
1162 // methods cannot be collected while we hold a handle, | |
1163 // _prev_EMCP_methods should never have a length of zero. | |
1164 GrowableArray<methodHandle>* _prev_EMCP_method_handles; | |
1165 | |
1166 public: | |
1167 PreviousVersionInfo(PreviousVersionNode *pv_node); | |
1168 ~PreviousVersionInfo(); | |
1169 constantPoolHandle prev_constant_pool_handle() const { | |
1170 return _prev_constant_pool_handle; | |
1171 } | |
1172 GrowableArray<methodHandle>* prev_EMCP_method_handles() const { | |
1173 return _prev_EMCP_method_handles; | |
1174 } | |
1175 }; | |
1176 | |
1177 | |
1178 // Helper object for walking previous versions. This helper cleans up | |
1179 // the Handles that it allocates when the helper object is destroyed. | |
1180 // The PreviousVersionInfo object returned by next_previous_version() | |
1181 // is only valid until a subsequent call to next_previous_version() or | |
1182 // the helper object is destroyed. | |
1183 class PreviousVersionWalker : public StackObj { | 1155 class PreviousVersionWalker : public StackObj { |
1184 private: | 1156 private: |
1157 Thread* _thread; | |
1185 GrowableArray<PreviousVersionNode *>* _previous_versions; | 1158 GrowableArray<PreviousVersionNode *>* _previous_versions; |
1186 int _current_index; | 1159 int _current_index; |
1187 // Fields for cleaning up when we are done walking the previous versions: | 1160 |
1188 // A HandleMark for the PreviousVersionInfo handles: | 1161 // A pointer to the current node object so we can handle the deletes. |
1189 HandleMark _hm; | 1162 PreviousVersionNode* _current_p; |
1190 | 1163 |
1191 // It would be nice to have a ResourceMark field in this helper also, | 1164 // The constant pool handle keeps all the methods in this class from being |
1192 // but the ResourceMark code says to be careful to delete handles held | 1165 // deallocated from the metaspace during class unloading. |
1193 // in GrowableArrays _before_ deleting the GrowableArray. Since we | 1166 constantPoolHandle _current_constant_pool_handle; |
1194 // can't guarantee the order in which the fields are destroyed, we | |
1195 // have to let the creator of the PreviousVersionWalker object do | |
1196 // the right thing. Also, adding a ResourceMark here causes an | |
1197 // include loop. | |
1198 | |
1199 // A pointer to the current info object so we can handle the deletes. | |
1200 PreviousVersionInfo * _current_p; | |
1201 | 1167 |
1202 public: | 1168 public: |
1203 PreviousVersionWalker(InstanceKlass *ik); | 1169 PreviousVersionWalker(Thread* thread, InstanceKlass *ik); |
1204 ~PreviousVersionWalker(); | |
1205 | 1170 |
1206 // Return the interesting information for the next previous version | 1171 // Return the interesting information for the next previous version |
1207 // of the klass. Returns NULL if there are no more previous versions. | 1172 // of the klass. Returns NULL if there are no more previous versions. |
1208 PreviousVersionInfo* next_previous_version(); | 1173 PreviousVersionNode* next_previous_version(); |
1209 }; | 1174 }; |
1210 | 1175 |
1211 | 1176 |
1212 // | 1177 // |
1213 // nmethodBucket is used to record dependent nmethods for | 1178 // nmethodBucket is used to record dependent nmethods for |