8220610: Make CollectedHeap nmethod functions pure virtual
authorstefank
Mon, 01 Apr 2019 18:34:39 +0200
changeset 54361 879051d3772a
parent 54360 6a4abdb6749c
child 54362 313e034d0bcb
8220610: Make CollectedHeap nmethod functions pure virtual Reviewed-by: shade
src/hotspot/share/gc/epsilon/epsilonHeap.hpp
src/hotspot/share/gc/g1/g1CollectedHeap.hpp
src/hotspot/share/gc/shared/collectedHeap.hpp
src/hotspot/share/gc/shenandoah/shenandoahHeap.hpp
--- a/src/hotspot/share/gc/epsilon/epsilonHeap.hpp	Mon Apr 01 08:21:45 2019 -0700
+++ b/src/hotspot/share/gc/epsilon/epsilonHeap.hpp	Mon Apr 01 18:34:39 2019 +0200
@@ -129,6 +129,12 @@
   virtual void print_gc_threads_on(outputStream* st) const {}
   virtual void gc_threads_do(ThreadClosure* tc) const {}
 
+  // No nmethod handling
+  virtual void register_nmethod(nmethod* nm) {}
+  virtual void unregister_nmethod(nmethod* nm) {}
+  virtual void flush_nmethod(nmethod* nm) {}
+  virtual void verify_nmethod(nmethod* nm) {}
+
   // No heap verification
   virtual void prepare_for_verify() {}
   virtual void verify(VerifyOption option) {}
--- a/src/hotspot/share/gc/g1/g1CollectedHeap.hpp	Mon Apr 01 08:21:45 2019 -0700
+++ b/src/hotspot/share/gc/g1/g1CollectedHeap.hpp	Mon Apr 01 18:34:39 2019 +0200
@@ -1322,6 +1322,12 @@
   // Unregister the given nmethod from the G1 heap.
   virtual void unregister_nmethod(nmethod* nm);
 
+  // No nmethod flushing needed.
+  virtual void flush_nmethod(nmethod* nm) {}
+
+  // No nmethod verification implemented.
+  virtual void verify_nmethod(nmethod* nm) {}
+
   // Free up superfluous code root memory.
   void purge_code_root_memory();
 
--- a/src/hotspot/share/gc/shared/collectedHeap.hpp	Mon Apr 01 08:21:45 2019 -0700
+++ b/src/hotspot/share/gc/shared/collectedHeap.hpp	Mon Apr 01 18:34:39 2019 +0200
@@ -510,11 +510,11 @@
   void print_heap_after_gc();
 
   // Registering and unregistering an nmethod (compiled code) with the heap.
-  // Override with specific mechanism for each specialized heap type.
-  virtual void register_nmethod(nmethod* nm) {}
-  virtual void unregister_nmethod(nmethod* nm) {}
-  virtual void flush_nmethod(nmethod* nm) {}
-  virtual void verify_nmethod(nmethod* nmethod) {}
+  virtual void register_nmethod(nmethod* nm) = 0;
+  virtual void unregister_nmethod(nmethod* nm) = 0;
+  // Callback for when nmethod is about to be deleted.
+  virtual void flush_nmethod(nmethod* nm) = 0;
+  virtual void verify_nmethod(nmethod* nm) = 0;
 
   void trace_heap_before_gc(const GCTracer* gc_tracer);
   void trace_heap_after_gc(const GCTracer* gc_tracer);
--- a/src/hotspot/share/gc/shenandoah/shenandoahHeap.hpp	Mon Apr 01 08:21:45 2019 -0700
+++ b/src/hotspot/share/gc/shenandoah/shenandoahHeap.hpp	Mon Apr 01 18:34:39 2019 +0200
@@ -584,6 +584,8 @@
 public:
   void register_nmethod(nmethod* nm);
   void unregister_nmethod(nmethod* nm);
+  void flush_nmethod(nmethod* nm) {}
+  void verify_nmethod(nmethod* nm) {}
 
 // ---------- Pinning hooks
 //