Wed, 21 May 2014 11:25:25 +0200
8031475: Missing oopmap in patching stubs
Summary: Add patch test for lir_checkcast in compute_oop_map
Reviewed-by: roland, twisti
1.1 --- a/src/share/vm/c1/c1_LIR.cpp Fri May 23 14:46:59 2014 -0700 1.2 +++ b/src/share/vm/c1/c1_LIR.cpp Wed May 21 11:25:25 2014 +0200 1.3 @@ -1083,7 +1083,7 @@ 1.4 1.5 void LIR_OpArrayCopy::emit_code(LIR_Assembler* masm) { 1.6 masm->emit_arraycopy(this); 1.7 - masm->emit_code_stub(stub()); 1.8 + masm->append_code_stub(stub()); 1.9 } 1.10 1.11 void LIR_OpUpdateCRC32::emit_code(LIR_Assembler* masm) { 1.12 @@ -1100,20 +1100,20 @@ 1.13 1.14 void LIR_OpAllocObj::emit_code(LIR_Assembler* masm) { 1.15 masm->emit_alloc_obj(this); 1.16 - masm->emit_code_stub(stub()); 1.17 + masm->append_code_stub(stub()); 1.18 } 1.19 1.20 void LIR_OpBranch::emit_code(LIR_Assembler* masm) { 1.21 masm->emit_opBranch(this); 1.22 if (stub()) { 1.23 - masm->emit_code_stub(stub()); 1.24 + masm->append_code_stub(stub()); 1.25 } 1.26 } 1.27 1.28 void LIR_OpConvert::emit_code(LIR_Assembler* masm) { 1.29 masm->emit_opConvert(this); 1.30 if (stub() != NULL) { 1.31 - masm->emit_code_stub(stub()); 1.32 + masm->append_code_stub(stub()); 1.33 } 1.34 } 1.35 1.36 @@ -1123,13 +1123,13 @@ 1.37 1.38 void LIR_OpAllocArray::emit_code(LIR_Assembler* masm) { 1.39 masm->emit_alloc_array(this); 1.40 - masm->emit_code_stub(stub()); 1.41 + masm->append_code_stub(stub()); 1.42 } 1.43 1.44 void LIR_OpTypeCheck::emit_code(LIR_Assembler* masm) { 1.45 masm->emit_opTypeCheck(this); 1.46 if (stub()) { 1.47 - masm->emit_code_stub(stub()); 1.48 + masm->append_code_stub(stub()); 1.49 } 1.50 } 1.51 1.52 @@ -1144,7 +1144,7 @@ 1.53 void LIR_OpLock::emit_code(LIR_Assembler* masm) { 1.54 masm->emit_lock(this); 1.55 if (stub()) { 1.56 - masm->emit_code_stub(stub()); 1.57 + masm->append_code_stub(stub()); 1.58 } 1.59 } 1.60
2.1 --- a/src/share/vm/c1/c1_LIR.hpp Fri May 23 14:46:59 2014 -0700 2.2 +++ b/src/share/vm/c1/c1_LIR.hpp Wed May 21 11:25:25 2014 +0200 2.3 @@ -1127,6 +1127,7 @@ 2.4 virtual void print_instr(outputStream* out) const = 0; 2.5 virtual void print_on(outputStream* st) const PRODUCT_RETURN; 2.6 2.7 + virtual bool is_patching() { return false; } 2.8 virtual LIR_OpCall* as_OpCall() { return NULL; } 2.9 virtual LIR_OpJavaCall* as_OpJavaCall() { return NULL; } 2.10 virtual LIR_OpLabel* as_OpLabel() { return NULL; } 2.11 @@ -1387,6 +1388,7 @@ 2.12 return (LIR_MoveKind)_flags; 2.13 } 2.14 2.15 + virtual bool is_patching() { return _patch != lir_patch_none; } 2.16 virtual void emit_code(LIR_Assembler* masm); 2.17 virtual LIR_Op1* as_Op1() { return this; } 2.18 virtual const char * name() const PRODUCT_RETURN0; 2.19 @@ -1619,6 +1621,7 @@ 2.20 int profiled_bci() const { return _profiled_bci; } 2.21 bool should_profile() const { return _should_profile; } 2.22 2.23 + virtual bool is_patching() { return _info_for_patch != NULL; } 2.24 virtual void emit_code(LIR_Assembler* masm); 2.25 virtual LIR_OpTypeCheck* as_OpTypeCheck() { return this; } 2.26 void print_instr(outputStream* out) const PRODUCT_RETURN;
3.1 --- a/src/share/vm/c1/c1_LIRAssembler.cpp Fri May 23 14:46:59 2014 -0700 3.2 +++ b/src/share/vm/c1/c1_LIRAssembler.cpp Wed May 21 11:25:25 2014 +0200 3.3 @@ -58,7 +58,7 @@ 3.4 _masm->nop(); 3.5 } 3.6 patch->install(_masm, patch_code, obj, info); 3.7 - append_patching_stub(patch); 3.8 + append_code_stub(patch); 3.9 3.10 #ifdef ASSERT 3.11 Bytecodes::Code code = info->scope()->method()->java_code_at_bci(info->stack()->bci()); 3.12 @@ -131,11 +131,6 @@ 3.13 } 3.14 3.15 3.16 -void LIR_Assembler::append_patching_stub(PatchingStub* stub) { 3.17 - _slow_case_stubs->append(stub); 3.18 -} 3.19 - 3.20 - 3.21 void LIR_Assembler::check_codespace() { 3.22 CodeSection* cs = _masm->code_section(); 3.23 if (cs->remaining() < (int)(NOT_LP64(1*K)LP64_ONLY(2*K))) { 3.24 @@ -144,7 +139,7 @@ 3.25 } 3.26 3.27 3.28 -void LIR_Assembler::emit_code_stub(CodeStub* stub) { 3.29 +void LIR_Assembler::append_code_stub(CodeStub* stub) { 3.30 _slow_case_stubs->append(stub); 3.31 } 3.32 3.33 @@ -435,7 +430,7 @@ 3.34 3.35 void LIR_Assembler::add_debug_info_for_null_check(int pc_offset, CodeEmitInfo* cinfo) { 3.36 ImplicitNullCheckStub* stub = new ImplicitNullCheckStub(pc_offset, cinfo); 3.37 - emit_code_stub(stub); 3.38 + append_code_stub(stub); 3.39 } 3.40 3.41 void LIR_Assembler::add_debug_info_for_div0_here(CodeEmitInfo* info) { 3.42 @@ -444,7 +439,7 @@ 3.43 3.44 void LIR_Assembler::add_debug_info_for_div0(int pc_offset, CodeEmitInfo* cinfo) { 3.45 DivByZeroStub* stub = new DivByZeroStub(pc_offset, cinfo); 3.46 - emit_code_stub(stub); 3.47 + append_code_stub(stub); 3.48 } 3.49 3.50 void LIR_Assembler::emit_rtcall(LIR_OpRTCall* op) {
4.1 --- a/src/share/vm/c1/c1_LIRAssembler.hpp Fri May 23 14:46:59 2014 -0700 4.2 +++ b/src/share/vm/c1/c1_LIRAssembler.hpp Wed May 21 11:25:25 2014 +0200 4.3 @@ -143,7 +143,7 @@ 4.4 // stubs 4.5 void emit_slow_case_stubs(); 4.6 void emit_static_call_stub(); 4.7 - void emit_code_stub(CodeStub* op); 4.8 + void append_code_stub(CodeStub* op); 4.9 void add_call_info_here(CodeEmitInfo* info) { add_call_info(code_offset(), info); } 4.10 4.11 // code patterns
5.1 --- a/src/share/vm/c1/c1_LinearScan.cpp Fri May 23 14:46:59 2014 -0700 5.2 +++ b/src/share/vm/c1/c1_LinearScan.cpp Wed May 21 11:25:25 2014 +0200 5.3 @@ -2382,16 +2382,6 @@ 5.4 int arg_count = frame_map()->oop_map_arg_count(); 5.5 OopMap* map = new OopMap(frame_size, arg_count); 5.6 5.7 - // Check if this is a patch site. 5.8 - bool is_patch_info = false; 5.9 - if (op->code() == lir_move) { 5.10 - assert(!is_call_site, "move must not be a call site"); 5.11 - assert(op->as_Op1() != NULL, "move must be LIR_Op1"); 5.12 - LIR_Op1* move = (LIR_Op1*)op; 5.13 - 5.14 - is_patch_info = move->patch_code() != lir_patch_none; 5.15 - } 5.16 - 5.17 // Iterate through active intervals 5.18 for (Interval* interval = iw->active_first(fixedKind); interval != Interval::end(); interval = interval->next()) { 5.19 int assigned_reg = interval->assigned_reg(); 5.20 @@ -2406,7 +2396,7 @@ 5.21 // moves, any intervals which end at this instruction are included 5.22 // in the oop map since we may safepoint while doing the patch 5.23 // before we've consumed the inputs. 5.24 - if (is_patch_info || op->id() < interval->current_to()) { 5.25 + if (op->is_patching() || op->id() < interval->current_to()) { 5.26 5.27 // caller-save registers must not be included into oop-maps at calls 5.28 assert(!is_call_site || assigned_reg >= nof_regs || !is_caller_save(assigned_reg), "interval is in a caller-save register at a call -> register will be overwritten");