Mercurial > hg > truffle
comparison src/share/vm/ci/ciEnv.cpp @ 13071:e2509677809c
8023037: Race between ciEnv::register_method and nmethod::make_not_entrant_or_zombie
Reviewed-by: kvn, iveresov
author | vlivanov |
---|---|
date | Fri, 08 Nov 2013 01:13:11 -0800 |
parents | b8860472c377 |
children | 096c224171c4 938e1e64e28f |
comparison
equal
deleted
inserted
replaced
13047:be525e91f65b | 13071:e2509677809c |
---|---|
933 // To prevent compile queue updates. | 933 // To prevent compile queue updates. |
934 MutexLocker locker(MethodCompileQueue_lock, THREAD); | 934 MutexLocker locker(MethodCompileQueue_lock, THREAD); |
935 | 935 |
936 // Prevent SystemDictionary::add_to_hierarchy from running | 936 // Prevent SystemDictionary::add_to_hierarchy from running |
937 // and invalidating our dependencies until we install this method. | 937 // and invalidating our dependencies until we install this method. |
938 // No safepoints are allowed. Otherwise, class redefinition can occur in between. | |
938 MutexLocker ml(Compile_lock); | 939 MutexLocker ml(Compile_lock); |
940 No_Safepoint_Verifier nsv; | |
939 | 941 |
940 // Change in Jvmti state may invalidate compilation. | 942 // Change in Jvmti state may invalidate compilation. |
941 if (!failing() && | 943 if (!failing() && |
942 ( (!jvmti_can_hotswap_or_post_breakpoint() && | 944 ( (!jvmti_can_hotswap_or_post_breakpoint() && |
943 JvmtiExport::can_hotswap_or_post_breakpoint()) || | 945 JvmtiExport::can_hotswap_or_post_breakpoint()) || |
999 compiler, comp_level); | 1001 compiler, comp_level); |
1000 | 1002 |
1001 // Free codeBlobs | 1003 // Free codeBlobs |
1002 code_buffer->free_blob(); | 1004 code_buffer->free_blob(); |
1003 | 1005 |
1004 // stress test 6243940 by immediately making the method | |
1005 // non-entrant behind the system's back. This has serious | |
1006 // side effects on the code cache and is not meant for | |
1007 // general stress testing | |
1008 if (nm != NULL && StressNonEntrant) { | |
1009 MutexLockerEx pl(Patching_lock, Mutex::_no_safepoint_check_flag); | |
1010 NativeJump::patch_verified_entry(nm->entry_point(), nm->verified_entry_point(), | |
1011 SharedRuntime::get_handle_wrong_method_stub()); | |
1012 } | |
1013 | |
1014 if (nm == NULL) { | 1006 if (nm == NULL) { |
1015 // The CodeCache is full. Print out warning and disable compilation. | 1007 // The CodeCache is full. Print out warning and disable compilation. |
1016 record_failure("code cache is full"); | 1008 record_failure("code cache is full"); |
1017 { | 1009 { |
1018 MutexUnlocker ml(Compile_lock); | 1010 MutexUnlocker ml(Compile_lock); |
1034 if (TraceMethodReplacement && old != NULL) { | 1026 if (TraceMethodReplacement && old != NULL) { |
1035 ResourceMark rm; | 1027 ResourceMark rm; |
1036 char *method_name = method->name_and_sig_as_C_string(); | 1028 char *method_name = method->name_and_sig_as_C_string(); |
1037 tty->print_cr("Replacing method %s", method_name); | 1029 tty->print_cr("Replacing method %s", method_name); |
1038 } | 1030 } |
1039 if (old != NULL ) { | 1031 if (old != NULL) { |
1040 old->make_not_entrant(); | 1032 old->make_not_entrant(); |
1041 } | 1033 } |
1042 } | 1034 } |
1043 if (TraceNMethodInstalls ) { | 1035 if (TraceNMethodInstalls) { |
1044 ResourceMark rm; | 1036 ResourceMark rm; |
1045 char *method_name = method->name_and_sig_as_C_string(); | 1037 char *method_name = method->name_and_sig_as_C_string(); |
1046 ttyLocker ttyl; | 1038 ttyLocker ttyl; |
1047 tty->print_cr("Installing method (%d) %s ", | 1039 tty->print_cr("Installing method (%d) %s ", |
1048 comp_level, | 1040 comp_level, |
1049 method_name); | 1041 method_name); |
1050 } | 1042 } |
1051 // Allow the code to be executed | 1043 // Allow the code to be executed |
1052 method->set_code(method, nm); | 1044 method->set_code(method, nm); |
1053 } else { | 1045 } else { |
1054 if (TraceNMethodInstalls ) { | 1046 if (TraceNMethodInstalls) { |
1055 ResourceMark rm; | 1047 ResourceMark rm; |
1056 char *method_name = method->name_and_sig_as_C_string(); | 1048 char *method_name = method->name_and_sig_as_C_string(); |
1057 ttyLocker ttyl; | 1049 ttyLocker ttyl; |
1058 tty->print_cr("Installing osr method (%d) %s @ %d", | 1050 tty->print_cr("Installing osr method (%d) %s @ %d", |
1059 comp_level, | 1051 comp_level, |
1060 method_name, | 1052 method_name, |
1061 entry_bci); | 1053 entry_bci); |
1062 } | 1054 } |
1063 method->method_holder()->add_osr_nmethod(nm); | 1055 method->method_holder()->add_osr_nmethod(nm); |
1064 | |
1065 } | 1056 } |
1066 } | 1057 } |
1067 } | 1058 } |
1068 // JVMTI -- compiled method notification (must be done outside lock) | 1059 // JVMTI -- compiled method notification (must be done outside lock) |
1069 if (nm != NULL) { | 1060 if (nm != NULL) { |