Mercurial > hg > truffle
comparison src/share/vm/oops/instanceKlass.hpp @ 12287:0f37d1badced
Merge
author | dcubed |
---|---|
date | Fri, 20 Sep 2013 12:58:35 -0700 |
parents | b2e698d2276c 4f9a42c33738 |
children | cefad50507d8 3374b92de2d9 |
comparison
equal
deleted
inserted
replaced
12271:bf13c3da3d11 | 12287:0f37d1badced |
---|---|
1124 | 1124 |
1125 class BreakpointInfo; | 1125 class BreakpointInfo; |
1126 | 1126 |
1127 | 1127 |
1128 // A collection point for interesting information about the previous | 1128 // A collection point for interesting information about the previous |
1129 // version(s) of an InstanceKlass. This class uses weak references to | 1129 // version(s) of an InstanceKlass. A GrowableArray of PreviousVersionNodes |
1130 // the information so that the information may be collected as needed | 1130 // is attached to the InstanceKlass as needed. See PreviousVersionWalker below. |
1131 // by the system. If the information is shared, then a regular | |
1132 // reference must be used because a weak reference would be seen as | |
1133 // collectible. A GrowableArray of PreviousVersionNodes is attached | |
1134 // to the InstanceKlass as needed. See PreviousVersionWalker below. | |
1135 class PreviousVersionNode : public CHeapObj<mtClass> { | 1131 class PreviousVersionNode : public CHeapObj<mtClass> { |
1136 private: | 1132 private: |
1137 // A shared ConstantPool is never collected so we'll always have | 1133 ConstantPool* _prev_constant_pool; |
1138 // a reference to it so we can update items in the cache. We'll | |
1139 // have a weak reference to a non-shared ConstantPool until all | |
1140 // of the methods (EMCP or obsolete) have been collected; the | |
1141 // non-shared ConstantPool becomes collectible at that point. | |
1142 ConstantPool* _prev_constant_pool; // regular or weak reference | |
1143 bool _prev_cp_is_weak; // true if not a shared ConstantPool | |
1144 | 1134 |
1145 // If the previous version of the InstanceKlass doesn't have any | 1135 // If the previous version of the InstanceKlass doesn't have any |
1146 // 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 |
1147 // EMCP methods have been collected, then _prev_EMCP_methods can | 1137 // EMCP methods have been collected, then _prev_EMCP_methods can |
1148 // have a length of zero. | 1138 // have a length of zero. |
1149 GrowableArray<Method*>* _prev_EMCP_methods; | 1139 GrowableArray<Method*>* _prev_EMCP_methods; |
1150 | 1140 |
1151 public: | 1141 public: |
1152 PreviousVersionNode(ConstantPool* prev_constant_pool, bool prev_cp_is_weak, | 1142 PreviousVersionNode(ConstantPool* prev_constant_pool, |
1153 GrowableArray<Method*>* prev_EMCP_methods); | 1143 GrowableArray<Method*>* prev_EMCP_methods); |
1154 ~PreviousVersionNode(); | 1144 ~PreviousVersionNode(); |
1155 ConstantPool* prev_constant_pool() const { | 1145 ConstantPool* prev_constant_pool() const { |
1156 return _prev_constant_pool; | 1146 return _prev_constant_pool; |
1157 } | 1147 } |
1158 GrowableArray<Method*>* prev_EMCP_methods() const { | 1148 GrowableArray<Method*>* prev_EMCP_methods() const { |
1159 return _prev_EMCP_methods; | 1149 return _prev_EMCP_methods; |
1160 } | 1150 } |
1161 }; | 1151 }; |
1162 | 1152 |
1163 | 1153 |
1164 // A Handle-ized version of PreviousVersionNode. | 1154 // Helper object for walking previous versions. |
1165 class PreviousVersionInfo : public ResourceObj { | |
1166 private: | |
1167 constantPoolHandle _prev_constant_pool_handle; | |
1168 // If the previous version of the InstanceKlass doesn't have any | |
1169 // EMCP methods, then _prev_EMCP_methods will be NULL. Since the | |
1170 // methods cannot be collected while we hold a handle, | |
1171 // _prev_EMCP_methods should never have a length of zero. | |
1172 GrowableArray<methodHandle>* _prev_EMCP_method_handles; | |
1173 | |
1174 public: | |
1175 PreviousVersionInfo(PreviousVersionNode *pv_node); | |
1176 ~PreviousVersionInfo(); | |
1177 constantPoolHandle prev_constant_pool_handle() const { | |
1178 return _prev_constant_pool_handle; | |
1179 } | |
1180 GrowableArray<methodHandle>* prev_EMCP_method_handles() const { | |
1181 return _prev_EMCP_method_handles; | |
1182 } | |
1183 }; | |
1184 | |
1185 | |
1186 // Helper object for walking previous versions. This helper cleans up | |
1187 // the Handles that it allocates when the helper object is destroyed. | |
1188 // The PreviousVersionInfo object returned by next_previous_version() | |
1189 // is only valid until a subsequent call to next_previous_version() or | |
1190 // the helper object is destroyed. | |
1191 class PreviousVersionWalker : public StackObj { | 1155 class PreviousVersionWalker : public StackObj { |
1192 private: | 1156 private: |
1157 Thread* _thread; | |
1193 GrowableArray<PreviousVersionNode *>* _previous_versions; | 1158 GrowableArray<PreviousVersionNode *>* _previous_versions; |
1194 int _current_index; | 1159 int _current_index; |
1195 // Fields for cleaning up when we are done walking the previous versions: | 1160 |
1196 // A HandleMark for the PreviousVersionInfo handles: | 1161 // A pointer to the current node object so we can handle the deletes. |
1197 HandleMark _hm; | 1162 PreviousVersionNode* _current_p; |
1198 | 1163 |
1199 // 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 |
1200 // but the ResourceMark code says to be careful to delete handles held | 1165 // deallocated from the metaspace during class unloading. |
1201 // in GrowableArrays _before_ deleting the GrowableArray. Since we | 1166 constantPoolHandle _current_constant_pool_handle; |
1202 // can't guarantee the order in which the fields are destroyed, we | |
1203 // have to let the creator of the PreviousVersionWalker object do | |
1204 // the right thing. Also, adding a ResourceMark here causes an | |
1205 // include loop. | |
1206 | |
1207 // A pointer to the current info object so we can handle the deletes. | |
1208 PreviousVersionInfo * _current_p; | |
1209 | 1167 |
1210 public: | 1168 public: |
1211 PreviousVersionWalker(InstanceKlass *ik); | 1169 PreviousVersionWalker(Thread* thread, InstanceKlass *ik); |
1212 ~PreviousVersionWalker(); | |
1213 | 1170 |
1214 // Return the interesting information for the next previous version | 1171 // Return the interesting information for the next previous version |
1215 // 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. |
1216 PreviousVersionInfo* next_previous_version(); | 1173 PreviousVersionNode* next_previous_version(); |
1217 }; | 1174 }; |
1218 | 1175 |
1219 | 1176 |
1220 // | 1177 // |
1221 // nmethodBucket is used to record dependent nmethods for | 1178 // nmethodBucket is used to record dependent nmethods for |