1090 Universe::heap()->unregister_nmethod(this);
1091
1092 // Log the unloading.
1093 log_state_change();
1094
1095 #if INCLUDE_JVMCI
1096 // The method can only be unloaded after the pointer to the installed code
1097 // Java wrapper is no longer alive. Here we need to clear out this weak
1098 // reference to the dead object.
1099 maybe_invalidate_installed_code();
1100 #endif
1101
1102 // The Method* is gone at this point
1103 assert(_method == NULL, "Tautology");
1104
1105 set_osr_link(NULL);
1106 NMethodSweeper::report_state_change(this);
1107
1108 // The release is only needed for compile-time ordering, as accesses
1109 // into the nmethod after the store is not safe, due to the sweeper
1110 // being allowed to free it then, in the case of concurrent nmethod
1111 // unloading. Therefore, there is no need for acquire on the loader side.
1112 OrderAccess::release_store(&_state, (signed char)unloaded);
1113 }
1114
1115 void nmethod::invalidate_osr_method() {
1116 assert(_entry_bci != InvocationEntryBci, "wrong kind of nmethod");
1117 // Remove from list of active nmethods
1118 if (method() != NULL) {
1119 method()->method_holder()->remove_osr_nmethod(this);
1120 }
1121 }
1122
1123 void nmethod::log_state_change() const {
1124 if (LogCompilation) {
1125 if (xtty != NULL) {
1126 ttyLocker ttyl; // keep the following output all in one block
1127 if (_state == unloaded) {
1128 xtty->begin_elem("make_unloaded thread='" UINTX_FORMAT "'",
1129 os::current_thread_id());
1130 } else {
|
1090 Universe::heap()->unregister_nmethod(this);
1091
1092 // Log the unloading.
1093 log_state_change();
1094
1095 #if INCLUDE_JVMCI
1096 // The method can only be unloaded after the pointer to the installed code
1097 // Java wrapper is no longer alive. Here we need to clear out this weak
1098 // reference to the dead object.
1099 maybe_invalidate_installed_code();
1100 #endif
1101
1102 // The Method* is gone at this point
1103 assert(_method == NULL, "Tautology");
1104
1105 set_osr_link(NULL);
1106 NMethodSweeper::report_state_change(this);
1107
1108 // The release is only needed for compile-time ordering, as accesses
1109 // into the nmethod after the store is not safe, due to the sweeper
1110 // being allowed to free it when the store is observed, during
1111 // concurrent nmethod unloading. Therefore, there is no need for
1112 // acquire on the loader side.
1113 OrderAccess::release_store(&_state, (signed char)unloaded);
1114 }
1115
1116 void nmethod::invalidate_osr_method() {
1117 assert(_entry_bci != InvocationEntryBci, "wrong kind of nmethod");
1118 // Remove from list of active nmethods
1119 if (method() != NULL) {
1120 method()->method_holder()->remove_osr_nmethod(this);
1121 }
1122 }
1123
1124 void nmethod::log_state_change() const {
1125 if (LogCompilation) {
1126 if (xtty != NULL) {
1127 ttyLocker ttyl; // keep the following output all in one block
1128 if (_state == unloaded) {
1129 xtty->begin_elem("make_unloaded thread='" UINTX_FORMAT "'",
1130 os::current_thread_id());
1131 } else {
|
1828 assert(NULL == linear_search(search, pc_offset, approximate), "search ok");
1829 return NULL;
1830 }
1831 }
1832
1833
1834 void nmethod::check_all_dependencies(DepChange& changes) {
1835 // Checked dependencies are allocated into this ResourceMark
1836 ResourceMark rm;
1837
1838 // Turn off dependency tracing while actually testing dependencies.
1839 NOT_PRODUCT( FlagSetting fs(TraceDependencies, false) );
1840
1841 typedef ResourceHashtable<DependencySignature, int, &DependencySignature::hash,
1842 &DependencySignature::equals, 11027> DepTable;
1843
1844 DepTable* table = new DepTable();
1845
1846 // Iterate over live nmethods and check dependencies of all nmethods that are not
1847 // marked for deoptimization. A particular dependency is only checked once.
1848 NMethodIterator iter(true /* only_alive */, true /* only_not_unloading */);
1849 while(iter.next()) {
1850 nmethod* nm = iter.method();
1851 // Only notify for live nmethods
1852 if (!nm->is_marked_for_deoptimization()) {
1853 for (Dependencies::DepStream deps(nm); deps.next(); ) {
1854 // Construct abstraction of a dependency.
1855 DependencySignature* current_sig = new DependencySignature(deps);
1856
1857 // Determine if dependency is already checked. table->put(...) returns
1858 // 'true' if the dependency is added (i.e., was not in the hashtable).
1859 if (table->put(*current_sig, 1)) {
1860 if (deps.check_dependency() != NULL) {
1861 // Dependency checking failed. Print out information about the failed
1862 // dependency and finally fail with an assert. We can fail here, since
1863 // dependency checking is never done in a product build.
1864 tty->print_cr("Failed dependency:");
1865 changes.print();
1866 nm->print();
1867 nm->print_dependencies();
|
1829 assert(NULL == linear_search(search, pc_offset, approximate), "search ok");
1830 return NULL;
1831 }
1832 }
1833
1834
1835 void nmethod::check_all_dependencies(DepChange& changes) {
1836 // Checked dependencies are allocated into this ResourceMark
1837 ResourceMark rm;
1838
1839 // Turn off dependency tracing while actually testing dependencies.
1840 NOT_PRODUCT( FlagSetting fs(TraceDependencies, false) );
1841
1842 typedef ResourceHashtable<DependencySignature, int, &DependencySignature::hash,
1843 &DependencySignature::equals, 11027> DepTable;
1844
1845 DepTable* table = new DepTable();
1846
1847 // Iterate over live nmethods and check dependencies of all nmethods that are not
1848 // marked for deoptimization. A particular dependency is only checked once.
1849 NMethodIterator iter(NMethodIterator::only_alive_and_not_unloading);
1850 while(iter.next()) {
1851 nmethod* nm = iter.method();
1852 // Only notify for live nmethods
1853 if (!nm->is_marked_for_deoptimization()) {
1854 for (Dependencies::DepStream deps(nm); deps.next(); ) {
1855 // Construct abstraction of a dependency.
1856 DependencySignature* current_sig = new DependencySignature(deps);
1857
1858 // Determine if dependency is already checked. table->put(...) returns
1859 // 'true' if the dependency is added (i.e., was not in the hashtable).
1860 if (table->put(*current_sig, 1)) {
1861 if (deps.check_dependency() != NULL) {
1862 // Dependency checking failed. Print out information about the failed
1863 // dependency and finally fail with an assert. We can fail here, since
1864 // dependency checking is never done in a product build.
1865 tty->print_cr("Failed dependency:");
1866 changes.print();
1867 nm->print();
1868 nm->print_dependencies();
|