73 _writable, |
73 _writable, |
74 _not_writable, |
74 _not_writable, |
75 _default |
75 _default |
76 }; |
76 }; |
77 |
77 |
|
78 enum SpecialRef { |
|
79 _method_entry_ref |
|
80 }; |
|
81 |
78 // class MetaspaceClosure::Ref -- |
82 // class MetaspaceClosure::Ref -- |
79 // |
83 // |
80 // MetaspaceClosure can be viewed as a very simple type of copying garbage |
84 // MetaspaceClosure can be viewed as a very simple type of copying garbage |
81 // collector. For it to function properly, it requires each subclass of |
85 // collector. For it to function properly, it requires each subclass of |
82 // MetaspaceObj to provide two methods: |
86 // MetaspaceObj to provide two methods: |
276 // If the above function doesn't match (mpp is not an Array<> type), then |
280 // If the above function doesn't match (mpp is not an Array<> type), then |
277 // this will be matched by default. |
281 // this will be matched by default. |
278 template <class T> void push(T** mpp, Writability w = _default) { |
282 template <class T> void push(T** mpp, Writability w = _default) { |
279 push_impl(new ObjectRef<T>(mpp, w)); |
283 push_impl(new ObjectRef<T>(mpp, w)); |
280 } |
284 } |
|
285 |
|
286 template <class T> void push_method_entry(T** mpp, intptr_t* p) { |
|
287 push_special(_method_entry_ref, new ObjectRef<T>(mpp, _default), (intptr_t*)p); |
|
288 } |
|
289 |
|
290 // This is for tagging special pointers that are not a reference to MetaspaceObj. It's currently |
|
291 // used to mark the method entry points in Method/ConstMethod. |
|
292 virtual void push_special(SpecialRef type, Ref* obj, intptr_t* p) { |
|
293 assert(type == _method_entry_ref, "only special type allowed for now"); |
|
294 } |
281 }; |
295 }; |
282 |
296 |
283 // This is a special MetaspaceClosure that visits each unique MetaspaceObj once. |
297 // This is a special MetaspaceClosure that visits each unique MetaspaceObj once. |
284 class UniqueMetaspaceClosure : public MetaspaceClosure { |
298 class UniqueMetaspaceClosure : public MetaspaceClosure { |
285 static const int INITIAL_TABLE_SIZE = 15889; |
299 static const int INITIAL_TABLE_SIZE = 15889; |