Mercurial > hg > graal-compiler
diff src/share/vm/code/codeCache.cpp @ 14518:d8041d695d19
Merged with jdk9/dev/hotspot changeset 3812c088b945
author | twisti |
---|---|
date | Tue, 11 Mar 2014 18:45:59 -0700 |
parents | cefad50507d8 524b54a7f1b5 |
children | b51e29501f30 4ca6dc0799b6 |
line wrap: on
line diff
--- a/src/share/vm/code/codeCache.cpp Wed Mar 12 00:00:05 2014 +0100 +++ b/src/share/vm/code/codeCache.cpp Tue Mar 11 18:45:59 2014 -0700 @@ -595,21 +595,11 @@ } } -#ifndef PRODUCT -// used to keep track of how much time is spent in mark_for_deoptimization -static elapsedTimer dependentCheckTime; -static int dependentCheckCount = 0; -#endif // PRODUCT - +// Keeps track of time spent for checking dependencies +NOT_PRODUCT(static elapsedTimer dependentCheckTime;) int CodeCache::mark_for_deoptimization(DepChange& changes) { MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag); - -#ifndef PRODUCT - dependentCheckTime.start(); - dependentCheckCount++; -#endif // PRODUCT - int number_of_marked_CodeBlobs = 0; // search the hierarchy looking for nmethods which are affected by the loading of this class @@ -617,32 +607,23 @@ // then search the interfaces this class implements looking for nmethods // which might be dependent of the fact that an interface only had one // implementor. - - { No_Safepoint_Verifier nsv; - for (DepChange::ContextStream str(changes, nsv); str.next(); ) { - Klass* d = str.klass(); - number_of_marked_CodeBlobs += InstanceKlass::cast(d)->mark_dependent_nmethods(changes); - } - } - - if (VerifyDependencies) { - // Turn off dependency tracing while actually testing deps. - NOT_PRODUCT( FlagSetting fs(TraceDependencies, false) ); - FOR_ALL_ALIVE_NMETHODS(nm) { - if (!nm->is_marked_for_deoptimization() && - nm->check_all_dependencies()) { - ResourceMark rm; - tty->print_cr("Should have been marked for deoptimization:"); - changes.print(); - nm->print(); - nm->print_dependencies(); - } - } + // nmethod::check_all_dependencies works only correctly, if no safepoint + // can happen + No_Safepoint_Verifier nsv; + for (DepChange::ContextStream str(changes, nsv); str.next(); ) { + Klass* d = str.klass(); + number_of_marked_CodeBlobs += InstanceKlass::cast(d)->mark_dependent_nmethods(changes); } #ifndef PRODUCT - dependentCheckTime.stop(); -#endif // PRODUCT + if (VerifyDependencies) { + // Object pointers are used as unique identifiers for dependency arguments. This + // is only possible if no safepoint, i.e., GC occurs during the verification code. + dependentCheckTime.start(); + nmethod::check_all_dependencies(changes); + dependentCheckTime.stop(); + } +#endif return number_of_marked_CodeBlobs; } @@ -899,9 +880,7 @@ } tty->print_cr("CodeCache:"); - - tty->print_cr("nmethod dependency checking time %f", dependentCheckTime.seconds(), - dependentCheckTime.seconds() / dependentCheckCount); + tty->print_cr("nmethod dependency checking time %fs", dependentCheckTime.seconds()); if (!live.is_empty()) { live.print("live");