hotspot/src/share/vm/code/nmethod.cpp
changeset 22506 0759c126204d
parent 22223 82e95c562133
child 22872 b6902ee5bc8d
child 22796 bb0ea482a99e
equal deleted inserted replaced
22504:b1837533ba65 22506:0759c126204d
  2159     return NULL;
  2159     return NULL;
  2160   }
  2160   }
  2161 }
  2161 }
  2162 
  2162 
  2163 
  2163 
  2164 bool nmethod::check_all_dependencies() {
  2164 void nmethod::check_all_dependencies(DepChange& changes) {
  2165   bool found_check = false;
  2165   // Checked dependencies are allocated into this ResourceMark
  2166   // wholesale check of all dependencies
  2166   ResourceMark rm;
  2167   for (Dependencies::DepStream deps(this); deps.next(); ) {
  2167 
  2168     if (deps.check_dependency() != NULL) {
  2168   // Turn off dependency tracing while actually testing dependencies.
  2169       found_check = true;
  2169   NOT_PRODUCT( FlagSetting fs(TraceDependencies, false) );
  2170       NOT_DEBUG(break);
  2170 
  2171     }
  2171   // 'dep_signature_buffers' caches already checked dependencies.
  2172   }
  2172   DependencySignatureBuffer dep_signature_buffers;
  2173   return found_check;  // tell caller if we found anything
  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   }
  2174 }
  2199 }
  2175 
  2200 
  2176 bool nmethod::check_dependency_on(DepChange& changes) {
  2201 bool nmethod::check_dependency_on(DepChange& changes) {
  2177   // What has happened:
  2202   // What has happened:
  2178   // 1) a new class dependee has been added
  2203   // 1) a new class dependee has been added