# HG changeset patch # User never # Date 1455644998 28800 # Node ID 954c49c0ba57e2e9dd02ef83756d644e5f4455f8 # Parent fa6d92de1c70683366019a172dd30c33086ad41b 8149969: [JVMCI] PrintNMethods is ignored for CompilerToVM.installCode when not called from the broker Reviewed-by: kvn diff -r fa6d92de1c70 -r 954c49c0ba57 hotspot/src/share/vm/code/nmethod.cpp --- a/hotspot/src/share/vm/code/nmethod.cpp Mon Feb 15 23:45:15 2016 +0300 +++ b/hotspot/src/share/vm/code/nmethod.cpp Tue Feb 16 09:49:58 2016 -0800 @@ -33,6 +33,7 @@ #include "compiler/compileBroker.hpp" #include "compiler/compileLog.hpp" #include "compiler/compilerDirectives.hpp" +#include "compiler/directivesParser.hpp" #include "compiler/disassembler.hpp" #include "interpreter/bytecode.hpp" #include "oops/methodData.hpp" @@ -965,6 +966,12 @@ } } +void nmethod::maybe_print_nmethod(DirectiveSet* directive) { + bool printnmethods = directive->PrintAssemblyOption || directive->PrintNMethodsOption; + if (printnmethods || PrintDebugInfo || PrintRelocations || PrintDependencies || PrintExceptionHandlers) { + print_nmethod(printnmethods); + } +} void nmethod::print_nmethod(bool printmethod) { ttyLocker ttyl; // keep the following output all in one block diff -r fa6d92de1c70 -r 954c49c0ba57 hotspot/src/share/vm/code/nmethod.hpp --- a/hotspot/src/share/vm/code/nmethod.hpp Mon Feb 15 23:45:15 2016 +0300 +++ b/hotspot/src/share/vm/code/nmethod.hpp Tue Feb 16 09:49:58 2016 -0800 @@ -29,6 +29,8 @@ #include "code/pcDesc.hpp" #include "oops/metadata.hpp" +class DirectiveSet; + // This class is used internally by nmethods, to cache // exception/pc/handler information. @@ -714,6 +716,8 @@ void print_nul_chk_table() PRODUCT_RETURN; void print_recorded_oops() PRODUCT_RETURN; void print_recorded_metadata() PRODUCT_RETURN; + + void maybe_print_nmethod(DirectiveSet* directive); void print_nmethod(bool print_code); // need to re-define this from CodeBlob else the overload hides it diff -r fa6d92de1c70 -r 954c49c0ba57 hotspot/src/share/vm/compiler/compileBroker.cpp --- a/hotspot/src/share/vm/compiler/compileBroker.cpp Mon Feb 15 23:45:15 2016 +0300 +++ b/hotspot/src/share/vm/compiler/compileBroker.cpp Tue Feb 16 09:49:58 2016 -0800 @@ -1919,12 +1919,9 @@ collect_statistics(thread, time, task); - bool printnmethods = directive->PrintAssemblyOption || directive->PrintNMethodsOption; - if (printnmethods || PrintDebugInfo || PrintRelocations || PrintDependencies || PrintExceptionHandlers) { - nmethod* nm = task->code(); - if (nm != NULL) { - nm->print_nmethod(printnmethods); - } + nmethod* nm = task->code(); + if (nm != NULL) { + nm->maybe_print_nmethod(directive); } DirectivesStack::release(directive); diff -r fa6d92de1c70 -r 954c49c0ba57 hotspot/src/share/vm/jvmci/jvmciEnv.cpp --- a/hotspot/src/share/vm/jvmci/jvmciEnv.cpp Mon Feb 15 23:45:15 2016 +0300 +++ b/hotspot/src/share/vm/jvmci/jvmciEnv.cpp Tue Feb 16 09:49:58 2016 -0800 @@ -591,6 +591,13 @@ // JVMTI -- compiled method notification (must be done outside lock) if (nm != NULL) { nm->post_compiled_method_load_event(); + + if (env == NULL) { + // This compile didn't come through the CompileBroker so perform the printing here + DirectiveSet* directive = DirectivesStack::getMatchingDirective(method, compiler); + nm->maybe_print_nmethod(directive); + DirectivesStack::release(directive); + } } return result;