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