8220606: Move ScavengableNMethods unlinking to unregister_nmethod
authorstefank
Mon, 18 Mar 2019 15:19:39 +0100
changeset 54177 b4779a44476b
parent 54176 2786541e4f91
child 54178 98e21d4da074
8220606: Move ScavengableNMethods unlinking to unregister_nmethod Reviewed-by: pliden, eosterlund
src/hotspot/share/gc/parallel/parallelScavengeHeap.cpp
src/hotspot/share/gc/shared/genCollectedHeap.cpp
src/hotspot/share/gc/shared/scavengableNMethods.cpp
src/hotspot/share/gc/shared/scavengableNMethods.hpp
--- a/src/hotspot/share/gc/parallel/parallelScavengeHeap.cpp	Wed Mar 13 20:07:54 2019 +0100
+++ b/src/hotspot/share/gc/parallel/parallelScavengeHeap.cpp	Mon Mar 18 15:19:39 2019 +0100
@@ -717,7 +717,7 @@
 }
 
 void ParallelScavengeHeap::flush_nmethod(nmethod* nm) {
-  ScavengableNMethods::flush_nmethod(nm);
+  // nothing particular
 }
 
 void ParallelScavengeHeap::prune_nmethods() {
--- a/src/hotspot/share/gc/shared/genCollectedHeap.cpp	Wed Mar 13 20:07:54 2019 +0100
+++ b/src/hotspot/share/gc/shared/genCollectedHeap.cpp	Mon Mar 18 15:19:39 2019 +0100
@@ -723,7 +723,7 @@
 }
 
 void GenCollectedHeap::flush_nmethod(nmethod* nm) {
-  ScavengableNMethods::flush_nmethod(nm);
+  // Do nothing.
 }
 
 void GenCollectedHeap::prune_nmethods() {
--- a/src/hotspot/share/gc/shared/scavengableNMethods.cpp	Wed Mar 13 20:07:54 2019 +0100
+++ b/src/hotspot/share/gc/shared/scavengableNMethods.cpp	Mon Mar 18 15:19:39 2019 +0100
@@ -65,7 +65,19 @@
 }
 
 void ScavengableNMethods::unregister_nmethod(nmethod* nm) {
-  // Do nothing. Unlinking is currently delayed until the purge phase.
+  assert_locked_or_safepoint(CodeCache_lock);
+
+  if (gc_data(nm).on_list()) {
+    nmethod* prev = NULL;
+    for (nmethod* cur = _head; cur != NULL; cur = gc_data(cur).next()) {
+      if (cur == nm) {
+        CodeCache::print_trace("unregister_nmethod", nm);
+        unlist_nmethod(cur, prev);
+        return;
+      }
+      prev = cur;
+    }
+  }
 }
 
 #ifndef PRODUCT
@@ -112,23 +124,6 @@
 #endif // PRODUCT
 }
 
-void ScavengableNMethods::flush_nmethod(nmethod* nm) {
-  assert_locked_or_safepoint(CodeCache_lock);
-
-  // TODO: Should be done in unregister_nmethod, during the "unlink" phase.
-  if (gc_data(nm).on_list()) {
-    CodeCache::print_trace("flush_nmethod", nm);
-    nmethod* prev = NULL;
-    for (nmethod* cur = _head; cur != NULL; cur = gc_data(cur).next()) {
-      if (cur == nm) {
-        unlist_nmethod(cur, prev);
-        return;
-      }
-      prev = cur;
-    }
-  }
-}
-
 class HasScavengableOops: public OopClosure {
   BoolObjectClosure* _is_scavengable;
   bool               _found;
--- a/src/hotspot/share/gc/shared/scavengableNMethods.hpp	Wed Mar 13 20:07:54 2019 +0100
+++ b/src/hotspot/share/gc/shared/scavengableNMethods.hpp	Mon Mar 18 15:19:39 2019 +0100
@@ -45,7 +45,6 @@
   static void register_nmethod(nmethod* nm);
   static void unregister_nmethod(nmethod* nm);
   static void verify_nmethod(nmethod* nm);
-  static void flush_nmethod(nmethod* nm);
 
   static void prune_nmethods();