7071653: JSR 292: call site change notification should be pushed not pulled

Reviewed-by: kvn, never, bdelsart
This commit is contained in:
Christian Thalinger 2011-08-16 04:14:05 -07:00
parent ac99f413d7
commit 134c40b4db
27 changed files with 906 additions and 526 deletions

View file

@ -1177,7 +1177,7 @@ void Universe::flush_dependents_on(instanceKlassHandle dependee) {
// stopped dring the safepoint so CodeCache will be safe to update without
// holding the CodeCache_lock.
DepChange changes(dependee);
KlassDepChange changes(dependee);
// Compute the dependent nmethods
if (CodeCache::mark_for_deoptimization(changes) > 0) {
@ -1187,6 +1187,37 @@ void Universe::flush_dependents_on(instanceKlassHandle dependee) {
}
}
// 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) {