1045 VM_Deoptimize op; |
1045 VM_Deoptimize op; |
1046 VMThread::execute(&op); |
1046 VMThread::execute(&op); |
1047 } |
1047 } |
1048 } |
1048 } |
1049 |
1049 |
1050 // Flushes compiled methods dependent on a particular CallSite |
|
1051 // instance when its target is different than the given MethodHandle. |
|
1052 void CodeCache::flush_dependents_on(Handle call_site, Handle method_handle) { |
|
1053 assert_lock_strong(Compile_lock); |
|
1054 |
|
1055 if (number_of_nmethods_with_dependencies() == 0) return; |
|
1056 |
|
1057 // CodeCache can only be updated by a thread_in_VM and they will all be |
|
1058 // stopped during the safepoint so CodeCache will be safe to update without |
|
1059 // holding the CodeCache_lock. |
|
1060 |
|
1061 CallSiteDepChange changes(call_site(), method_handle()); |
|
1062 |
|
1063 // Compute the dependent nmethods that have a reference to a |
|
1064 // CallSite object. We use InstanceKlass::mark_dependent_nmethod |
|
1065 // directly instead of CodeCache::mark_for_deoptimization because we |
|
1066 // want dependents on the call site class only not all classes in |
|
1067 // the ContextStream. |
|
1068 int marked = 0; |
|
1069 { |
|
1070 MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag); |
|
1071 InstanceKlass* ctxk = MethodHandles::get_call_site_context(call_site()); |
|
1072 if (ctxk == NULL) { |
|
1073 return; // No dependencies to invalidate yet. |
|
1074 } |
|
1075 marked = ctxk->mark_dependent_nmethods(changes); |
|
1076 } |
|
1077 if (marked > 0) { |
|
1078 // At least one nmethod has been marked for deoptimization |
|
1079 VM_Deoptimize op; |
|
1080 VMThread::execute(&op); |
|
1081 } |
|
1082 } |
|
1083 |
|
1084 #ifdef HOTSWAP |
1050 #ifdef HOTSWAP |
1085 // Flushes compiled methods dependent on dependee in the evolutionary sense |
1051 // Flushes compiled methods dependent on dependee in the evolutionary sense |
1086 void CodeCache::flush_evol_dependents_on(instanceKlassHandle ev_k_h) { |
1052 void CodeCache::flush_evol_dependents_on(instanceKlassHandle ev_k_h) { |
1087 // --- Compile_lock is not held. However we are at a safepoint. |
1053 // --- Compile_lock is not held. However we are at a safepoint. |
1088 assert_locked_or_safepoint(Compile_lock); |
1054 assert_locked_or_safepoint(Compile_lock); |