diff src/share/vm/oops/instanceKlass.cpp @ 20611:3c87c13918fb

8061817: Whitebox.deoptimizeMethod() does not deoptimize all OSR versions of method Summary: Fixed Whitebox.deoptimizeMethod() to deoptimize all OSR versions of the method. Reviewed-by: kvn, iignatyev
author thartmann
date Thu, 30 Oct 2014 13:03:30 +0100
parents 90257dfad6e3
children fe34c5ab0b35 d5b74c583ec1
line wrap: on
line diff
--- a/src/share/vm/oops/instanceKlass.cpp	Wed Nov 05 08:35:02 2014 +0000
+++ b/src/share/vm/oops/instanceKlass.cpp	Thu Oct 30 13:03:30 2014 +0100
@@ -2890,6 +2890,22 @@
   OsrList_lock->unlock();
 }
 
+int InstanceKlass::mark_osr_nmethods(const Method* m) {
+  // This is a short non-blocking critical region, so the no safepoint check is ok.
+  MutexLockerEx ml(OsrList_lock, Mutex::_no_safepoint_check_flag);
+  nmethod* osr = osr_nmethods_head();
+  int found = 0;
+  while (osr != NULL) {
+    assert(osr->is_osr_method(), "wrong kind of nmethod found in chain");
+    if (osr->method() == m) {
+      osr->mark_for_deoptimization();
+      found++;
+    }
+    osr = osr->osr_link();
+  }
+  return found;
+}
+
 nmethod* InstanceKlass::lookup_osr_nmethod(const Method* m, int bci, int comp_level, bool match_level) const {
   // This is a short non-blocking critical region, so the no safepoint check is ok.
   OsrList_lock->lock_without_safepoint_check();