src/share/vm/memory/universe.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File
*** old/src/share/vm/memory/universe.cpp	Fri Aug 12 04:58:58 2011
--- new/src/share/vm/memory/universe.cpp	Fri Aug 12 04:58:58 2011

*** 1175,1194 **** --- 1175,1225 ---- // CodeCache can only be updated by a thread_in_VM and they will all be // stopped dring the safepoint so CodeCache will be safe to update without // holding the CodeCache_lock. ! KlassDepChange changes(dependee); // Compute the dependent nmethods if (CodeCache::mark_for_deoptimization(changes) > 0) { // At least one nmethod has been marked for deoptimization VM_Deoptimize op; VMThread::execute(&op); } } + // Flushes compiled methods dependent on a particular CallSite + // instance when its target is different than the given MethodHandle. + void Universe::flush_dependents_on(Handle call_site, Handle method_handle) { + assert_lock_strong(Compile_lock); + + if (CodeCache::number_of_nmethods_with_dependencies() == 0) return; + + // CodeCache can only be updated by a thread_in_VM and they will all be + // stopped dring the safepoint so CodeCache will be safe to update without + // holding the CodeCache_lock. + + CallSiteDepChange changes(call_site(), method_handle()); + + // Compute the dependent nmethods that have a reference to a + // CallSite object. We use instanceKlass::mark_dependent_nmethod + // directly instead of CodeCache::mark_for_deoptimization because we + // want dependents on the class CallSite only not all classes in the + // ContextStream. + int marked = 0; + { + MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag); + instanceKlass* call_site_klass = instanceKlass::cast(SystemDictionary::CallSite_klass()); + marked = call_site_klass->mark_dependent_nmethods(changes); + } + if (marked > 0) { + // At least one nmethod has been marked for deoptimization + VM_Deoptimize op; + VMThread::execute(&op); + } + } + #ifdef HOTSWAP // Flushes compiled methods dependent on dependee in the evolutionary sense void Universe::flush_evol_dependents_on(instanceKlassHandle ev_k_h) { // --- Compile_lock is not held. However we are at a safepoint. assert_locked_or_safepoint(Compile_lock);

src/share/vm/memory/universe.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File