comparison src/share/vm/code/nmethod.cpp @ 14521:29ccc4cbabca

Merge
author Gilles Duboscq <duboscq@ssw.jku.at>
date Wed, 12 Mar 2014 13:30:08 +0100
parents cd22c8dbda4f d8041d695d19
children b6aa8c4972aa
comparison
equal deleted inserted replaced
14520:f84115370178 14521:29ccc4cbabca
51 51
52 #ifdef DTRACE_ENABLED 52 #ifdef DTRACE_ENABLED
53 53
54 // Only bother with this argument setup if dtrace is available 54 // Only bother with this argument setup if dtrace is available
55 55
56 #ifndef USDT2
57 HS_DTRACE_PROBE_DECL8(hotspot, compiled__method__load,
58 const char*, int, const char*, int, const char*, int, void*, size_t);
59
60 HS_DTRACE_PROBE_DECL6(hotspot, compiled__method__unload,
61 char*, int, char*, int, char*, int);
62
63 #define DTRACE_METHOD_UNLOAD_PROBE(method) \
64 { \
65 Method* m = (method); \
66 if (m != NULL) { \
67 Symbol* klass_name = m->klass_name(); \
68 Symbol* name = m->name(); \
69 Symbol* signature = m->signature(); \
70 HS_DTRACE_PROBE6(hotspot, compiled__method__unload, \
71 klass_name->bytes(), klass_name->utf8_length(), \
72 name->bytes(), name->utf8_length(), \
73 signature->bytes(), signature->utf8_length()); \
74 } \
75 }
76 #else /* USDT2 */
77 #define DTRACE_METHOD_UNLOAD_PROBE(method) \ 56 #define DTRACE_METHOD_UNLOAD_PROBE(method) \
78 { \ 57 { \
79 Method* m = (method); \ 58 Method* m = (method); \
80 if (m != NULL) { \ 59 if (m != NULL) { \
81 Symbol* klass_name = m->klass_name(); \ 60 Symbol* klass_name = m->klass_name(); \
85 (char *) klass_name->bytes(), klass_name->utf8_length(), \ 64 (char *) klass_name->bytes(), klass_name->utf8_length(), \
86 (char *) name->bytes(), name->utf8_length(), \ 65 (char *) name->bytes(), name->utf8_length(), \
87 (char *) signature->bytes(), signature->utf8_length()); \ 66 (char *) signature->bytes(), signature->utf8_length()); \
88 } \ 67 } \
89 } 68 }
90 #endif /* USDT2 */
91 69
92 #else // ndef DTRACE_ENABLED 70 #else // ndef DTRACE_ENABLED
93 71
94 #define DTRACE_METHOD_UNLOAD_PROBE(method) 72 #define DTRACE_METHOD_UNLOAD_PROBE(method)
95 73
673 651
674 // record this nmethod as dependent on this klass 652 // record this nmethod as dependent on this klass
675 InstanceKlass::cast(klass)->add_dependent_nmethod(nm); 653 InstanceKlass::cast(klass)->add_dependent_nmethod(nm);
676 } 654 }
677 NOT_PRODUCT(if (nm != NULL) note_java_nmethod(nm)); 655 NOT_PRODUCT(if (nm != NULL) note_java_nmethod(nm));
678 if (PrintAssembly) { 656 if (PrintAssembly || CompilerOracle::has_option_string(method, "PrintAssembly")) {
679 Disassembler::decode(nm); 657 Disassembler::decode(nm);
680 } 658 }
681 } 659 }
682 } 660 }
683 // Do verification and logging outside CodeCache_lock. 661 // Do verification and logging outside CodeCache_lock.
1620 // new method for install_code() path 1598 // new method for install_code() path
1621 // Transfer information from compilation to jvmti 1599 // Transfer information from compilation to jvmti
1622 void nmethod::post_compiled_method_load_event() { 1600 void nmethod::post_compiled_method_load_event() {
1623 1601
1624 Method* moop = method(); 1602 Method* moop = method();
1625 #ifndef USDT2
1626 HS_DTRACE_PROBE8(hotspot, compiled__method__load,
1627 moop->klass_name()->bytes(),
1628 moop->klass_name()->utf8_length(),
1629 moop->name()->bytes(),
1630 moop->name()->utf8_length(),
1631 moop->signature()->bytes(),
1632 moop->signature()->utf8_length(),
1633 insts_begin(), insts_size());
1634 #else /* USDT2 */
1635 HOTSPOT_COMPILED_METHOD_LOAD( 1603 HOTSPOT_COMPILED_METHOD_LOAD(
1636 (char *) moop->klass_name()->bytes(), 1604 (char *) moop->klass_name()->bytes(),
1637 moop->klass_name()->utf8_length(), 1605 moop->klass_name()->utf8_length(),
1638 (char *) moop->name()->bytes(), 1606 (char *) moop->name()->bytes(),
1639 moop->name()->utf8_length(), 1607 moop->name()->utf8_length(),
1640 (char *) moop->signature()->bytes(), 1608 (char *) moop->signature()->bytes(),
1641 moop->signature()->utf8_length(), 1609 moop->signature()->utf8_length(),
1642 insts_begin(), insts_size()); 1610 insts_begin(), insts_size());
1643 #endif /* USDT2 */
1644 1611
1645 if (JvmtiExport::should_post_compiled_method_load() || 1612 if (JvmtiExport::should_post_compiled_method_load() ||
1646 JvmtiExport::should_post_compiled_method_unload()) { 1613 JvmtiExport::should_post_compiled_method_unload()) {
1647 get_and_cache_jmethod_id(); 1614 get_and_cache_jmethod_id();
1648 } 1615 }
2291 return NULL; 2258 return NULL;
2292 } 2259 }
2293 } 2260 }
2294 2261
2295 2262
2296 bool nmethod::check_all_dependencies() { 2263 void nmethod::check_all_dependencies(DepChange& changes) {
2297 bool found_check = false; 2264 // Checked dependencies are allocated into this ResourceMark
2298 // wholesale check of all dependencies 2265 ResourceMark rm;
2299 for (Dependencies::DepStream deps(this); deps.next(); ) { 2266
2300 if (deps.check_dependency() != NULL) { 2267 // Turn off dependency tracing while actually testing dependencies.
2301 found_check = true; 2268 NOT_PRODUCT( FlagSetting fs(TraceDependencies, false) );
2302 NOT_DEBUG(break); 2269
2303 } 2270 GenericHashtable<DependencySignature, ResourceObj>* table = new GenericHashtable<DependencySignature, ResourceObj>(11027);
2304 } 2271 // Iterate over live nmethods and check dependencies of all nmethods that are not
2305 return found_check; // tell caller if we found anything 2272 // marked for deoptimization. A particular dependency is only checked once.
2273 for(nmethod* nm = CodeCache::alive_nmethod(CodeCache::first()); nm != NULL; nm = CodeCache::alive_nmethod(CodeCache::next(nm))) {
2274 if (!nm->is_marked_for_deoptimization()) {
2275 for (Dependencies::DepStream deps(nm); deps.next(); ) {
2276 // Construct abstraction of a dependency.
2277 DependencySignature* current_sig = new DependencySignature(deps);
2278 // Determine if 'deps' is already checked. table->add() returns
2279 // 'true' if the dependency was added (i.e., was not in the hashtable).
2280 if (table->add(current_sig)) {
2281 if (deps.check_dependency() != NULL) {
2282 // Dependency checking failed. Print out information about the failed
2283 // dependency and finally fail with an assert. We can fail here, since
2284 // dependency checking is never done in a product build.
2285 changes.print();
2286 nm->print();
2287 nm->print_dependencies();
2288 assert(false, "Should have been marked for deoptimization");
2289 }
2290 }
2291 }
2292 }
2293 }
2306 } 2294 }
2307 2295
2308 bool nmethod::check_dependency_on(DepChange& changes) { 2296 bool nmethod::check_dependency_on(DepChange& changes) {
2309 // What has happened: 2297 // What has happened:
2310 // 1) a new class dependee has been added 2298 // 1) a new class dependee has been added