# HG changeset patch # User iveresov # Date 1409953185 25200 # Node ID 8cca7fbe77b8e2d4f5e20b22b67bbc4e76853d96 # Parent 522d6486f4104f494bbf10aefc37c1825e19dfd6 8056154: JVM crash with EXCEPTION_ACCESS_VIOLATION when there are many threads running Summary: Don't make compiled MH intrinsics not entrant when redefining classes Reviewed-by: kvn, vlivanov diff -r 522d6486f410 -r 8cca7fbe77b8 hotspot/src/share/vm/classfile/systemDictionary.cpp --- a/hotspot/src/share/vm/classfile/systemDictionary.cpp Fri Sep 05 11:23:47 2014 -0700 +++ b/hotspot/src/share/vm/classfile/systemDictionary.cpp Fri Sep 05 14:39:45 2014 -0700 @@ -2290,6 +2290,9 @@ } assert(spe != NULL && spe->method() != NULL, ""); + assert(!UseCompiler || (spe->method()->has_compiled_code() && + spe->method()->code()->entry_point() == spe->method()->from_compiled_entry()), + "MH intrinsic invariant"); return spe->method(); } diff -r 522d6486f410 -r 8cca7fbe77b8 hotspot/src/share/vm/code/codeCache.cpp --- a/hotspot/src/share/vm/code/codeCache.cpp Fri Sep 05 11:23:47 2014 -0700 +++ b/hotspot/src/share/vm/code/codeCache.cpp Fri Sep 05 14:39:45 2014 -0700 @@ -687,7 +687,9 @@ void CodeCache::mark_all_nmethods_for_deoptimization() { MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag); FOR_ALL_ALIVE_NMETHODS(nm) { - nm->mark_for_deoptimization(); + if (!nm->method()->is_method_handle_intrinsic()) { + nm->mark_for_deoptimization(); + } } } diff -r 522d6486f410 -r 8cca7fbe77b8 hotspot/src/share/vm/code/compiledIC.cpp --- a/hotspot/src/share/vm/code/compiledIC.cpp Fri Sep 05 11:23:47 2014 -0700 +++ b/hotspot/src/share/vm/code/compiledIC.cpp Fri Sep 05 14:39:45 2014 -0700 @@ -595,6 +595,7 @@ } else { // Callee is interpreted code. In any case entering the interpreter // puts a converter-frame on the stack to save arguments. + assert(!m->is_method_handle_intrinsic(), "Compiled code should never call interpreter MH intrinsics"); info._to_interpreter = true; info._entry = m()->get_c2i_entry(); } diff -r 522d6486f410 -r 8cca7fbe77b8 hotspot/src/share/vm/code/nmethod.hpp --- a/hotspot/src/share/vm/code/nmethod.hpp Fri Sep 05 11:23:47 2014 -0700 +++ b/hotspot/src/share/vm/code/nmethod.hpp Fri Sep 05 14:39:45 2014 -0700 @@ -448,7 +448,10 @@ // alive. It is used when an uncommon trap happens. Returns true // if this thread changed the state of the nmethod or false if // another thread performed the transition. - bool make_not_entrant() { return make_not_entrant_or_zombie(not_entrant); } + bool make_not_entrant() { + assert(!method()->is_method_handle_intrinsic(), "Cannot make MH intrinsic not entrant"); + return make_not_entrant_or_zombie(not_entrant); + } bool make_zombie() { return make_not_entrant_or_zombie(zombie); } // used by jvmti to track if the unload event has been reported