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

src/share/vm/code/nmethod.cpp

Print this page




2151 #undef assert_LU_OK
2152 
2153   if (match_desc(upper, pc_offset, approximate)) {
2154     assert(upper == linear_search(this, pc_offset, approximate), "search ok");
2155     _pc_desc_cache.add_pc_desc(upper);
2156     return upper;
2157   } else {
2158     assert(NULL == linear_search(this, pc_offset, approximate), "search ok");
2159     return NULL;
2160   }
2161 }
2162 
2163 
2164 void nmethod::check_all_dependencies(DepChange& changes) {
2165   // Checked dependencies are allocated into this ResourceMark
2166   ResourceMark rm;
2167 
2168   // Turn off dependency tracing while actually testing dependencies.
2169   NOT_PRODUCT( FlagSetting fs(TraceDependencies, false) );
2170 
2171   // 'dep_signature_buffers' caches already checked dependencies.
2172   DependencySignatureBuffer dep_signature_buffers;
2173 
2174   // Iterate over live nmethods and check dependencies of all nmethods that are not
2175   // marked for deoptimization. A particular dependency is only checked once.
2176   for(nmethod* nm = CodeCache::alive_nmethod(CodeCache::first()); nm != NULL; nm = CodeCache::alive_nmethod(CodeCache::next(nm))) {
2177     if (!nm->is_marked_for_deoptimization()) {
2178       for (Dependencies::DepStream deps(nm); deps.next(); ) {
2179         // Construct abstraction of a dependency.
2180         const DependencySignature* current_sig = new DependencySignature(deps);
2181         // Determine if 'deps' is already checked. If it is not checked,
2182         // 'add_if_missing()' adds the dependency signature and returns
2183         // false.
2184         if (!dep_signature_buffers.add_if_missing(*current_sig)) {
2185           if (deps.check_dependency() != NULL) {
2186             // Dependency checking failed. Print out information about the failed
2187             // dependency and finally fail with an assert. We can fail here, since
2188             // dependency checking is never done in a product build.
2189             ResourceMark rm;
2190             changes.print();
2191             nm->print();
2192             nm->print_dependencies();
2193             assert(false, "Should have been marked for deoptimization");
2194           }
2195         }
2196       }
2197     }
2198   }
2199 }
2200 
2201 bool nmethod::check_dependency_on(DepChange& changes) {
2202   // What has happened:
2203   // 1) a new class dependee has been added
2204   // 2) dependee and all its super classes have been marked
2205   bool found_check = false;  // set true if we are upset
2206   for (Dependencies::DepStream deps(this); deps.next(); ) {
2207     // Evaluate only relevant dependencies.
2208     if (deps.spot_check_dependency_at(changes) != NULL) {
2209       found_check = true;




2151 #undef assert_LU_OK
2152 
2153   if (match_desc(upper, pc_offset, approximate)) {
2154     assert(upper == linear_search(this, pc_offset, approximate), "search ok");
2155     _pc_desc_cache.add_pc_desc(upper);
2156     return upper;
2157   } else {
2158     assert(NULL == linear_search(this, pc_offset, approximate), "search ok");
2159     return NULL;
2160   }
2161 }
2162 
2163 
2164 void nmethod::check_all_dependencies(DepChange& changes) {
2165   // Checked dependencies are allocated into this ResourceMark
2166   ResourceMark rm;
2167 
2168   // Turn off dependency tracing while actually testing dependencies.
2169   NOT_PRODUCT( FlagSetting fs(TraceDependencies, false) );
2170 
2171   GenericHashtable<DependencySignature, ResourceObj>* table = new GenericHashtable<DependencySignature, ResourceObj>(11027, true);


2172   // Iterate over live nmethods and check dependencies of all nmethods that are not
2173   // marked for deoptimization. A particular dependency is only checked once.
2174   for(nmethod* nm = CodeCache::alive_nmethod(CodeCache::first()); nm != NULL; nm = CodeCache::alive_nmethod(CodeCache::next(nm))) {
2175     if (!nm->is_marked_for_deoptimization()) {
2176       for (Dependencies::DepStream deps(nm); deps.next(); ) {
2177         // Construct abstraction of a dependency.
2178         DependencySignature* current_sig = new DependencySignature(deps);
2179         // Determine if 'deps' is already checked. table->add() returns
2180         // 'true' if the dependency was added (i.e., was not in the hashtable). 
2181         if (table->add(current_sig)) {

2182           if (deps.check_dependency() != NULL) {
2183             // Dependency checking failed. Print out information about the failed
2184             // dependency and finally fail with an assert. We can fail here, since
2185             // dependency checking is never done in a product build.

2186             changes.print();
2187             nm->print();
2188             nm->print_dependencies();
2189             assert(false, "Should have been marked for deoptimization");
2190           }
2191         }
2192       }
2193     }
2194   }
2195 }
2196 
2197 bool nmethod::check_dependency_on(DepChange& changes) {
2198   // What has happened:
2199   // 1) a new class dependee has been added
2200   // 2) dependee and all its super classes have been marked
2201   bool found_check = false;  // set true if we are upset
2202   for (Dependencies::DepStream deps(this); deps.next(); ) {
2203     // Evaluate only relevant dependencies.
2204     if (deps.spot_check_dependency_at(changes) != NULL) {
2205       found_check = true;


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