--- old/src/share/vm/c1/c1_Compilation.hpp 2016-02-10 10:49:51.397356782 +0100 +++ new/src/share/vm/c1/c1_Compilation.hpp 2016-02-10 10:49:51.285356777 +0100 @@ -121,7 +121,7 @@ public: // creation Compilation(AbstractCompiler* compiler, ciEnv* env, ciMethod* method, - int osr_bci, BufferBlob* buffer_blob, DirectiveSet* directive); + int osr_bci, BufferBlob* buffer_blob); ~Compilation(); --- old/src/share/vm/c1/c1_Compiler.cpp 2016-02-10 10:49:51.397356782 +0100 +++ new/src/share/vm/c1/c1_Compiler.cpp 2016-02-10 10:49:51.289356778 +0100 @@ -240,7 +240,7 @@ return true; } -void Compiler::compile_method(ciEnv* env, ciMethod* method, int entry_bci, DirectiveSet* directive) { +void Compiler::compile_method(ciEnv* env, ciMethod* method, int entry_bci) { BufferBlob* buffer_blob = CompilerThread::current()->get_buffer_blob(); assert(buffer_blob != NULL, "Must exist"); // invoke compilation @@ -249,7 +249,7 @@ // of Compilation to occur before we release the any // competing compiler thread ResourceMark rm; - Compilation c(this, env, method, entry_bci, buffer_blob, directive); + Compilation c(this, env, method, entry_bci, buffer_blob); } } --- old/src/share/vm/compiler/compilerDirectives.cpp 2016-02-10 10:49:51.397356782 +0100 +++ new/src/share/vm/compiler/compilerDirectives.cpp 2016-02-10 10:49:51.285356777 +0100 @@ -104,6 +104,7 @@ // if any flag has been modified - set directive as enabled // unless it already has been explicitly set. if (!_modified[EnableIndex]) { + EnableOption = false; if (_inlinematchers != NULL) { EnableOption = true; return; @@ -118,6 +119,14 @@ } } +bool DirectiveSet::is_default_set() { + if (_directive != NULL) { + return _directive->is_default_directive(); + } else { + return false; + } +} + CompilerDirectives* CompilerDirectives::next() { return _next; } @@ -369,7 +378,8 @@ void DirectiveSet::print_inline(outputStream* st) { if (_inlinematchers == NULL) { - st->print_cr(" inline: -"); + st->print(" No inline rules in directive."); + CompilerOracle::print_inlinecommands(st); } else { st->print(" inline: "); _inlinematchers->print(st); @@ -441,10 +451,10 @@ const char* error_msg = NULL; _default_directives->add_match(str, error_msg); #ifdef COMPILER1 - _default_directives->_c1_store->EnableOption = true; + assert(_default_directives->_c1_store->EnableOption, "Default must be active"); #endif #ifdef COMPILER2 - _default_directives->_c2_store->EnableOption = true; + assert(_default_directives->_c2_store->EnableOption, "Default must be active"); #endif assert(error_msg == NULL, "Must succeed."); push(_default_directives); @@ -492,7 +502,7 @@ bool DirectivesStack::check_capacity(int request_size, outputStream* st) { if ((request_size + _depth) > CompilerDirectivesLimit) { - st->print_cr("Could not add %i more directives. Currently %i/%i directives.", request_size, _depth, CompilerDirectivesLimit); + st->print_cr("Could not add %i more directives. Currently %i of %i directives.", request_size, _depth, CompilerDirectivesLimit); return false; } return true; --- old/src/share/vm/compiler/compileBroker.cpp 2016-02-10 10:49:51.401356782 +0100 +++ new/src/share/vm/compiler/compileBroker.cpp 2016-02-10 10:49:51.289356778 +0100 @@ -1255,6 +1255,7 @@ tty->cr(); } method->set_not_compilable(comp_level, !quietly, "excluded by CompileCommand"); + return true; } return false; @@ -1472,7 +1473,9 @@ { // Must switch to native to allocate ci_env ThreadToNativeFromVM ttn(thread); - ciEnv ci_env(NULL, system_dictionary_modification_counter); + // Matching the default directive, we currently have no method to match. + DirectiveSet* directive = DirectivesStack::getDefaultDirective(CompileBroker::compiler(CompLevel_full_optimization)); + ciEnv ci_env(NULL, system_dictionary_modification_counter, directive); // Cache Jvmti state ci_env.cache_jvmti_state(); // Cache DTrace flags @@ -1486,6 +1489,7 @@ // Perform per-thread and global initializations comp->initialize(); } + DirectivesStack::release(directive); } if (comp->is_failed()) { @@ -1845,7 +1849,7 @@ NoHandleMark nhm; ThreadToNativeFromVM ttn(thread); - ciEnv ci_env(task, system_dictionary_modification_counter); + ciEnv ci_env(task, system_dictionary_modification_counter, directive); if (should_break) { ci_env.set_break_at_compile(true); } @@ -1875,7 +1879,7 @@ locker.wait(Mutex::_no_safepoint_check_flag); } } - comp->compile_method(&ci_env, target, osr_bci, directive); + comp->compile_method(&ci_env, target, osr_bci); } if (!ci_env.failing() && task->code() == NULL) { --- old/src/share/vm/ci/ciEnv.hpp 2016-02-10 10:49:51.433356784 +0100 +++ new/src/share/vm/ci/ciEnv.hpp 2016-02-10 10:49:51.305356778 +0100 @@ -31,6 +31,7 @@ #include "code/debugInfoRec.hpp" #include "code/dependencies.hpp" #include "code/exceptionHandlerTable.hpp" +#include "compiler/compilerDirectives.hpp" #include "compiler/oopMap.hpp" #include "runtime/thread.hpp" @@ -61,6 +62,7 @@ CompileTask* _task; // faster access to CompilerThread::task CompileLog* _log; // faster access to CompilerThread::log void* _compiler_data; // compiler-specific stuff, if any + DirectiveSet* _directive; char* _name_buffer; int _name_buffer_len; @@ -294,7 +296,7 @@ MethodCompilable_never }; - ciEnv(CompileTask* task, int system_dictionary_modification_counter); + ciEnv(CompileTask* task, int system_dictionary_modification_counter, DirectiveSet* set); // Used only during initialization of the ci ciEnv(Arena* arena); ~ciEnv(); @@ -352,6 +354,7 @@ // The compiler task which has created this env. // May be useful to find out compile_id, comp_level, etc. CompileTask* task() { return _task; } + DirectiveSet* directive() { return _directive; } // Handy forwards to the task: int comp_level(); // task()->comp_level() --- old/src/share/vm/compiler/abstractCompiler.hpp 2016-02-10 10:49:51.445356784 +0100 +++ new/src/share/vm/compiler/abstractCompiler.hpp 2016-02-10 10:49:51.337356780 +0100 @@ -177,7 +177,7 @@ void set_state (int state); void set_shut_down () { set_state(shut_down); } // Compilation entry point for methods - virtual void compile_method(ciEnv* env, ciMethod* target, int entry_bci, DirectiveSet* directive) { + virtual void compile_method(ciEnv* env, ciMethod* target, int entry_bci) { ShouldNotReachHere(); } --- old/src/share/vm/c1/c1_Compilation.cpp 2016-02-10 10:49:51.449356784 +0100 +++ new/src/share/vm/c1/c1_Compilation.cpp 2016-02-10 10:49:51.325356779 +0100 @@ -534,10 +534,10 @@ Compilation::Compilation(AbstractCompiler* compiler, ciEnv* env, ciMethod* method, - int osr_bci, BufferBlob* buffer_blob, DirectiveSet* directive) + int osr_bci, BufferBlob* buffer_blob) : _compiler(compiler) , _env(env) -, _directive(directive) +, _directive(env->directive()) , _log(env->log()) , _method(method) , _osr_bci(osr_bci) --- old/src/share/vm/ci/ciEnv.cpp 2016-02-10 10:49:51.453356784 +0100 +++ new/src/share/vm/ci/ciEnv.cpp 2016-02-10 10:49:51.325356779 +0100 @@ -88,7 +88,7 @@ // ------------------------------------------------------------------ // ciEnv::ciEnv -ciEnv::ciEnv(CompileTask* task, int system_dictionary_modification_counter) +ciEnv::ciEnv(CompileTask* task, int system_dictionary_modification_counter, DirectiveSet* directive) : _ciEnv_arena(mtCompiler) { VM_ENTRY_MARK; @@ -103,6 +103,7 @@ _compilable = MethodCompilable; _break_at_compile = false; _compiler_data = NULL; + _directive = directive; #ifndef PRODUCT assert(!firstEnv, "not initialized properly"); #endif /* !PRODUCT */ --- old/src/share/vm/c1/c1_Compiler.hpp 2016-02-10 10:49:51.509356787 +0100 +++ new/src/share/vm/c1/c1_Compiler.hpp 2016-02-10 10:49:51.393356782 +0100 @@ -51,7 +51,7 @@ virtual void initialize(); // Compilation entry point for methods - virtual void compile_method(ciEnv* env, ciMethod* target, int entry_bci, DirectiveSet* directive); + virtual void compile_method(ciEnv* env, ciMethod* target, int entry_bci); // Print compilation timers and statistics virtual void print_timers(); --- old/src/share/vm/compiler/compilerOracle.cpp 2016-02-10 10:49:51.509356787 +0100 +++ new/src/share/vm/compiler/compilerOracle.cpp 2016-02-10 10:49:51.397356782 +0100 @@ -294,6 +294,26 @@ lists[command]->match(method)); } +static void print_commandlist(OracleCommand command, outputStream* st) { + if (lists[command] != NULL) { + st->print(" %s: ", command_names[command]); + lists[command]->print_all(st); + st->cr(); + } +} + +void CompilerOracle::print_inlinecommands(outputStream* st) { + if (lists[InlineCommand] || lists[DontInlineCommand] || lists[ExcludeCommand] || lists[CompileOnlyCommand]) { + st->print_cr(" Following compile commands are in use: "); + } else { + st->cr(); + } + print_commandlist(InlineCommand, st); + print_commandlist(DontInlineCommand, st); + print_commandlist(ExcludeCommand, st); + print_commandlist(CompileOnlyCommand, st); +} + static void add_predicate(OracleCommand command, BasicMatcher* bm) { assert(command != OptionCommand, "must use add_option_string"); if (command == LogCommand && !LogCompilation && lists[LogCommand] == NULL) { --- old/src/share/vm/compiler/compilerOracle.hpp 2016-02-10 10:49:51.553356789 +0100 +++ new/src/share/vm/compiler/compilerOracle.hpp 2016-02-10 10:49:51.397356782 +0100 @@ -87,6 +87,9 @@ // Tells whether there are any methods to print for print_method_statistics() static bool should_print_methods(); + + // Print all patterns for a command + static void print_inlinecommands(outputStream* st); }; #endif // SHARE_VM_COMPILER_COMPILERORACLE_HPP --- old/src/share/vm/compiler/compilerDirectives.hpp 2016-02-10 10:49:51.553356789 +0100 +++ new/src/share/vm/compiler/compilerDirectives.hpp 2016-02-10 10:49:51.393356782 +0100 @@ -34,7 +34,7 @@ // Directives flag name, type, default value, compile command name #define compilerdirectives_common_flags(cflags) \ - cflags(Enable, bool, false, X) \ + cflags(Enable, bool, true, X) \ cflags(Exclude, bool, false, X) \ cflags(BreakAtExecute, bool, false, X) \ cflags(BreakAtCompile, bool, false, X) \ @@ -117,6 +117,7 @@ static DirectiveSet* clone(DirectiveSet const* src); bool is_intrinsic_disabled(methodHandle method); void finalize(outputStream* st); + bool is_default_set(); typedef enum { #define enum_of_flags(name, type, dvalue, cc_flag) name##Index, @@ -139,16 +140,19 @@ compilerdirectives_c2_flags(set_function_definition) compilerdirectives_c1_flags(set_function_definition) - void print_intx(outputStream* st, ccstr n, intx v, bool mod) { if (mod) { st->print("%s:" INTX_FORMAT " ", n, v); } } - void print_bool(outputStream* st, ccstr n, bool v, bool mod) { if (mod) { st->print("%s:%s ", n, v ? "true" : "false"); } } - void print_double(outputStream* st, ccstr n, double v, bool mod) { if (mod) { st->print("%s:%f ", n, v); } } - void print_ccstr(outputStream* st, ccstr n, ccstr v, bool mod) { if (mod) { st->print("%s:%s ", n, v); } } - void print_ccstrlist(outputStream* st, ccstr n, ccstr v, bool mod) { print_ccstr(st, n, v, mod); } - -void print(outputStream* st) { + void print_intx(outputStream* st, ccstr n, intx v, intx dvalue) { if (v != dvalue) st->print("*"); st->print("%s:" INTX_FORMAT " ", n, v); } + void print_bool(outputStream* st, ccstr n, bool v, bool dvalue) { if (v != dvalue) st->print("*"); st->print("%s:%s ", n, v ? "true" : "false"); } + void print_double(outputStream* st, ccstr n, double v, double dvalue) { if (v != dvalue) st->print("*"); st->print("%s:%f ", n, v); } + void print_ccstr(outputStream* st, ccstr n, ccstr v, ccstr dvalue) { if (strcmp(v, dvalue)) st->print("*"); st->print("%s:%s ", n, v); } + void print_ccstrlist(outputStream* st, ccstr n, ccstr v, ccstr dvalue) { print_ccstr(st, n, v, dvalue); } + + void print(outputStream* st) { + if (is_default_set()) { + st->print_cr(" default directive"); + } print_inline(st); st->print(" "); -#define print_function_definition(name, type, dvalue, cc_flag) print_##type(st, #name, this->name##Option, true);//(bool)_modified[name##Index]); +#define print_function_definition(name, type, dvalue, cc_flag) print_##type(st, #name, this->name##Option, dvalue); compilerdirectives_common_flags(print_function_definition) compilerdirectives_c2_flags(print_function_definition) compilerdirectives_c1_flags(print_function_definition) --- old/src/share/vm/jvmci/jvmciCompiler.cpp 2016-02-10 10:49:53.005356849 +0100 +++ new/src/share/vm/jvmci/jvmciCompiler.cpp 2016-02-10 10:49:52.885356844 +0100 @@ -205,7 +205,7 @@ } // Compilation entry point for methods -void JVMCICompiler::compile_method(ciEnv* env, ciMethod* target, int entry_bci, DirectiveSet* directive) { +void JVMCICompiler::compile_method(ciEnv* env, ciMethod* target, int entry_bci) { ShouldNotReachHere(); } --- old/src/share/vm/opto/c2compiler.cpp 2016-02-10 10:49:53.009356849 +0100 +++ new/src/share/vm/opto/c2compiler.cpp 2016-02-10 10:49:52.881356844 +0100 @@ -94,7 +94,7 @@ } } -void C2Compiler::compile_method(ciEnv* env, ciMethod* target, int entry_bci, DirectiveSet* directive) { +void C2Compiler::compile_method(ciEnv* env, ciMethod* target, int entry_bci) { assert(is_initialized(), "Compiler thread must be initialized"); bool subsume_loads = SubsumeLoads; @@ -103,7 +103,7 @@ while (!env->failing()) { // Attempt to compile while subsuming loads into machine instructions. - Compile C(env, this, target, entry_bci, subsume_loads, do_escape_analysis, eliminate_boxing, directive); + Compile C(env, this, target, entry_bci, subsume_loads, do_escape_analysis, eliminate_boxing); // Check result and retry if appropriate. if (C.failure_reason() != NULL) { --- old/src/share/vm/opto/runtime.cpp 2016-02-10 10:49:53.009356849 +0100 +++ new/src/share/vm/opto/runtime.cpp 2016-02-10 10:49:52.885356844 +0100 @@ -163,11 +163,9 @@ bool save_argument_registers, bool return_pc) { - // Matching the default directive, we currently have no method to match. - DirectiveSet* directive = DirectivesStack::getDefaultDirective(CompileBroker::compiler(CompLevel_full_optimization)); + ResourceMark rm; - Compile C( env, gen, C_function, name, is_fancy_jump, pass_tls, save_argument_registers, return_pc, directive); - DirectivesStack::release(directive); + Compile C( env, gen, C_function, name, is_fancy_jump, pass_tls, save_argument_registers, return_pc); return C.stub_entry_point(); } --- old/src/share/vm/opto/compile.cpp 2016-02-10 10:49:53.009356849 +0100 +++ new/src/share/vm/opto/compile.cpp 2016-02-10 10:49:52.881356844 +0100 @@ -625,10 +625,10 @@ Compile::Compile( ciEnv* ci_env, C2Compiler* compiler, ciMethod* target, int osr_bci, - bool subsume_loads, bool do_escape_analysis, bool eliminate_boxing, DirectiveSet* directive) + bool subsume_loads, bool do_escape_analysis, bool eliminate_boxing) : Phase(Compiler), _env(ci_env), - _directive(directive), + _directive(ci_env->directive()), _log(ci_env->log()), _compile_id(ci_env->compile_id()), _save_argument_registers(false), @@ -658,7 +658,7 @@ _dead_node_list(comp_arena()), _dead_node_count(0), #ifndef PRODUCT - _trace_opto_output(directive->TraceOptoOutputOption), + _trace_opto_output(ci_env->directive()->TraceOptoOutputOption), _in_dump_cnt(0), _printer(IdealGraphPrinter::printer()), #endif @@ -701,9 +701,9 @@ TraceTime t2(NULL, &_t_methodCompilation, CITime, false); #ifndef PRODUCT - bool print_opto_assembly = directive->PrintOptoAssemblyOption; + bool print_opto_assembly = _directive->PrintOptoAssemblyOption; if (!print_opto_assembly) { - bool print_assembly = directive->PrintAssemblyOption; + bool print_assembly = _directive->PrintAssemblyOption; if (print_assembly && !Disassembler::can_decode()) { tty->print_cr("PrintAssembly request changed to PrintOptoAssembly"); print_opto_assembly = true; @@ -712,12 +712,12 @@ set_print_assembly(print_opto_assembly); set_parsed_irreducible_loop(false); - if (directive->ReplayInlineOption) { + if (_directive->ReplayInlineOption) { _replay_inline_data = ciReplay::load_inline_data(method(), entry_bci(), ci_env->comp_level()); } #endif - set_print_inlining(directive->PrintInliningOption || PrintOptoInlining); - set_print_intrinsics(directive->PrintIntrinsicsOption); + set_print_inlining(_directive->PrintInliningOption || PrintOptoInlining); + set_print_intrinsics(_directive->PrintIntrinsicsOption); set_has_irreducible_loop(true); // conservative until build_loop_tree() reset it if (ProfileTraps RTM_OPT_ONLY( || UseRTMLocking )) { @@ -885,10 +885,10 @@ NOT_PRODUCT( verify_barriers(); ) // Dump compilation data to replay it. - if (directive->DumpReplayOption) { + if (_directive->DumpReplayOption) { env()->dump_replay_data(_compile_id); } - if (directive->DumpInlineOption && (ilt() != NULL)) { + if (_directive->DumpInlineOption && (ilt() != NULL)) { env()->dump_inline_data(_compile_id); } @@ -951,11 +951,10 @@ int is_fancy_jump, bool pass_tls, bool save_arg_registers, - bool return_pc, - DirectiveSet* directive) + bool return_pc) : Phase(Compiler), _env(ci_env), - _directive(directive), + _directive(ci_env->directive()), _log(ci_env->log()), _compile_id(0), _save_argument_registers(save_arg_registers), @@ -981,7 +980,7 @@ _java_calls(0), _inner_loops(0), #ifndef PRODUCT - _trace_opto_output(TraceOptoOutput), + _trace_opto_output(ci_env->directive()->TraceOptoOutputOption), _in_dump_cnt(0), _printer(NULL), #endif --- old/src/share/vm/jvmci/jvmciCompiler.hpp 2016-02-10 10:49:53.009356849 +0100 +++ new/src/share/vm/jvmci/jvmciCompiler.hpp 2016-02-10 10:49:52.881356844 +0100 @@ -71,7 +71,7 @@ void bootstrap(); // Compilation entry point for methods - virtual void compile_method(ciEnv* env, ciMethod* target, int entry_bci, DirectiveSet* directive); + virtual void compile_method(ciEnv* env, ciMethod* target, int entry_bci); void compile_method(const methodHandle& target, int entry_bci, JVMCIEnv* env); --- old/src/share/vm/opto/c2compiler.hpp 2016-02-10 10:49:53.017356850 +0100 +++ new/src/share/vm/opto/c2compiler.hpp 2016-02-10 10:49:52.885356844 +0100 @@ -41,8 +41,7 @@ // Compilation entry point for methods void compile_method(ciEnv* env, ciMethod* target, - int entry_bci, - DirectiveSet* directive); + int entry_bci); // sentinel value used to trigger backtracking in compile_method(). static const char* retry_no_subsuming_loads(); --- old/src/share/vm/utilities/vmError.cpp 2016-02-10 10:49:53.061356852 +0100 +++ new/src/share/vm/utilities/vmError.cpp 2016-02-10 10:49:52.937356846 +0100 @@ -524,13 +524,21 @@ if (_verbose && _thread && _thread->is_Compiler_thread()) { CompilerThread* t = (CompilerThread*)_thread; if (t->task()) { - st->cr(); st->print_cr("Current CompileTask:"); t->task()->print_line_on_error(st, buf, sizeof(buf)); st->cr(); } - } + if (t->env()) { + st->print_cr("Compiling with directive:"); + if (t->env()->directive()) { + t->env()->directive()->print(st); + } else { + st->print_cr("No directive found:"); + } + st->cr(); + } + } STEP(200, "(printing stack bounds)" ) --- old/src/share/vm/compiler/methodMatcher.hpp 2016-02-10 10:49:53.061356852 +0100 +++ new/src/share/vm/compiler/methodMatcher.hpp 2016-02-10 10:49:52.937356846 +0100 @@ -90,6 +90,7 @@ void print_all(outputStream* st) { print_base(st); if (_next != NULL) { + st->print(", "); _next->print_all(st); } } --- old/src/share/vm/shark/sharkCompiler.cpp 2016-02-10 10:49:53.069356852 +0100 +++ new/src/share/vm/shark/sharkCompiler.cpp 2016-02-10 10:49:52.941356846 +0100 @@ -145,8 +145,7 @@ void SharkCompiler::compile_method(ciEnv* env, ciMethod* target, - int entry_bci, - DirectiveSet* directive) { + int entry_bci) { assert(is_initialized(), "should be"); ResourceMark rm; const char *name = methodname( @@ -218,7 +217,7 @@ &inc_table, this, false, - directive(), + env->directive(), false); } --- old/src/share/vm/opto/compile.hpp 2016-02-10 10:49:53.069356852 +0100 +++ new/src/share/vm/opto/compile.hpp 2016-02-10 10:49:52.945356847 +0100 @@ -1130,7 +1130,7 @@ // continuation. Compile(ciEnv* ci_env, C2Compiler* compiler, ciMethod* target, int entry_bci, bool subsume_loads, bool do_escape_analysis, - bool eliminate_boxing, DirectiveSet* directive); + bool eliminate_boxing); // Second major entry point. From the TypeFunc signature, generate code // to pass arguments from the Java calling convention to the C calling @@ -1138,7 +1138,7 @@ Compile(ciEnv* ci_env, const TypeFunc *(*gen)(), address stub_function, const char *stub_name, int is_fancy_jump, bool pass_tls, - bool save_arg_registers, bool return_pc, DirectiveSet* directive); + bool save_arg_registers, bool return_pc); // From the TypeFunc signature, generate code to pass arguments // from Compiled calling convention to Interpreter's calling convention