src/share/vm/code/codeCache.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File JDK-7194669 Sdiff src/share/vm/code

src/share/vm/code/codeCache.cpp

Print this page




 611 #endif // PRODUCT
 612 
 613   int number_of_marked_CodeBlobs = 0;
 614 
 615   // search the hierarchy looking for nmethods which are affected by the loading of this class
 616 
 617   // then search the interfaces this class implements looking for nmethods
 618   // which might be dependent of the fact that an interface only had one
 619   // implementor.
 620 
 621   { No_Safepoint_Verifier nsv;
 622     for (DepChange::ContextStream str(changes, nsv); str.next(); ) {
 623       Klass* d = str.klass();
 624       number_of_marked_CodeBlobs += InstanceKlass::cast(d)->mark_dependent_nmethods(changes);
 625     }
 626   }
 627 
 628   if (VerifyDependencies) {
 629     // Turn off dependency tracing while actually testing deps.
 630     NOT_PRODUCT( FlagSetting fs(TraceDependencies, false) );







 631     FOR_ALL_ALIVE_NMETHODS(nm) {
 632       if (!nm->is_marked_for_deoptimization() &&
 633           nm->check_all_dependencies()) {












 634         ResourceMark rm;
 635         tty->print_cr("Should have been marked for deoptimization:");
 636         changes.print();
 637         nm->print();
 638         nm->print_dependencies();
 639       }





 640     }
 641   }
 642 
 643 #ifndef PRODUCT
 644   dependentCheckTime.stop();
 645 #endif // PRODUCT
 646 
 647   return number_of_marked_CodeBlobs;
 648 }
 649 
 650 
 651 #ifdef HOTSWAP
 652 int CodeCache::mark_for_evol_deoptimization(instanceKlassHandle dependee) {
 653   MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
 654   int number_of_marked_CodeBlobs = 0;
 655 
 656   // Deoptimize all methods of the evolving class itself
 657   Array<Method*>* old_methods = dependee->methods();
 658   for (int i = 0; i < old_methods->length(); i++) {
 659     ResourceMark rm;
 660     Method* old_method = old_methods->at(i);
 661     nmethod *nm = old_method->code();
 662     if (nm != NULL) {




 611 #endif // PRODUCT
 612 
 613   int number_of_marked_CodeBlobs = 0;
 614 
 615   // search the hierarchy looking for nmethods which are affected by the loading of this class
 616 
 617   // then search the interfaces this class implements looking for nmethods
 618   // which might be dependent of the fact that an interface only had one
 619   // implementor.
 620 
 621   { No_Safepoint_Verifier nsv;
 622     for (DepChange::ContextStream str(changes, nsv); str.next(); ) {
 623       Klass* d = str.klass();
 624       number_of_marked_CodeBlobs += InstanceKlass::cast(d)->mark_dependent_nmethods(changes);
 625     }
 626   }
 627 
 628   if (VerifyDependencies) {
 629     // Turn off dependency tracing while actually testing deps.
 630     NOT_PRODUCT( FlagSetting fs(TraceDependencies, false) );
 631 
 632     ResourceMark rm;
 633     // 'signature_buffers' is used to cache already checked dependencies.
 634     GrowableArray<DependencySignatureBuffer*>* dep_signature_buffers = new GrowableArray<DependencySignatureBuffer*>();
 635 
 636     // Iterate over live nmethods and check dependencies of all nmethods that are not
 637     // marked for deoptimization.
 638     FOR_ALL_ALIVE_NMETHODS(nm) {
 639       if (!nm->is_marked_for_deoptimization()) {
 640         for (Dependencies::DepStream deps(nm); deps.next(); ) {
 641           // Get dependency signature buffer for a specific dependency type signature
 642           DependencySignatureBuffer* buffer = DependencySignatureBuffer::buffer(dep_signature_buffers, deps.type());
 643           // A DependencySignature object abstracts a dependency.
 644           DependencySignature current_sig(&deps);
 645 
 646           // Check if the current dependency is already checked
 647           if (!buffer->contains(&current_sig)) {
 648             // If the dependency has not already been checked, perform the check and add the
 649             // current dependency signature to the checked dependency signatures.
 650 
 651             // Check dependency and print out an error if the dependency check fails.
 652             if (deps.check_dependency() != NULL) {
 653               ResourceMark rm;
 654               tty->print_cr("Should have been marked for deoptimization:");
 655               changes.print();
 656               nm->print();
 657               nm->print_dependencies();
 658             }
 659             // Add dependency signature to checked dependencies
 660             buffer->add(&current_sig);
 661           }
 662         }
 663       }
 664     }
 665   }

 666 #ifndef PRODUCT
 667   dependentCheckTime.stop();
 668 #endif // PRODUCT
 669 
 670   return number_of_marked_CodeBlobs;
 671 }
 672 
 673 
 674 #ifdef HOTSWAP
 675 int CodeCache::mark_for_evol_deoptimization(instanceKlassHandle dependee) {
 676   MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
 677   int number_of_marked_CodeBlobs = 0;
 678 
 679   // Deoptimize all methods of the evolving class itself
 680   Array<Method*>* old_methods = dependee->methods();
 681   for (int i = 0; i < old_methods->length(); i++) {
 682     ResourceMark rm;
 683     Method* old_method = old_methods->at(i);
 684     nmethod *nm = old_method->code();
 685     if (nm != NULL) {


src/share/vm/code/codeCache.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File