diff -r e13ccc474a28 -r df859fcca515 hotspot/src/share/vm/code/nmethod.cpp --- a/hotspot/src/share/vm/code/nmethod.cpp Fri Mar 28 09:00:39 2008 -0700 +++ b/hotspot/src/share/vm/code/nmethod.cpp Wed Apr 02 12:09:59 2008 -0700 @@ -707,7 +707,9 @@ " entry points must be same for static methods and vice versa"); } - bool printnmethods = PrintNMethods || CompilerOracle::has_option_string(_method, "PrintNMethods"); + bool printnmethods = PrintNMethods + || CompilerOracle::should_print(_method) + || CompilerOracle::has_option_string(_method, "PrintNMethods"); if (printnmethods || PrintDebugInfo || PrintRelocations || PrintDependencies || PrintExceptionHandlers) { print_nmethod(printnmethods); } @@ -798,7 +800,6 @@ } -#ifndef PRODUCT void nmethod::print_nmethod(bool printmethod) { ttyLocker ttyl; // keep the following output all in one block if (xtty != NULL) { @@ -831,7 +832,6 @@ xtty->tail("print_nmethod"); } } -#endif void nmethod::set_version(int v) { @@ -1870,6 +1870,7 @@ } } +#endif // PRODUCT // Printing operations @@ -1948,6 +1949,14 @@ oops_size()); } +void nmethod::print_code() { + HandleMark hm; + ResourceMark m; + Disassembler::decode(this); +} + + +#ifndef PRODUCT void nmethod::print_scopes() { // Find the first pc desc for all scopes in the code and print it. @@ -1979,13 +1988,6 @@ } -void nmethod::print_code() { - HandleMark hm; - ResourceMark m; - Disassembler().decode(this); -} - - void nmethod::print_relocations() { ResourceMark m; // in case methods get printed via the debugger tty->print_cr("relocations:"); @@ -2021,6 +2023,7 @@ } } +#endif // PRODUCT const char* nmethod::reloc_string_for(u_char* begin, u_char* end) { RelocIterator iter(this, begin, end); @@ -2055,7 +2058,6 @@ return have_one ? "other" : NULL; } - // Return a the last scope in (begin..end] ScopeDesc* nmethod::scope_desc_in(address begin, address end) { PcDesc* p = pc_desc_near(begin+1); @@ -2078,29 +2080,26 @@ address pc = base + om->offset(); if (pc > begin) { if (pc <= end) { - st->fill_to(column); - if (st == tty) { - st->print("; OopMap "); - om->print(); - tty->cr(); - } else { - st->print_cr("; OopMap #%d offset:%d", i, om->offset()); - } + st->move_to(column); + st->print("; "); + om->print_on(st); } break; } } } + + // Print any debug info present at this pc. ScopeDesc* sd = scope_desc_in(begin, end); if (sd != NULL) { - st->fill_to(column); + st->move_to(column); if (sd->bci() == SynchronizationEntryBCI) { st->print(";*synchronization entry"); } else { if (sd->method().is_null()) { - tty->print("method is NULL"); + st->print("method is NULL"); } else if (sd->method()->is_native()) { - tty->print("method is native"); + st->print("method is native"); } else { address bcp = sd->method()->bcp_from(sd->bci()); Bytecodes::Code bc = Bytecodes::java_code_at(bcp); @@ -2137,13 +2136,13 @@ } } } - st->cr(); + // Print all scopes for (;sd != NULL; sd = sd->sender()) { - st->fill_to(column); + st->move_to(column); st->print("; -"); if (sd->method().is_null()) { - tty->print("method is NULL"); + st->print("method is NULL"); } else { sd->method()->print_short_name(st); } @@ -2161,17 +2160,19 @@ const char* str = reloc_string_for(begin, end); if (str != NULL) { if (sd != NULL) st->cr(); - st->fill_to(column); + st->move_to(column); st->print("; {%s}", str); } int cont_offset = ImplicitExceptionTable(this).at(begin - instructions_begin()); if (cont_offset != 0) { - st->fill_to(column); + st->move_to(column); st->print("; implicit exception: dispatches to " INTPTR_FORMAT, instructions_begin() + cont_offset); } } +#ifndef PRODUCT + void nmethod::print_value_on(outputStream* st) const { print_on(st, "nmethod"); }