# HG changeset patch # User Tom Rodriguez # Date 1425930199 25200 # Node ID f8147c931ce437327b25940a80bd26f4a06bb2c7 # Parent f3eed864acdcc2e2469c93b75feb91bc850f8dbb Add PrintNMethodsAtLevel option to hotspot diff -r f3eed864acdc -r f8147c931ce4 src/share/vm/code/nmethod.cpp --- a/src/share/vm/code/nmethod.cpp Mon Mar 09 12:18:19 2015 -0700 +++ b/src/share/vm/code/nmethod.cpp Mon Mar 09 12:43:19 2015 -0700 @@ -856,7 +856,8 @@ CodeCache::commit(this); } - if (PrintNMethods || PrintDebugInfo || PrintRelocations || PrintDependencies) { + bool printnmethods = PrintNMethods || PrintNMethodsAtLevel == _comp_level; + if (printnmethods || PrintDebugInfo || PrintRelocations || PrintDependencies) { ttyLocker ttyl; // keep the following output all in one block // This output goes directly to the tty, not the compiler log. // To enable tools to match it up with the compilation activity, @@ -870,7 +871,7 @@ // print the header part first print(); // then print the requested information - if (PrintNMethods) { + if (printnmethods) { print_code(); } if (PrintRelocations) { @@ -1014,7 +1015,7 @@ " entry points must be same for static methods and vice versa"); } - bool printnmethods = PrintNMethods + bool printnmethods = PrintNMethods || PrintNMethodsAtLevel == _comp_level || CompilerOracle::should_print(_method) || CompilerOracle::has_option_string(_method, "PrintNMethods"); if (printnmethods || PrintDebugInfo || PrintRelocations || PrintDependencies || PrintExceptionHandlers) { diff -r f3eed864acdc -r f8147c931ce4 src/share/vm/runtime/globals.hpp --- a/src/share/vm/runtime/globals.hpp Mon Mar 09 12:18:19 2015 -0700 +++ b/src/share/vm/runtime/globals.hpp Mon Mar 09 12:43:19 2015 -0700 @@ -993,6 +993,9 @@ diagnostic(bool, PrintNMethods, false, \ "Print assembly code for nmethods when generated") \ \ + diagnostic(intx, PrintNMethodsAtLevel, -1, \ + "Only print code for nmethods at the given compilation level") \ + \ diagnostic(bool, PrintNativeNMethods, false, \ "Print assembly code for native nmethods when generated") \ \