changeset 46379:43ec76e10184

8178363: Incorrect check for nmethod re-registration in C1 Reviewed-by: stefank, rbackman
author pliden
date Wed, 12 Apr 2017 08:49:08 +0200
parents 4ccca1fdf627
children 4a51438196cf
files hotspot/src/share/vm/c1/c1_Runtime1.cpp
diffstat 1 files changed, 4 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/hotspot/src/share/vm/c1/c1_Runtime1.cpp	Wed Apr 12 01:31:36 2017 -0400
+++ b/hotspot/src/share/vm/c1/c1_Runtime1.cpp	Wed Apr 12 08:49:08 2017 +0200
@@ -1221,12 +1221,13 @@
 
   // If we are patching in a non-perm oop, make sure the nmethod
   // is on the right list.
-  if (ScavengeRootsInCode && ((mirror.not_null() && mirror()->is_scavengable()) ||
-                              (appendix.not_null() && appendix->is_scavengable()))) {
+  if (ScavengeRootsInCode) {
     MutexLockerEx ml_code (CodeCache_lock, Mutex::_no_safepoint_check_flag);
     nmethod* nm = CodeCache::find_nmethod(caller_frame.pc());
     guarantee(nm != NULL, "only nmethods can contain non-perm oops");
-    if (!nm->on_scavenge_root_list()) {
+    if (!nm->on_scavenge_root_list() &&
+        ((mirror.not_null() && mirror()->is_scavengable()) ||
+         (appendix.not_null() && appendix->is_scavengable()))) {
       CodeCache::add_scavenge_root_nmethod(nm);
     }