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