Thu, 26 Sep 2013 08:48:15 +0200
Merge
1.1 --- a/src/cpu/sparc/vm/vtableStubs_sparc.cpp Wed Sep 25 13:03:21 2013 -0400 1.2 +++ b/src/cpu/sparc/vm/vtableStubs_sparc.cpp Thu Sep 26 08:48:15 2013 +0200 1.3 @@ -52,6 +52,11 @@ 1.4 VtableStub* VtableStubs::create_vtable_stub(int vtable_index) { 1.5 const int sparc_code_length = VtableStub::pd_code_size_limit(true); 1.6 VtableStub* s = new(sparc_code_length) VtableStub(true, vtable_index); 1.7 + // Can be NULL if there is no free space in the code cache. 1.8 + if (s == NULL) { 1.9 + return NULL; 1.10 + } 1.11 + 1.12 ResourceMark rm; 1.13 CodeBuffer cb(s->entry_point(), sparc_code_length); 1.14 MacroAssembler* masm = new MacroAssembler(&cb); 1.15 @@ -125,6 +130,11 @@ 1.16 VtableStub* VtableStubs::create_itable_stub(int itable_index) { 1.17 const int sparc_code_length = VtableStub::pd_code_size_limit(false); 1.18 VtableStub* s = new(sparc_code_length) VtableStub(false, itable_index); 1.19 + // Can be NULL if there is no free space in the code cache. 1.20 + if (s == NULL) { 1.21 + return NULL; 1.22 + } 1.23 + 1.24 ResourceMark rm; 1.25 CodeBuffer cb(s->entry_point(), sparc_code_length); 1.26 MacroAssembler* masm = new MacroAssembler(&cb);
2.1 --- a/src/cpu/x86/vm/vtableStubs_x86_32.cpp Wed Sep 25 13:03:21 2013 -0400 2.2 +++ b/src/cpu/x86/vm/vtableStubs_x86_32.cpp Thu Sep 26 08:48:15 2013 +0200 2.3 @@ -58,6 +58,11 @@ 2.4 VtableStub* VtableStubs::create_vtable_stub(int vtable_index) { 2.5 const int i486_code_length = VtableStub::pd_code_size_limit(true); 2.6 VtableStub* s = new(i486_code_length) VtableStub(true, vtable_index); 2.7 + // Can be NULL if there is no free space in the code cache. 2.8 + if (s == NULL) { 2.9 + return NULL; 2.10 + } 2.11 + 2.12 ResourceMark rm; 2.13 CodeBuffer cb(s->entry_point(), i486_code_length); 2.14 MacroAssembler* masm = new MacroAssembler(&cb); 2.15 @@ -132,6 +137,11 @@ 2.16 // add code here, bump the code stub size returned by pd_code_size_limit! 2.17 const int i486_code_length = VtableStub::pd_code_size_limit(false); 2.18 VtableStub* s = new(i486_code_length) VtableStub(false, itable_index); 2.19 + // Can be NULL if there is no free space in the code cache. 2.20 + if (s == NULL) { 2.21 + return NULL; 2.22 + } 2.23 + 2.24 ResourceMark rm; 2.25 CodeBuffer cb(s->entry_point(), i486_code_length); 2.26 MacroAssembler* masm = new MacroAssembler(&cb);
3.1 --- a/src/cpu/x86/vm/vtableStubs_x86_64.cpp Wed Sep 25 13:03:21 2013 -0400 3.2 +++ b/src/cpu/x86/vm/vtableStubs_x86_64.cpp Thu Sep 26 08:48:15 2013 +0200 3.3 @@ -49,6 +49,11 @@ 3.4 VtableStub* VtableStubs::create_vtable_stub(int vtable_index) { 3.5 const int amd64_code_length = VtableStub::pd_code_size_limit(true); 3.6 VtableStub* s = new(amd64_code_length) VtableStub(true, vtable_index); 3.7 + // Can be NULL if there is no free space in the code cache. 3.8 + if (s == NULL) { 3.9 + return NULL; 3.10 + } 3.11 + 3.12 ResourceMark rm; 3.13 CodeBuffer cb(s->entry_point(), amd64_code_length); 3.14 MacroAssembler* masm = new MacroAssembler(&cb); 3.15 @@ -126,6 +131,11 @@ 3.16 // returned by pd_code_size_limit! 3.17 const int amd64_code_length = VtableStub::pd_code_size_limit(false); 3.18 VtableStub* s = new(amd64_code_length) VtableStub(false, itable_index); 3.19 + // Can be NULL if there is no free space in the code cache. 3.20 + if (s == NULL) { 3.21 + return NULL; 3.22 + } 3.23 + 3.24 ResourceMark rm; 3.25 CodeBuffer cb(s->entry_point(), amd64_code_length); 3.26 MacroAssembler* masm = new MacroAssembler(&cb);
4.1 --- a/src/share/vm/c1/c1_GraphBuilder.cpp Wed Sep 25 13:03:21 2013 -0400 4.2 +++ b/src/share/vm/c1/c1_GraphBuilder.cpp Thu Sep 26 08:48:15 2013 +0200 4.3 @@ -4219,7 +4219,9 @@ 4.4 } 4.5 } 4.6 4.7 - if (!PrintInlining) return; 4.8 + if (!PrintInlining && !compilation()->method()->has_option("PrintInlining")) { 4.9 + return; 4.10 + } 4.11 CompileTask::print_inlining(callee, scope()->level(), bci(), msg); 4.12 if (success && CIPrintMethodCodes) { 4.13 callee->print_codes();
5.1 --- a/src/share/vm/code/compiledIC.cpp Wed Sep 25 13:03:21 2013 -0400 5.2 +++ b/src/share/vm/code/compiledIC.cpp Thu Sep 26 08:48:15 2013 +0200 5.3 @@ -160,7 +160,7 @@ 5.4 // High-level access to an inline cache. Guaranteed to be MT-safe. 5.5 5.6 5.7 -void CompiledIC::set_to_megamorphic(CallInfo* call_info, Bytecodes::Code bytecode, TRAPS) { 5.8 +bool CompiledIC::set_to_megamorphic(CallInfo* call_info, Bytecodes::Code bytecode, TRAPS) { 5.9 assert(CompiledIC_lock->is_locked() || SafepointSynchronize::is_at_safepoint(), ""); 5.10 assert(!is_optimized(), "cannot set an optimized virtual call to megamorphic"); 5.11 assert(is_call_to_compiled() || is_call_to_interpreted(), "going directly to megamorphic?"); 5.12 @@ -170,8 +170,10 @@ 5.13 assert(bytecode == Bytecodes::_invokeinterface, ""); 5.14 int itable_index = call_info->itable_index(); 5.15 entry = VtableStubs::find_itable_stub(itable_index); 5.16 + if (entry == false) { 5.17 + return false; 5.18 + } 5.19 #ifdef ASSERT 5.20 - assert(entry != NULL, "entry not computed"); 5.21 int index = call_info->resolved_method()->itable_index(); 5.22 assert(index == itable_index, "CallInfo pre-computes this"); 5.23 #endif //ASSERT 5.24 @@ -184,6 +186,9 @@ 5.25 int vtable_index = call_info->vtable_index(); 5.26 assert(call_info->resolved_klass()->verify_vtable_index(vtable_index), "sanity check"); 5.27 entry = VtableStubs::find_vtable_stub(vtable_index); 5.28 + if (entry == NULL) { 5.29 + return false; 5.30 + } 5.31 InlineCacheBuffer::create_transition_stub(this, NULL, entry); 5.32 } 5.33 5.34 @@ -200,6 +205,7 @@ 5.35 // race because the IC entry was complete when we safepointed so 5.36 // cleaning it immediately is harmless. 5.37 // assert(is_megamorphic(), "sanity check"); 5.38 + return true; 5.39 } 5.40 5.41
6.1 --- a/src/share/vm/code/compiledIC.hpp Wed Sep 25 13:03:21 2013 -0400 6.2 +++ b/src/share/vm/code/compiledIC.hpp Thu Sep 26 08:48:15 2013 +0200 6.3 @@ -226,7 +226,10 @@ 6.4 // 6.5 void set_to_clean(); // Can only be called during a safepoint operation 6.6 void set_to_monomorphic(CompiledICInfo& info); 6.7 - void set_to_megamorphic(CallInfo* call_info, Bytecodes::Code bytecode, TRAPS); 6.8 + 6.9 + // Returns true if successful and false otherwise. The call can fail if memory 6.10 + // allocation in the code cache fails. 6.11 + bool set_to_megamorphic(CallInfo* call_info, Bytecodes::Code bytecode, TRAPS); 6.12 6.13 static void compute_monomorphic_entry(methodHandle method, KlassHandle receiver_klass, 6.14 bool is_optimized, bool static_bound, CompiledICInfo& info, TRAPS);
7.1 --- a/src/share/vm/code/vtableStubs.cpp Wed Sep 25 13:03:21 2013 -0400 7.2 +++ b/src/share/vm/code/vtableStubs.cpp Thu Sep 26 08:48:15 2013 +0200 7.3 @@ -46,12 +46,9 @@ 7.4 address VtableStub::_chunk_end = NULL; 7.5 VMReg VtableStub::_receiver_location = VMRegImpl::Bad(); 7.6 7.7 -static int num_vtable_chunks = 0; 7.8 - 7.9 7.10 void* VtableStub::operator new(size_t size, int code_size) throw() { 7.11 assert(size == sizeof(VtableStub), "mismatched size"); 7.12 - num_vtable_chunks++; 7.13 // compute real VtableStub size (rounded to nearest word) 7.14 const int real_size = round_to(code_size + sizeof(VtableStub), wordSize); 7.15 // malloc them in chunks to minimize header overhead 7.16 @@ -60,7 +57,7 @@ 7.17 const int bytes = chunk_factor * real_size + pd_code_alignment(); 7.18 BufferBlob* blob = BufferBlob::create("vtable chunks", bytes); 7.19 if (blob == NULL) { 7.20 - vm_exit_out_of_memory(bytes, OOM_MALLOC_ERROR, "CodeCache: no room for vtable chunks"); 7.21 + return NULL; 7.22 } 7.23 _chunk = blob->content_begin(); 7.24 _chunk_end = _chunk + bytes; 7.25 @@ -121,6 +118,12 @@ 7.26 } else { 7.27 s = create_itable_stub(vtable_index); 7.28 } 7.29 + 7.30 + // Creation of vtable or itable can fail if there is not enough free space in the code cache. 7.31 + if (s == NULL) { 7.32 + return NULL; 7.33 + } 7.34 + 7.35 enter(is_vtable_stub, vtable_index, s); 7.36 if (PrintAdapterHandlers) { 7.37 tty->print_cr("Decoding VtableStub %s[%d]@%d",
8.1 --- a/src/share/vm/opto/bytecodeInfo.cpp Wed Sep 25 13:03:21 2013 -0400 8.2 +++ b/src/share/vm/opto/bytecodeInfo.cpp Thu Sep 26 08:48:15 2013 +0200 8.3 @@ -123,7 +123,7 @@ 8.4 // Allows targeted inlining 8.5 if(callee_method->should_inline()) { 8.6 *wci_result = *(WarmCallInfo::always_hot()); 8.7 - if (PrintInlining && Verbose) { 8.8 + if (C->print_inlining() && Verbose) { 8.9 CompileTask::print_inline_indent(inline_level()); 8.10 tty->print_cr("Inlined method is hot: "); 8.11 } 8.12 @@ -137,7 +137,7 @@ 8.13 if(callee_method->interpreter_throwout_count() > InlineThrowCount && 8.14 size < InlineThrowMaxSize ) { 8.15 wci_result->set_profit(wci_result->profit() * 100); 8.16 - if (PrintInlining && Verbose) { 8.17 + if (C->print_inlining() && Verbose) { 8.18 CompileTask::print_inline_indent(inline_level()); 8.19 tty->print_cr("Inlined method with many throws (throws=%d):", callee_method->interpreter_throwout_count()); 8.20 } 8.21 @@ -491,7 +491,7 @@ 8.22 C->log()->inline_fail(inline_msg); 8.23 } 8.24 } 8.25 - if (PrintInlining) { 8.26 + if (C->print_inlining()) { 8.27 C->print_inlining(callee_method, inline_level(), caller_bci, inline_msg); 8.28 if (callee_method == NULL) tty->print(" callee not monotonic or profiled"); 8.29 if (Verbose && callee_method) { 8.30 @@ -540,7 +540,7 @@ 8.31 8.32 #ifndef PRODUCT 8.33 if (UseOldInlining && InlineWarmCalls 8.34 - && (PrintOpto || PrintOptoInlining || PrintInlining)) { 8.35 + && (PrintOpto || C->print_inlining())) { 8.36 bool cold = wci.is_cold(); 8.37 bool hot = !cold && wci.is_hot(); 8.38 bool old_cold = !success; 8.39 @@ -617,7 +617,7 @@ 8.40 callee_method->is_compiled_lambda_form()) { 8.41 max_inline_level_adjust += 1; // don't count method handle calls from java.lang.invoke implem 8.42 } 8.43 - if (max_inline_level_adjust != 0 && PrintInlining && (Verbose || WizardMode)) { 8.44 + if (max_inline_level_adjust != 0 && C->print_inlining() && (Verbose || WizardMode)) { 8.45 CompileTask::print_inline_indent(inline_level()); 8.46 tty->print_cr(" \\-> discounting inline depth"); 8.47 }
9.1 --- a/src/share/vm/opto/callGenerator.hpp Wed Sep 25 13:03:21 2013 -0400 9.2 +++ b/src/share/vm/opto/callGenerator.hpp Thu Sep 26 08:48:15 2013 +0200 9.3 @@ -159,8 +159,9 @@ 9.4 virtual void print_inlining_late(const char* msg) { ShouldNotReachHere(); } 9.5 9.6 static void print_inlining(Compile* C, ciMethod* callee, int inline_level, int bci, const char* msg) { 9.7 - if (PrintInlining) 9.8 + if (C->print_inlining()) { 9.9 C->print_inlining(callee, inline_level, bci, msg); 9.10 + } 9.11 } 9.12 }; 9.13
10.1 --- a/src/share/vm/opto/compile.cpp Wed Sep 25 13:03:21 2013 -0400 10.2 +++ b/src/share/vm/opto/compile.cpp Thu Sep 26 08:48:15 2013 +0200 10.3 @@ -654,7 +654,7 @@ 10.4 _inlining_progress(false), 10.5 _inlining_incrementally(false), 10.6 _print_inlining_list(NULL), 10.7 - _print_inlining(0) { 10.8 + _print_inlining_idx(0) { 10.9 C = this; 10.10 10.11 CompileWrapper cw(this); 10.12 @@ -679,6 +679,8 @@ 10.13 set_print_assembly(print_opto_assembly); 10.14 set_parsed_irreducible_loop(false); 10.15 #endif 10.16 + set_print_inlining(PrintInlining || method()->has_option("PrintInlining") NOT_PRODUCT( || PrintOptoInlining)); 10.17 + set_print_intrinsics(PrintIntrinsics || method()->has_option("PrintIntrinsics")); 10.18 10.19 if (ProfileTraps) { 10.20 // Make sure the method being compiled gets its own MDO, 10.21 @@ -710,7 +712,7 @@ 10.22 PhaseGVN gvn(node_arena(), estimated_size); 10.23 set_initial_gvn(&gvn); 10.24 10.25 - if (PrintInlining || PrintIntrinsics NOT_PRODUCT( || PrintOptoInlining)) { 10.26 + if (print_inlining() || print_intrinsics()) { 10.27 _print_inlining_list = new (comp_arena())GrowableArray<PrintInliningBuffer>(comp_arena(), 1, 1, PrintInliningBuffer()); 10.28 } 10.29 { // Scope for timing the parser 10.30 @@ -937,7 +939,7 @@ 10.31 _inlining_progress(false), 10.32 _inlining_incrementally(false), 10.33 _print_inlining_list(NULL), 10.34 - _print_inlining(0) { 10.35 + _print_inlining_idx(0) { 10.36 C = this; 10.37 10.38 #ifndef PRODUCT 10.39 @@ -3611,7 +3613,7 @@ 10.40 } 10.41 10.42 void Compile::dump_inlining() { 10.43 - if (PrintInlining || PrintIntrinsics NOT_PRODUCT( || PrintOptoInlining)) { 10.44 + if (print_inlining() || print_intrinsics()) { 10.45 // Print inlining message for candidates that we couldn't inline 10.46 // for lack of space or non constant receiver 10.47 for (int i = 0; i < _late_inlines.length(); i++) { 10.48 @@ -3635,7 +3637,7 @@ 10.49 } 10.50 } 10.51 for (int i = 0; i < _print_inlining_list->length(); i++) { 10.52 - tty->print(_print_inlining_list->at(i).ss()->as_string()); 10.53 + tty->print(_print_inlining_list->adr_at(i)->ss()->as_string()); 10.54 } 10.55 } 10.56 }
11.1 --- a/src/share/vm/opto/compile.hpp Wed Sep 25 13:03:21 2013 -0400 11.2 +++ b/src/share/vm/opto/compile.hpp Thu Sep 26 08:48:15 2013 +0200 11.3 @@ -312,6 +312,8 @@ 11.4 bool _do_method_data_update; // True if we generate code to update MethodData*s 11.5 int _AliasLevel; // Locally-adjusted version of AliasLevel flag. 11.6 bool _print_assembly; // True if we should dump assembly code for this compilation 11.7 + bool _print_inlining; // True if we should print inlining for this compilation 11.8 + bool _print_intrinsics; // True if we should print intrinsics for this compilation 11.9 #ifndef PRODUCT 11.10 bool _trace_opto_output; 11.11 bool _parsed_irreducible_loop; // True if ciTypeFlow detected irreducible loops during parsing 11.12 @@ -414,7 +416,7 @@ 11.13 }; 11.14 11.15 GrowableArray<PrintInliningBuffer>* _print_inlining_list; 11.16 - int _print_inlining; 11.17 + int _print_inlining_idx; 11.18 11.19 // Only keep nodes in the expensive node list that need to be optimized 11.20 void cleanup_expensive_nodes(PhaseIterGVN &igvn); 11.21 @@ -426,24 +428,24 @@ 11.22 public: 11.23 11.24 outputStream* print_inlining_stream() const { 11.25 - return _print_inlining_list->at(_print_inlining).ss(); 11.26 + return _print_inlining_list->adr_at(_print_inlining_idx)->ss(); 11.27 } 11.28 11.29 void print_inlining_skip(CallGenerator* cg) { 11.30 - if (PrintInlining) { 11.31 - _print_inlining_list->at(_print_inlining).set_cg(cg); 11.32 - _print_inlining++; 11.33 - _print_inlining_list->insert_before(_print_inlining, PrintInliningBuffer()); 11.34 + if (_print_inlining) { 11.35 + _print_inlining_list->adr_at(_print_inlining_idx)->set_cg(cg); 11.36 + _print_inlining_idx++; 11.37 + _print_inlining_list->insert_before(_print_inlining_idx, PrintInliningBuffer()); 11.38 } 11.39 } 11.40 11.41 void print_inlining_insert(CallGenerator* cg) { 11.42 - if (PrintInlining) { 11.43 + if (_print_inlining) { 11.44 for (int i = 0; i < _print_inlining_list->length(); i++) { 11.45 - if (_print_inlining_list->at(i).cg() == cg) { 11.46 + if (_print_inlining_list->adr_at(i)->cg() == cg) { 11.47 _print_inlining_list->insert_before(i+1, PrintInliningBuffer()); 11.48 - _print_inlining = i+1; 11.49 - _print_inlining_list->at(i).set_cg(NULL); 11.50 + _print_inlining_idx = i+1; 11.51 + _print_inlining_list->adr_at(i)->set_cg(NULL); 11.52 return; 11.53 } 11.54 } 11.55 @@ -572,6 +574,10 @@ 11.56 int AliasLevel() const { return _AliasLevel; } 11.57 bool print_assembly() const { return _print_assembly; } 11.58 void set_print_assembly(bool z) { _print_assembly = z; } 11.59 + bool print_inlining() const { return _print_inlining; } 11.60 + void set_print_inlining(bool z) { _print_inlining = z; } 11.61 + bool print_intrinsics() const { return _print_intrinsics; } 11.62 + void set_print_intrinsics(bool z) { _print_intrinsics = z; } 11.63 // check the CompilerOracle for special behaviours for this compile 11.64 bool method_has_option(const char * option) { 11.65 return method() != NULL && method()->has_option(option);
12.1 --- a/src/share/vm/opto/doCall.cpp Wed Sep 25 13:03:21 2013 -0400 12.2 +++ b/src/share/vm/opto/doCall.cpp Thu Sep 26 08:48:15 2013 +0200 12.3 @@ -41,9 +41,9 @@ 12.4 #include "runtime/sharedRuntime.hpp" 12.5 12.6 void trace_type_profile(Compile* C, ciMethod *method, int depth, int bci, ciMethod *prof_method, ciKlass *prof_klass, int site_count, int receiver_count) { 12.7 - if (TraceTypeProfile || PrintInlining NOT_PRODUCT(|| PrintOptoInlining)) { 12.8 + if (TraceTypeProfile || C->print_inlining()) { 12.9 outputStream* out = tty; 12.10 - if (!PrintInlining) { 12.11 + if (!C->print_inlining()) { 12.12 if (NOT_PRODUCT(!PrintOpto &&) !PrintCompilation) { 12.13 method->print_short_name(); 12.14 tty->cr();
13.1 --- a/src/share/vm/opto/library_call.cpp Wed Sep 25 13:03:21 2013 -0400 13.2 +++ b/src/share/vm/opto/library_call.cpp Thu Sep 26 08:48:15 2013 +0200 13.3 @@ -543,7 +543,7 @@ 13.4 Compile* C = kit.C; 13.5 int nodes = C->unique(); 13.6 #ifndef PRODUCT 13.7 - if ((PrintIntrinsics || PrintInlining NOT_PRODUCT( || PrintOptoInlining) ) && Verbose) { 13.8 + if ((C->print_intrinsics() || C->print_inlining()) && Verbose) { 13.9 char buf[1000]; 13.10 const char* str = vmIntrinsics::short_name_as_C_string(intrinsic_id(), buf, sizeof(buf)); 13.11 tty->print_cr("Intrinsic %s", str); 13.12 @@ -554,7 +554,7 @@ 13.13 13.14 // Try to inline the intrinsic. 13.15 if (kit.try_to_inline()) { 13.16 - if (PrintIntrinsics || PrintInlining NOT_PRODUCT( || PrintOptoInlining) ) { 13.17 + if (C->print_intrinsics() || C->print_inlining()) { 13.18 C->print_inlining(callee, jvms->depth() - 1, bci, is_virtual() ? "(intrinsic, virtual)" : "(intrinsic)"); 13.19 } 13.20 C->gather_intrinsic_statistics(intrinsic_id(), is_virtual(), Compile::_intrinsic_worked); 13.21 @@ -570,7 +570,7 @@ 13.22 } 13.23 13.24 // The intrinsic bailed out 13.25 - if (PrintIntrinsics || PrintInlining NOT_PRODUCT( || PrintOptoInlining) ) { 13.26 + if (C->print_intrinsics() || C->print_inlining()) { 13.27 if (jvms->has_method()) { 13.28 // Not a root compile. 13.29 const char* msg = is_virtual() ? "failed to inline (intrinsic, virtual)" : "failed to inline (intrinsic)"; 13.30 @@ -592,7 +592,7 @@ 13.31 int nodes = C->unique(); 13.32 #ifndef PRODUCT 13.33 assert(is_predicted(), "sanity"); 13.34 - if ((PrintIntrinsics || PrintInlining NOT_PRODUCT( || PrintOptoInlining) ) && Verbose) { 13.35 + if ((C->print_intrinsics() || C->print_inlining()) && Verbose) { 13.36 char buf[1000]; 13.37 const char* str = vmIntrinsics::short_name_as_C_string(intrinsic_id(), buf, sizeof(buf)); 13.38 tty->print_cr("Predicate for intrinsic %s", str); 13.39 @@ -603,7 +603,7 @@ 13.40 13.41 Node* slow_ctl = kit.try_to_predicate(); 13.42 if (!kit.failing()) { 13.43 - if (PrintIntrinsics || PrintInlining NOT_PRODUCT( || PrintOptoInlining) ) { 13.44 + if (C->print_intrinsics() || C->print_inlining()) { 13.45 C->print_inlining(callee, jvms->depth() - 1, bci, is_virtual() ? "(intrinsic, virtual)" : "(intrinsic)"); 13.46 } 13.47 C->gather_intrinsic_statistics(intrinsic_id(), is_virtual(), Compile::_intrinsic_worked); 13.48 @@ -617,7 +617,7 @@ 13.49 } 13.50 13.51 // The intrinsic bailed out 13.52 - if (PrintIntrinsics || PrintInlining NOT_PRODUCT( || PrintOptoInlining) ) { 13.53 + if (C->print_intrinsics() || C->print_inlining()) { 13.54 if (jvms->has_method()) { 13.55 // Not a root compile. 13.56 const char* msg = "failed to generate predicate for intrinsic"; 13.57 @@ -2299,7 +2299,7 @@ 13.58 const TypeOopPtr* tjp = TypeOopPtr::make_from_klass(sharpened_klass); 13.59 13.60 #ifndef PRODUCT 13.61 - if (PrintIntrinsics || PrintInlining || PrintOptoInlining) { 13.62 + if (C->print_intrinsics() || C->print_inlining()) { 13.63 tty->print(" from base type: "); adr_type->dump(); 13.64 tty->print(" sharpened value: "); tjp->dump(); 13.65 } 13.66 @@ -3260,7 +3260,7 @@ 13.67 if (mirror_con == NULL) return false; // cannot happen? 13.68 13.69 #ifndef PRODUCT 13.70 - if (PrintIntrinsics || PrintInlining || PrintOptoInlining) { 13.71 + if (C->print_intrinsics() || C->print_inlining()) { 13.72 ciType* k = mirror_con->java_mirror_type(); 13.73 if (k) { 13.74 tty->print("Inlining %s on constant Class ", vmIntrinsics::name_at(intrinsic_id())); 13.75 @@ -3952,14 +3952,14 @@ 13.76 // caller sensitive methods. 13.77 bool LibraryCallKit::inline_native_Reflection_getCallerClass() { 13.78 #ifndef PRODUCT 13.79 - if ((PrintIntrinsics || PrintInlining || PrintOptoInlining) && Verbose) { 13.80 + if ((C->print_intrinsics() || C->print_inlining()) && Verbose) { 13.81 tty->print_cr("Attempting to inline sun.reflect.Reflection.getCallerClass"); 13.82 } 13.83 #endif 13.84 13.85 if (!jvms()->has_method()) { 13.86 #ifndef PRODUCT 13.87 - if ((PrintIntrinsics || PrintInlining || PrintOptoInlining) && Verbose) { 13.88 + if ((C->print_intrinsics() || C->print_inlining()) && Verbose) { 13.89 tty->print_cr(" Bailing out because intrinsic was inlined at top level"); 13.90 } 13.91 #endif 13.92 @@ -3983,7 +3983,7 @@ 13.93 // Frame 0 and 1 must be caller sensitive (see JVM_GetCallerClass). 13.94 if (!m->caller_sensitive()) { 13.95 #ifndef PRODUCT 13.96 - if ((PrintIntrinsics || PrintInlining || PrintOptoInlining) && Verbose) { 13.97 + if ((C->print_intrinsics() || C->print_inlining()) && Verbose) { 13.98 tty->print_cr(" Bailing out: CallerSensitive annotation expected at frame %d", n); 13.99 } 13.100 #endif 13.101 @@ -3999,7 +3999,7 @@ 13.102 set_result(makecon(TypeInstPtr::make(caller_mirror))); 13.103 13.104 #ifndef PRODUCT 13.105 - if ((PrintIntrinsics || PrintInlining || PrintOptoInlining) && Verbose) { 13.106 + if ((C->print_intrinsics() || C->print_inlining()) && Verbose) { 13.107 tty->print_cr(" Succeeded: caller = %d) %s.%s, JVMS depth = %d", n, caller_klass->name()->as_utf8(), caller_jvms->method()->name()->as_utf8(), jvms()->depth()); 13.108 tty->print_cr(" JVM state at this point:"); 13.109 for (int i = jvms()->depth(), n = 1; i >= 1; i--, n++) { 13.110 @@ -4015,7 +4015,7 @@ 13.111 } 13.112 13.113 #ifndef PRODUCT 13.114 - if ((PrintIntrinsics || PrintInlining || PrintOptoInlining) && Verbose) { 13.115 + if ((C->print_intrinsics() || C->print_inlining()) && Verbose) { 13.116 tty->print_cr(" Bailing out because caller depth exceeded inlining depth = %d", jvms()->depth()); 13.117 tty->print_cr(" JVM state at this point:"); 13.118 for (int i = jvms()->depth(), n = 1; i >= 1; i--, n++) {
14.1 --- a/src/share/vm/runtime/sharedRuntime.cpp Wed Sep 25 13:03:21 2013 -0400 14.2 +++ b/src/share/vm/runtime/sharedRuntime.cpp Thu Sep 26 08:48:15 2013 +0200 14.3 @@ -1506,8 +1506,11 @@ 14.4 info, CHECK_(methodHandle())); 14.5 inline_cache->set_to_monomorphic(info); 14.6 } else if (!inline_cache->is_megamorphic() && !inline_cache->is_clean()) { 14.7 - // Change to megamorphic 14.8 - inline_cache->set_to_megamorphic(&call_info, bc, CHECK_(methodHandle())); 14.9 + // Potential change to megamorphic 14.10 + bool successful = inline_cache->set_to_megamorphic(&call_info, bc, CHECK_(methodHandle())); 14.11 + if (!successful) { 14.12 + inline_cache->set_to_clean(); 14.13 + } 14.14 } else { 14.15 // Either clean or megamorphic 14.16 }
15.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 15.2 +++ b/test/compiler/print/PrintInlining.java Thu Sep 26 08:48:15 2013 +0200 15.3 @@ -0,0 +1,36 @@ 15.4 +/* 15.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 15.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 15.7 + * 15.8 + * This code is free software; you can redistribute it and/or modify it 15.9 + * under the terms of the GNU General Public License version 2 only, as 15.10 + * published by the Free Software Foundation. 15.11 + * 15.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 15.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 15.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 15.15 + * version 2 for more details (a copy is included in the LICENSE file that 15.16 + * accompanied this code). 15.17 + * 15.18 + * You should have received a copy of the GNU General Public License version 15.19 + * 2 along with this work; if not, write to the Free Software Foundation, 15.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 15.21 + * 15.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 15.23 + * or visit www.oracle.com if you need additional information or have any 15.24 + * questions. 15.25 + */ 15.26 + 15.27 +/* 15.28 + * @test 15.29 + * @bug 8022585 15.30 + * @summary VM crashes when ran with -XX:+PrintInlining 15.31 + * @run main/othervm -Xcomp -XX:+PrintInlining PrintInlining 15.32 + * 15.33 + */ 15.34 + 15.35 +public class PrintInlining { 15.36 + public static void main(String[] args) { 15.37 + System.out.println("Passed"); 15.38 + } 15.39 +}