Mercurial > hg > graal-jvmci-8
diff src/share/vm/code/nmethod.cpp @ 8506:c3657d00e343
-Merge with tip
author | Christos Kotselidis <christos.kotselidis@oracle.com> |
---|---|
date | Thu, 21 Mar 2013 14:11:13 +0100 |
parents | 86b4965f0c9a 985a97ba083c |
children | b9a918201d47 |
line wrap: on
line diff
--- a/src/share/vm/code/nmethod.cpp Thu Mar 21 11:30:38 2013 +0100 +++ b/src/share/vm/code/nmethod.cpp Thu Mar 21 14:11:13 2013 +0100 @@ -42,8 +42,6 @@ #include "utilities/dtrace.hpp" #include "utilities/events.hpp" #include "utilities/xmlstream.hpp" -#include "utilities/debug.hpp" -#include "utilities/machineCodePrinter.hpp" #ifdef SHARK #include "shark/sharkCompiler.hpp" #endif @@ -126,6 +124,7 @@ // PrintC1Statistics, PrintOptoStatistics, LogVMOutput, and LogCompilation. // (In the latter two cases, they like other stats are printed to the log only.) +#ifndef PRODUCT // These variables are put into one block to reduce relocations // and make it simpler to print from the debugger. static @@ -215,6 +214,7 @@ pc_desc_tests, pc_desc_searches, pc_desc_adds); } } nmethod_stats; +#endif //PRODUCT //--------------------------------------------------------------------------------- @@ -490,6 +490,7 @@ _compiler = NULL; #ifdef GRAAL _graal_installed_code = NULL; + _triggered_deoptimizations = NULL; #endif #ifdef HAVE_DTRACE_H _trap_offset = 0; @@ -520,13 +521,9 @@ code_buffer, frame_size, basic_lock_owner_sp_offset, basic_lock_sp_offset, oop_maps); - if (nm != NULL) nmethod_stats.note_native_nmethod(nm); + NOT_PRODUCT(if (nm != NULL) nmethod_stats.note_native_nmethod(nm)); if (PrintAssembly && nm != NULL) Disassembler::decode(nm); - - if (PrintMachineCodeToFile) { - MachineCodePrinter::print(nm); - } } // verify nmethod debug_only(if (nm) nm->verify();) // might block @@ -558,7 +555,7 @@ nm = new (nmethod_size) nmethod(method(), nmethod_size, &offsets, code_buffer, frame_size); - if (nm != NULL) nmethod_stats.note_nmethod(nm); + NOT_PRODUCT(if (nm != NULL) nmethod_stats.note_nmethod(nm)); if (PrintAssembly && nm != NULL) Disassembler::decode(nm); } @@ -589,7 +586,8 @@ int comp_level, GrowableArray<jlong>* leaf_graph_ids #ifdef GRAAL - , Handle installed_code + , Handle installed_code, + Handle triggered_deoptimizations #endif ) { @@ -617,7 +615,8 @@ comp_level, leaf_graph_ids #ifdef GRAAL - , installed_code + , installed_code, + triggered_deoptimizations #endif ); if (nm != NULL) { @@ -637,13 +636,9 @@ InstanceKlass::cast(klass)->add_dependent_nmethod(nm); } } - if (nm != NULL) nmethod_stats.note_nmethod(nm); + NOT_PRODUCT(if (nm != NULL) nmethod_stats.note_nmethod(nm)); if (PrintAssembly && nm != NULL) Disassembler::decode(nm); - - if (nm != NULL && PrintMachineCodeToFile) { - MachineCodePrinter::print(nm); - } } // verify nmethod @@ -847,7 +842,8 @@ int comp_level, GrowableArray<jlong>* leaf_graph_ids #ifdef GRAAL - , Handle installed_code + , Handle installed_code, + Handle triggered_deoptimizations #endif ) : CodeBlob("nmethod", code_buffer, sizeof(nmethod), @@ -874,6 +870,7 @@ #ifdef GRAAL _graal_installed_code = installed_code(); + _triggered_deoptimizations = (typeArrayOop)triggered_deoptimizations(); #endif if (compiler->is_graal()) { // Graal might not produce any stub sections @@ -1693,8 +1690,16 @@ #ifdef GRAAL // Follow Graal method - if (_graal_installed_code != NULL && can_unload(is_alive, (oop*)&_graal_installed_code, unloading_occurred)) { - return; + if (_graal_installed_code != NULL) { + if (HotSpotInstalledCode::isDefault(_graal_installed_code)) { + if (!is_alive->do_object_b(_graal_installed_code)) { + _graal_installed_code = NULL; + } + } else { + if (can_unload(is_alive, (oop*)&_graal_installed_code, unloading_occurred)) { + return; + } + } } #endif @@ -1819,8 +1824,8 @@ // really alive. void nmethod::verify_metadata_loaders(address low_boundary, BoolObjectClosure* is_alive) { #ifdef ASSERT - RelocIterator iter(this, low_boundary); - while (iter.next()) { + RelocIterator iter(this, low_boundary); + while (iter.next()) { // static_stub_Relocations may have dangling references to // Method*s so trim them out here. Otherwise it looks like // compiled code is maintaining a link to dead metadata. @@ -1829,13 +1834,11 @@ CompiledIC* cic = CompiledIC_at(iter.reloc()); if (!cic->is_call_to_interpreted()) { static_call_addr = iter.addr(); - cic->set_to_clean(); } } else if (iter.type() == relocInfo::static_call_type) { CompiledStaticCall* csc = compiledStaticCall_at(iter.reloc()); if (!csc->is_call_to_interpreted()) { static_call_addr = iter.addr(); - csc->set_to_clean(); } } if (static_call_addr != NULL) { @@ -1923,6 +1926,9 @@ if (_graal_installed_code != NULL) { f->do_oop((oop*) &_graal_installed_code); } + if (_triggered_deoptimizations != NULL) { + f->do_oop((oop*) &_triggered_deoptimizations); + } #endif RelocIterator iter(this, low_boundary); @@ -2513,9 +2519,7 @@ // information in a table. break; } -#ifndef GRAAL assert(stub == NULL || stub_contains(stub), "static call stub outside stub section"); -#endif } } @@ -3007,8 +3011,6 @@ ImplicitExceptionTable(this).print(code_begin()); } -#endif // PRODUCT - void nmethod::print_statistics() { ttyLocker ttyl; if (xtty != NULL) xtty->head("statistics type='nmethod'"); @@ -3020,18 +3022,4 @@ if (xtty != NULL) xtty->tail("statistics"); } -#ifdef GRAAL -void DebugScopedNMethod::print_on(outputStream* st) { - if (_nm != NULL) { - st->print("nmethod@%p", _nm); - Method* method = _nm->method(); - if (method != NULL) { - char holder[O_BUFLEN]; - char nameAndSig[O_BUFLEN]; - method->method_holder()->name()->as_C_string(holder, O_BUFLEN); - method->name_and_sig_as_C_string(nameAndSig, O_BUFLEN); - st->print(" - %s::%s", holder, nameAndSig); - } - } -} -#endif +#endif // PRODUCT