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

src/share/vm/code/nmethod.cpp

Print this page




  22  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "code/codeCache.hpp"
  27 #include "code/compiledIC.hpp"
  28 #include "code/dependencies.hpp"
  29 #include "code/nmethod.hpp"
  30 #include "code/scopeDesc.hpp"
  31 #include "compiler/abstractCompiler.hpp"
  32 #include "compiler/compileBroker.hpp"
  33 #include "compiler/compileLog.hpp"
  34 #include "compiler/compilerOracle.hpp"
  35 #include "compiler/disassembler.hpp"
  36 #include "interpreter/bytecode.hpp"
  37 #include "oops/methodData.hpp"
  38 #include "prims/jvmtiRedefineClassesTrace.hpp"
  39 #include "prims/jvmtiImpl.hpp"
  40 #include "runtime/sharedRuntime.hpp"
  41 #include "runtime/sweeper.hpp"

  42 #include "utilities/dtrace.hpp"
  43 #include "utilities/events.hpp"
  44 #include "utilities/xmlstream.hpp"
  45 #ifdef SHARK
  46 #include "shark/sharkCompiler.hpp"
  47 #endif
  48 
  49 #ifdef DTRACE_ENABLED
  50 
  51 // Only bother with this argument setup if dtrace is available
  52 
  53 #define DTRACE_METHOD_UNLOAD_PROBE(method)                                \
  54   {                                                                       \
  55     Method* m = (method);                                                 \
  56     if (m != NULL) {                                                      \
  57       Symbol* klass_name = m->klass_name();                               \
  58       Symbol* name = m->name();                                           \
  59       Symbol* signature = m->signature();                                 \
  60       HOTSPOT_COMPILED_METHOD_UNLOAD(                                     \
  61         (char *) klass_name->bytes(), klass_name->utf8_length(),                   \


2118 #undef assert_LU_OK
2119 
2120   if (match_desc(upper, pc_offset, approximate)) {
2121     assert(upper == linear_search(this, pc_offset, approximate), "search ok");
2122     _pc_desc_cache.add_pc_desc(upper);
2123     return upper;
2124   } else {
2125     assert(NULL == linear_search(this, pc_offset, approximate), "search ok");
2126     return NULL;
2127   }
2128 }
2129 
2130 
2131 void nmethod::check_all_dependencies(DepChange& changes) {
2132   // Checked dependencies are allocated into this ResourceMark
2133   ResourceMark rm;
2134 
2135   // Turn off dependency tracing while actually testing dependencies.
2136   NOT_PRODUCT( FlagSetting fs(TraceDependencies, false) );
2137 
2138  GenericHashtable<DependencySignature, ResourceObj>* table = new GenericHashtable<DependencySignature, ResourceObj>(11027);




2139   // Iterate over live nmethods and check dependencies of all nmethods that are not
2140   // marked for deoptimization. A particular dependency is only checked once.
2141   for(nmethod* nm = CodeCache::alive_nmethod(CodeCache::first()); nm != NULL; nm = CodeCache::alive_nmethod(CodeCache::next(nm))) {
2142     if (!nm->is_marked_for_deoptimization()) {
2143       for (Dependencies::DepStream deps(nm); deps.next(); ) {
2144         // Construct abstraction of a dependency.
2145         DependencySignature* current_sig = new DependencySignature(deps);
2146         // Determine if 'deps' is already checked. table->add() returns
2147         // 'true' if the dependency was added (i.e., was not in the hashtable).
2148         if (table->add(current_sig)) {

2149           if (deps.check_dependency() != NULL) {
2150             // Dependency checking failed. Print out information about the failed
2151             // dependency and finally fail with an assert. We can fail here, since
2152             // dependency checking is never done in a product build.
2153             changes.print();
2154             nm->print();
2155             nm->print_dependencies();
2156             assert(false, "Should have been marked for deoptimization");
2157           }
2158         }
2159       }
2160     }
2161   }
2162 }
2163 
2164 bool nmethod::check_dependency_on(DepChange& changes) {
2165   // What has happened:
2166   // 1) a new class dependee has been added
2167   // 2) dependee and all its super classes have been marked
2168   bool found_check = false;  // set true if we are upset




  22  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "code/codeCache.hpp"
  27 #include "code/compiledIC.hpp"
  28 #include "code/dependencies.hpp"
  29 #include "code/nmethod.hpp"
  30 #include "code/scopeDesc.hpp"
  31 #include "compiler/abstractCompiler.hpp"
  32 #include "compiler/compileBroker.hpp"
  33 #include "compiler/compileLog.hpp"
  34 #include "compiler/compilerOracle.hpp"
  35 #include "compiler/disassembler.hpp"
  36 #include "interpreter/bytecode.hpp"
  37 #include "oops/methodData.hpp"
  38 #include "prims/jvmtiRedefineClassesTrace.hpp"
  39 #include "prims/jvmtiImpl.hpp"
  40 #include "runtime/sharedRuntime.hpp"
  41 #include "runtime/sweeper.hpp"
  42 #include "utilities/resourceHash.hpp"
  43 #include "utilities/dtrace.hpp"
  44 #include "utilities/events.hpp"
  45 #include "utilities/xmlstream.hpp"
  46 #ifdef SHARK
  47 #include "shark/sharkCompiler.hpp"
  48 #endif
  49 
  50 #ifdef DTRACE_ENABLED
  51 
  52 // Only bother with this argument setup if dtrace is available
  53 
  54 #define DTRACE_METHOD_UNLOAD_PROBE(method)                                \
  55   {                                                                       \
  56     Method* m = (method);                                                 \
  57     if (m != NULL) {                                                      \
  58       Symbol* klass_name = m->klass_name();                               \
  59       Symbol* name = m->name();                                           \
  60       Symbol* signature = m->signature();                                 \
  61       HOTSPOT_COMPILED_METHOD_UNLOAD(                                     \
  62         (char *) klass_name->bytes(), klass_name->utf8_length(),                   \


2119 #undef assert_LU_OK
2120 
2121   if (match_desc(upper, pc_offset, approximate)) {
2122     assert(upper == linear_search(this, pc_offset, approximate), "search ok");
2123     _pc_desc_cache.add_pc_desc(upper);
2124     return upper;
2125   } else {
2126     assert(NULL == linear_search(this, pc_offset, approximate), "search ok");
2127     return NULL;
2128   }
2129 }
2130 
2131 
2132 void nmethod::check_all_dependencies(DepChange& changes) {
2133   // Checked dependencies are allocated into this ResourceMark
2134   ResourceMark rm;
2135 
2136   // Turn off dependency tracing while actually testing dependencies.
2137   NOT_PRODUCT( FlagSetting fs(TraceDependencies, false) );
2138 
2139  typedef ResourceHashtable<DependencySignature, int, &DependencySignature::hash,
2140                                    &DependencySignature::equals, 11027> DepTable;
2141 
2142  DepTable* table = new DepTable();
2143 
2144   // Iterate over live nmethods and check dependencies of all nmethods that are not
2145   // marked for deoptimization. A particular dependency is only checked once.
2146   for(nmethod* nm = CodeCache::alive_nmethod(CodeCache::first()); nm != NULL; nm = CodeCache::alive_nmethod(CodeCache::next(nm))) {
2147     if (!nm->is_marked_for_deoptimization()) {
2148       for (Dependencies::DepStream deps(nm); deps.next(); ) {
2149         // Construct abstraction of a dependency.
2150         DependencySignature* current_sig = new DependencySignature(deps);
2151 
2152         // Determine if dependency is already checked. table->put(...) returns
2153         // 'true' if the dependency is added (i.e., was not in the hashtable).
2154         if (table->put(*current_sig, 1)) {
2155           if (deps.check_dependency() != NULL) {
2156             // Dependency checking failed. Print out information about the failed
2157             // dependency and finally fail with an assert. We can fail here, since
2158             // dependency checking is never done in a product build.
2159             changes.print();
2160             nm->print();
2161             nm->print_dependencies();
2162             assert(false, "Should have been marked for deoptimization");
2163           }
2164         }
2165       }
2166     }
2167   }
2168 }
2169 
2170 bool nmethod::check_dependency_on(DepChange& changes) {
2171   // What has happened:
2172   // 1) a new class dependee has been added
2173   // 2) dependee and all its super classes have been marked
2174   bool found_check = false;  // set true if we are upset


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