--- old/src/share/vm/c1/c1_Compilation.hpp 2016-01-21 11:16:26.117288190 +0100 +++ new/src/share/vm/c1/c1_Compilation.hpp 2016-01-21 11:16:25.981288185 +0100 @@ -120,7 +120,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-01-21 11:16:26.117288190 +0100 +++ new/src/share/vm/c1/c1_Compiler.cpp 2016-01-21 11:16:25.981288185 +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/jvmci/jvmciCompiler.cpp 2016-01-21 11:16:26.117288190 +0100 +++ new/src/share/vm/jvmci/jvmciCompiler.cpp 2016-01-21 11:16:25.981288185 +0100 @@ -191,7 +191,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/c1/c1_Compiler.hpp 2016-01-21 11:16:26.117288190 +0100 +++ new/src/share/vm/c1/c1_Compiler.hpp 2016-01-21 11:16:25.981288185 +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/abstractCompiler.hpp 2016-01-21 11:16:26.117288190 +0100 +++ new/src/share/vm/compiler/abstractCompiler.hpp 2016-01-21 11:16:25.981288185 +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/jvmci/jvmciCompiler.hpp 2016-01-21 11:16:26.125288191 +0100 +++ new/src/share/vm/jvmci/jvmciCompiler.hpp 2016-01-21 11:16:25.985288185 +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/ci/ciEnv.hpp 2016-01-21 11:16:26.129288191 +0100 +++ new/src/share/vm/ci/ciEnv.hpp 2016-01-21 11:16:25.985288185 +0100 @@ -63,6 +63,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; @@ -296,7 +297,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(); @@ -354,6 +355,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/opto/c2compiler.cpp 2016-01-21 11:16:26.133288191 +0100 +++ new/src/share/vm/opto/c2compiler.cpp 2016-01-21 11:16:25.985288185 +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/ci/ciEnv.cpp 2016-01-21 11:16:26.153288192 +0100 +++ new/src/share/vm/ci/ciEnv.cpp 2016-01-21 11:16:26.017288186 +0100 @@ -89,7 +89,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; @@ -104,6 +104,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_Compilation.cpp 2016-01-21 11:16:26.161288192 +0100 +++ new/src/share/vm/c1/c1_Compilation.cpp 2016-01-21 11:16:26.025288186 +0100 @@ -535,10 +535,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/opto/c2compiler.hpp 2016-01-21 11:16:26.181288193 +0100 +++ new/src/share/vm/opto/c2compiler.hpp 2016-01-21 11:16:26.045288187 +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/compiler/compileBroker.cpp 2016-01-21 11:16:26.181288193 +0100 +++ new/src/share/vm/compiler/compileBroker.cpp 2016-01-21 11:16:26.045288187 +0100 @@ -1249,6 +1249,7 @@ tty->cr(); } method->set_not_compilable(comp_level, !quietly, "excluded by CompileCommand"); + return true; } return false; @@ -1459,7 +1460,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 @@ -1473,6 +1476,7 @@ // Perform per-thread and global initializations comp->initialize(); } + DirectivesStack::release(directive); } if (comp->is_failed()) { @@ -1824,7 +1828,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); } @@ -1854,7 +1858,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/opto/compile.hpp 2016-01-21 11:16:26.545288208 +0100 +++ new/src/share/vm/opto/compile.hpp 2016-01-21 11:16:26.409288202 +0100 @@ -1116,7 +1116,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 @@ -1124,7 +1124,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 --- old/src/share/vm/opto/runtime.cpp 2016-01-21 11:16:26.557288209 +0100 +++ new/src/share/vm/opto/runtime.cpp 2016-01-21 11:16:26.421288203 +0100 @@ -162,11 +162,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-01-21 11:16:26.557288209 +0100 +++ new/src/share/vm/opto/compile.cpp 2016-01-21 11:16:26.413288203 +0100 @@ -617,10 +617,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), @@ -650,7 +650,7 @@ _dead_node_list(comp_arena()), _dead_node_count(0), #ifndef PRODUCT - _trace_opto_output(directive->TraceOptoOutputOption), + _trace_opto_output(_directive->TraceOptoOutputOption), _in_dump_cnt(0), _printer(IdealGraphPrinter::printer()), #endif @@ -693,9 +693,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; @@ -704,12 +704,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 )) { @@ -877,10 +877,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); } @@ -944,11 +944,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), --- old/src/share/vm/shark/sharkCompiler.cpp 2016-01-21 11:16:28.085288272 +0100 +++ new/src/share/vm/shark/sharkCompiler.cpp 2016-01-21 11:16:27.945288267 +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/utilities/vmError.cpp 2016-01-21 11:16:28.089288273 +0100 +++ new/src/share/vm/utilities/vmError.cpp 2016-01-21 11:16:27.953288267 +0100 @@ -518,13 +518,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("Current compiler directive:"); + if (t->env()->directive()) { + t->env()->directive()->print(st); + } else { + st->print_cr("No directive found:"); + } + st->cr(); + } + } STEP(200, "(printing stack bounds)" )