Mercurial > hg > truffle
comparison src/share/vm/code/nmethod.cpp @ 14518:d8041d695d19
Merged with jdk9/dev/hotspot changeset 3812c088b945
author | twisti |
---|---|
date | Tue, 11 Mar 2014 18:45:59 -0700 |
parents | 5a9afbf72714 b3fe59626fdc |
children | 29ccc4cbabca |
comparison
equal
deleted
inserted
replaced
14141:f97c5ec83832 | 14518:d8041d695d19 |
---|---|
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 |
677 | 655 |
678 // record this nmethod as dependent on this klass | 656 // record this nmethod as dependent on this klass |
679 InstanceKlass::cast(klass)->add_dependent_nmethod(nm); | 657 InstanceKlass::cast(klass)->add_dependent_nmethod(nm); |
680 } | 658 } |
681 NOT_PRODUCT(if (nm != NULL) note_java_nmethod(nm)); | 659 NOT_PRODUCT(if (nm != NULL) note_java_nmethod(nm)); |
682 if (PrintAssembly) { | 660 if (PrintAssembly || CompilerOracle::has_option_string(method, "PrintAssembly")) { |
683 Disassembler::decode(nm); | 661 Disassembler::decode(nm); |
684 } | 662 } |
685 } | 663 } |
686 } | 664 } |
687 // Do verification and logging outside CodeCache_lock. | 665 // Do verification and logging outside CodeCache_lock. |
1633 // new method for install_code() path | 1611 // new method for install_code() path |
1634 // Transfer information from compilation to jvmti | 1612 // Transfer information from compilation to jvmti |
1635 void nmethod::post_compiled_method_load_event() { | 1613 void nmethod::post_compiled_method_load_event() { |
1636 | 1614 |
1637 Method* moop = method(); | 1615 Method* moop = method(); |
1638 #ifndef USDT2 | |
1639 HS_DTRACE_PROBE8(hotspot, compiled__method__load, | |
1640 moop->klass_name()->bytes(), | |
1641 moop->klass_name()->utf8_length(), | |
1642 moop->name()->bytes(), | |
1643 moop->name()->utf8_length(), | |
1644 moop->signature()->bytes(), | |
1645 moop->signature()->utf8_length(), | |
1646 insts_begin(), insts_size()); | |
1647 #else /* USDT2 */ | |
1648 HOTSPOT_COMPILED_METHOD_LOAD( | 1616 HOTSPOT_COMPILED_METHOD_LOAD( |
1649 (char *) moop->klass_name()->bytes(), | 1617 (char *) moop->klass_name()->bytes(), |
1650 moop->klass_name()->utf8_length(), | 1618 moop->klass_name()->utf8_length(), |
1651 (char *) moop->name()->bytes(), | 1619 (char *) moop->name()->bytes(), |
1652 moop->name()->utf8_length(), | 1620 moop->name()->utf8_length(), |
1653 (char *) moop->signature()->bytes(), | 1621 (char *) moop->signature()->bytes(), |
1654 moop->signature()->utf8_length(), | 1622 moop->signature()->utf8_length(), |
1655 insts_begin(), insts_size()); | 1623 insts_begin(), insts_size()); |
1656 #endif /* USDT2 */ | |
1657 | 1624 |
1658 if (JvmtiExport::should_post_compiled_method_load() || | 1625 if (JvmtiExport::should_post_compiled_method_load() || |
1659 JvmtiExport::should_post_compiled_method_unload()) { | 1626 JvmtiExport::should_post_compiled_method_unload()) { |
1660 get_and_cache_jmethod_id(); | 1627 get_and_cache_jmethod_id(); |
1661 } | 1628 } |
2304 return NULL; | 2271 return NULL; |
2305 } | 2272 } |
2306 } | 2273 } |
2307 | 2274 |
2308 | 2275 |
2309 bool nmethod::check_all_dependencies() { | 2276 void nmethod::check_all_dependencies(DepChange& changes) { |
2310 bool found_check = false; | 2277 // Checked dependencies are allocated into this ResourceMark |
2311 // wholesale check of all dependencies | 2278 ResourceMark rm; |
2312 for (Dependencies::DepStream deps(this); deps.next(); ) { | 2279 |
2313 if (deps.check_dependency() != NULL) { | 2280 // Turn off dependency tracing while actually testing dependencies. |
2314 found_check = true; | 2281 NOT_PRODUCT( FlagSetting fs(TraceDependencies, false) ); |
2315 NOT_DEBUG(break); | 2282 |
2316 } | 2283 GenericHashtable<DependencySignature, ResourceObj>* table = new GenericHashtable<DependencySignature, ResourceObj>(11027); |
2317 } | 2284 // Iterate over live nmethods and check dependencies of all nmethods that are not |
2318 return found_check; // tell caller if we found anything | 2285 // marked for deoptimization. A particular dependency is only checked once. |
2286 for(nmethod* nm = CodeCache::alive_nmethod(CodeCache::first()); nm != NULL; nm = CodeCache::alive_nmethod(CodeCache::next(nm))) { | |
2287 if (!nm->is_marked_for_deoptimization()) { | |
2288 for (Dependencies::DepStream deps(nm); deps.next(); ) { | |
2289 // Construct abstraction of a dependency. | |
2290 DependencySignature* current_sig = new DependencySignature(deps); | |
2291 // Determine if 'deps' is already checked. table->add() returns | |
2292 // 'true' if the dependency was added (i.e., was not in the hashtable). | |
2293 if (table->add(current_sig)) { | |
2294 if (deps.check_dependency() != NULL) { | |
2295 // Dependency checking failed. Print out information about the failed | |
2296 // dependency and finally fail with an assert. We can fail here, since | |
2297 // dependency checking is never done in a product build. | |
2298 changes.print(); | |
2299 nm->print(); | |
2300 nm->print_dependencies(); | |
2301 assert(false, "Should have been marked for deoptimization"); | |
2302 } | |
2303 } | |
2304 } | |
2305 } | |
2306 } | |
2319 } | 2307 } |
2320 | 2308 |
2321 bool nmethod::check_dependency_on(DepChange& changes) { | 2309 bool nmethod::check_dependency_on(DepChange& changes) { |
2322 // What has happened: | 2310 // What has happened: |
2323 // 1) a new class dependee has been added | 2311 // 1) a new class dependee has been added |