src/share/vm/ci/ciEnv.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File hotspot-comp Cdiff src/share/vm/ci/ciEnv.cpp

src/share/vm/ci/ciEnv.cpp

Print this page
rev 5618 : 8023037: Race between ciEnv::register_method and nmethod::make_not_entrant_or_zombie
Reviewed-by: ?

*** 999,1030 **** compiler, comp_level); // Free codeBlobs code_buffer->free_blob(); - // stress test 6243940 by immediately making the method - // non-entrant behind the system's back. This has serious - // side effects on the code cache and is not meant for - // general stress testing - if (nm != NULL && StressNonEntrant) { - MutexLockerEx pl(Patching_lock, Mutex::_no_safepoint_check_flag); - NativeJump::patch_verified_entry(nm->entry_point(), nm->verified_entry_point(), - SharedRuntime::get_handle_wrong_method_stub()); - } - if (nm == NULL) { // The CodeCache is full. Print out warning and disable compilation. record_failure("code cache is full"); { MutexUnlocker ml(Compile_lock); MutexUnlocker locker(MethodCompileQueue_lock); CompileBroker::handle_full_code_cache(); } } else { nm->set_has_unsafe_access(has_unsafe_access); nm->set_has_wide_vectors(has_wide_vectors); // Record successful registration. // (Put nm into the task handle *before* publishing to the Java heap.) if (task() != NULL) task()->set_code(nm); if (entry_bci == InvocationEntryBci) { --- 999,1025 ---- compiler, comp_level); // Free codeBlobs code_buffer->free_blob(); if (nm == NULL) { // The CodeCache is full. Print out warning and disable compilation. record_failure("code cache is full"); { MutexUnlocker ml(Compile_lock); MutexUnlocker locker(MethodCompileQueue_lock); CompileBroker::handle_full_code_cache(); } } else { + // Need to coordinate method registration with nmethod::make_not_entrant_or_zombie. + nmethodLocker nml(nm); + nm->set_has_unsafe_access(has_unsafe_access); nm->set_has_wide_vectors(has_wide_vectors); + // nmethod could be marked as non-entrant already. Don't install it then. + if (nm->is_in_use()) { // Record successful registration. // (Put nm into the task handle *before* publishing to the Java heap.) if (task() != NULL) task()->set_code(nm); if (entry_bci == InvocationEntryBci) {
*** 1038,1048 **** } if (old != NULL ) { old->make_not_entrant(); } } ! if (TraceNMethodInstalls ) { ResourceMark rm; char *method_name = method->name_and_sig_as_C_string(); ttyLocker ttyl; tty->print_cr("Installing method (%d) %s ", comp_level, --- 1033,1043 ---- } if (old != NULL ) { old->make_not_entrant(); } } ! if (TraceNMethodInstalls) { ResourceMark rm; char *method_name = method->name_and_sig_as_C_string(); ttyLocker ttyl; tty->print_cr("Installing method (%d) %s ", comp_level,
*** 1059,1077 **** comp_level, method_name, entry_bci); } method->method_holder()->add_osr_nmethod(nm); ! } } } // JVMTI -- compiled method notification (must be done outside lock) if (nm != NULL) { nm->post_compiled_method_load_event(); } - } // ------------------------------------------------------------------ // ciEnv::find_system_klass --- 1054,1071 ---- comp_level, method_name, entry_bci); } method->method_holder()->add_osr_nmethod(nm); ! } } } } // JVMTI -- compiled method notification (must be done outside lock) if (nm != NULL) { nm->post_compiled_method_load_event(); } } // ------------------------------------------------------------------ // ciEnv::find_system_klass
src/share/vm/ci/ciEnv.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File