diff -r 6bf8877eb1b9 -r 677cede5608e src/hotspot/share/c1/c1_Runtime1.cpp --- a/src/hotspot/share/c1/c1_Runtime1.cpp Tue Mar 12 15:42:32 2019 +0100 +++ b/src/hotspot/share/c1/c1_Runtime1.cpp Thu Mar 14 09:08:17 2019 +0100 @@ -1264,7 +1264,7 @@ // If we are patching in a non-perm oop, make sure the nmethod // is on the right list. - 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");