Mercurial > hg > truffle
comparison 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 |
comparison
equal
deleted
inserted
replaced
14141:f97c5ec83832 | 14518:d8041d695d19 |
---|---|
593 FOR_ALL_ALIVE_NMETHODS(nm) { | 593 FOR_ALL_ALIVE_NMETHODS(nm) { |
594 nm->clear_inline_caches(); | 594 nm->clear_inline_caches(); |
595 } | 595 } |
596 } | 596 } |
597 | 597 |
598 #ifndef PRODUCT | 598 // Keeps track of time spent for checking dependencies |
599 // used to keep track of how much time is spent in mark_for_deoptimization | 599 NOT_PRODUCT(static elapsedTimer dependentCheckTime;) |
600 static elapsedTimer dependentCheckTime; | |
601 static int dependentCheckCount = 0; | |
602 #endif // PRODUCT | |
603 | |
604 | 600 |
605 int CodeCache::mark_for_deoptimization(DepChange& changes) { | 601 int CodeCache::mark_for_deoptimization(DepChange& changes) { |
606 MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag); | 602 MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag); |
607 | |
608 #ifndef PRODUCT | |
609 dependentCheckTime.start(); | |
610 dependentCheckCount++; | |
611 #endif // PRODUCT | |
612 | |
613 int number_of_marked_CodeBlobs = 0; | 603 int number_of_marked_CodeBlobs = 0; |
614 | 604 |
615 // search the hierarchy looking for nmethods which are affected by the loading of this class | 605 // search the hierarchy looking for nmethods which are affected by the loading of this class |
616 | 606 |
617 // then search the interfaces this class implements looking for nmethods | 607 // then search the interfaces this class implements looking for nmethods |
618 // which might be dependent of the fact that an interface only had one | 608 // which might be dependent of the fact that an interface only had one |
619 // implementor. | 609 // implementor. |
620 | 610 // nmethod::check_all_dependencies works only correctly, if no safepoint |
621 { No_Safepoint_Verifier nsv; | 611 // can happen |
622 for (DepChange::ContextStream str(changes, nsv); str.next(); ) { | 612 No_Safepoint_Verifier nsv; |
623 Klass* d = str.klass(); | 613 for (DepChange::ContextStream str(changes, nsv); str.next(); ) { |
624 number_of_marked_CodeBlobs += InstanceKlass::cast(d)->mark_dependent_nmethods(changes); | 614 Klass* d = str.klass(); |
625 } | 615 number_of_marked_CodeBlobs += InstanceKlass::cast(d)->mark_dependent_nmethods(changes); |
626 } | 616 } |
627 | 617 |
618 #ifndef PRODUCT | |
628 if (VerifyDependencies) { | 619 if (VerifyDependencies) { |
629 // Turn off dependency tracing while actually testing deps. | 620 // Object pointers are used as unique identifiers for dependency arguments. This |
630 NOT_PRODUCT( FlagSetting fs(TraceDependencies, false) ); | 621 // is only possible if no safepoint, i.e., GC occurs during the verification code. |
631 FOR_ALL_ALIVE_NMETHODS(nm) { | 622 dependentCheckTime.start(); |
632 if (!nm->is_marked_for_deoptimization() && | 623 nmethod::check_all_dependencies(changes); |
633 nm->check_all_dependencies()) { | 624 dependentCheckTime.stop(); |
634 ResourceMark rm; | 625 } |
635 tty->print_cr("Should have been marked for deoptimization:"); | 626 #endif |
636 changes.print(); | |
637 nm->print(); | |
638 nm->print_dependencies(); | |
639 } | |
640 } | |
641 } | |
642 | |
643 #ifndef PRODUCT | |
644 dependentCheckTime.stop(); | |
645 #endif // PRODUCT | |
646 | 627 |
647 return number_of_marked_CodeBlobs; | 628 return number_of_marked_CodeBlobs; |
648 } | 629 } |
649 | 630 |
650 | 631 |
897 live.add(p); | 878 live.add(p); |
898 } | 879 } |
899 } | 880 } |
900 | 881 |
901 tty->print_cr("CodeCache:"); | 882 tty->print_cr("CodeCache:"); |
902 | 883 tty->print_cr("nmethod dependency checking time %fs", dependentCheckTime.seconds()); |
903 tty->print_cr("nmethod dependency checking time %f", dependentCheckTime.seconds(), | |
904 dependentCheckTime.seconds() / dependentCheckCount); | |
905 | 884 |
906 if (!live.is_empty()) { | 885 if (!live.is_empty()) { |
907 live.print("live"); | 886 live.print("live"); |
908 } | 887 } |
909 if (!dead.is_empty()) { | 888 if (!dead.is_empty()) { |