--- old/src/share/vm/c1/c1_Runtime1.cpp Thu Nov 6 14:06:44 2008 +++ new/src/share/vm/c1/c1_Runtime1.cpp Thu Nov 6 14:06:43 2008 @@ -842,6 +842,13 @@ if (TracePatching) { tty->print_cr("Deoptimizing for patching volatile field reference"); } + // It's possible the nmethod was invalidated in the last + // safepoint, but if it's still alive then make it not_entrant. + nmethod* nm = CodeCache::find_nmethod(caller_frame.pc()); + if (nm != NULL) { + nm->make_not_entrant(); + } + VM_DeoptimizeFrame deopt(thread, caller_frame.id()); VMThread::execute(&deopt);