src/hotspot/share/memory/metaspaceClosure.hpp
changeset 59070 22ee476cc664
parent 54927 1512d88b24c6
--- a/src/hotspot/share/memory/metaspaceClosure.hpp	Thu Nov 14 10:02:52 2019 +0800
+++ b/src/hotspot/share/memory/metaspaceClosure.hpp	Wed Nov 13 16:36:54 2019 -0800
@@ -75,6 +75,10 @@
     _default
   };
 
+  enum SpecialRef {
+    _method_entry_ref
+  };
+
   // class MetaspaceClosure::Ref --
   //
   // MetaspaceClosure can be viewed as a very simple type of copying garbage
@@ -278,6 +282,16 @@
   template <class T> void push(T** mpp, Writability w = _default) {
     push_impl(new ObjectRef<T>(mpp, w));
   }
+
+  template <class T> void push_method_entry(T** mpp, intptr_t* p) {
+    push_special(_method_entry_ref, new ObjectRef<T>(mpp, _default), (intptr_t*)p);
+  }
+
+  // This is for tagging special pointers that are not a reference to MetaspaceObj. It's currently
+  // used to mark the method entry points in Method/ConstMethod.
+  virtual void push_special(SpecialRef type, Ref* obj, intptr_t* p) {
+    assert(type == _method_entry_ref, "only special type allowed for now");
+  }
 };
 
 // This is a special MetaspaceClosure that visits each unique MetaspaceObj once.