Mercurial > hg > truffle
comparison src/share/vm/memory/universe.cpp @ 3852:fdb992d83a87
7071653: JSR 292: call site change notification should be pushed not pulled
Reviewed-by: kvn, never, bdelsart
author | twisti |
---|---|
date | Tue, 16 Aug 2011 04:14:05 -0700 |
parents | 6747fd0512e0 |
children | b27c72d69fd1 |
comparison
equal
deleted
inserted
replaced
3851:95134e034042 | 3852:fdb992d83a87 |
---|---|
1175 | 1175 |
1176 // CodeCache can only be updated by a thread_in_VM and they will all be | 1176 // CodeCache can only be updated by a thread_in_VM and they will all be |
1177 // stopped dring the safepoint so CodeCache will be safe to update without | 1177 // stopped dring the safepoint so CodeCache will be safe to update without |
1178 // holding the CodeCache_lock. | 1178 // holding the CodeCache_lock. |
1179 | 1179 |
1180 DepChange changes(dependee); | 1180 KlassDepChange changes(dependee); |
1181 | 1181 |
1182 // Compute the dependent nmethods | 1182 // Compute the dependent nmethods |
1183 if (CodeCache::mark_for_deoptimization(changes) > 0) { | 1183 if (CodeCache::mark_for_deoptimization(changes) > 0) { |
1184 // At least one nmethod has been marked for deoptimization | |
1185 VM_Deoptimize op; | |
1186 VMThread::execute(&op); | |
1187 } | |
1188 } | |
1189 | |
1190 // Flushes compiled methods dependent on a particular CallSite | |
1191 // instance when its target is different than the given MethodHandle. | |
1192 void Universe::flush_dependents_on(Handle call_site, Handle method_handle) { | |
1193 assert_lock_strong(Compile_lock); | |
1194 | |
1195 if (CodeCache::number_of_nmethods_with_dependencies() == 0) return; | |
1196 | |
1197 // CodeCache can only be updated by a thread_in_VM and they will all be | |
1198 // stopped dring the safepoint so CodeCache will be safe to update without | |
1199 // holding the CodeCache_lock. | |
1200 | |
1201 CallSiteDepChange changes(call_site(), method_handle()); | |
1202 | |
1203 // Compute the dependent nmethods that have a reference to a | |
1204 // CallSite object. We use instanceKlass::mark_dependent_nmethod | |
1205 // directly instead of CodeCache::mark_for_deoptimization because we | |
1206 // want dependents on the class CallSite only not all classes in the | |
1207 // ContextStream. | |
1208 int marked = 0; | |
1209 { | |
1210 MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag); | |
1211 instanceKlass* call_site_klass = instanceKlass::cast(SystemDictionary::CallSite_klass()); | |
1212 marked = call_site_klass->mark_dependent_nmethods(changes); | |
1213 } | |
1214 if (marked > 0) { | |
1184 // At least one nmethod has been marked for deoptimization | 1215 // At least one nmethod has been marked for deoptimization |
1185 VM_Deoptimize op; | 1216 VM_Deoptimize op; |
1186 VMThread::execute(&op); | 1217 VMThread::execute(&op); |
1187 } | 1218 } |
1188 } | 1219 } |