# HG changeset patch # User neliasso # Date 1400664325 -7200 # Node ID 15766b73dc1d96b915fd3b0b8ab5308e4355fee1 # Parent abb06af6059b3d8d98972a8345e31a8a0a4fe054 8031475: Missing oopmap in patching stubs Summary: Add patch test for lir_checkcast in compute_oop_map Reviewed-by: roland, twisti diff -r abb06af6059b -r 15766b73dc1d src/share/vm/c1/c1_LIR.cpp --- a/src/share/vm/c1/c1_LIR.cpp Fri May 23 14:46:59 2014 -0700 +++ b/src/share/vm/c1/c1_LIR.cpp Wed May 21 11:25:25 2014 +0200 @@ -1083,7 +1083,7 @@ void LIR_OpArrayCopy::emit_code(LIR_Assembler* masm) { masm->emit_arraycopy(this); - masm->emit_code_stub(stub()); + masm->append_code_stub(stub()); } void LIR_OpUpdateCRC32::emit_code(LIR_Assembler* masm) { @@ -1100,20 +1100,20 @@ void LIR_OpAllocObj::emit_code(LIR_Assembler* masm) { masm->emit_alloc_obj(this); - masm->emit_code_stub(stub()); + masm->append_code_stub(stub()); } void LIR_OpBranch::emit_code(LIR_Assembler* masm) { masm->emit_opBranch(this); if (stub()) { - masm->emit_code_stub(stub()); + masm->append_code_stub(stub()); } } void LIR_OpConvert::emit_code(LIR_Assembler* masm) { masm->emit_opConvert(this); if (stub() != NULL) { - masm->emit_code_stub(stub()); + masm->append_code_stub(stub()); } } @@ -1123,13 +1123,13 @@ void LIR_OpAllocArray::emit_code(LIR_Assembler* masm) { masm->emit_alloc_array(this); - masm->emit_code_stub(stub()); + masm->append_code_stub(stub()); } void LIR_OpTypeCheck::emit_code(LIR_Assembler* masm) { masm->emit_opTypeCheck(this); if (stub()) { - masm->emit_code_stub(stub()); + masm->append_code_stub(stub()); } } @@ -1144,7 +1144,7 @@ void LIR_OpLock::emit_code(LIR_Assembler* masm) { masm->emit_lock(this); if (stub()) { - masm->emit_code_stub(stub()); + masm->append_code_stub(stub()); } } diff -r abb06af6059b -r 15766b73dc1d src/share/vm/c1/c1_LIR.hpp --- a/src/share/vm/c1/c1_LIR.hpp Fri May 23 14:46:59 2014 -0700 +++ b/src/share/vm/c1/c1_LIR.hpp Wed May 21 11:25:25 2014 +0200 @@ -1127,6 +1127,7 @@ virtual void print_instr(outputStream* out) const = 0; virtual void print_on(outputStream* st) const PRODUCT_RETURN; + virtual bool is_patching() { return false; } virtual LIR_OpCall* as_OpCall() { return NULL; } virtual LIR_OpJavaCall* as_OpJavaCall() { return NULL; } virtual LIR_OpLabel* as_OpLabel() { return NULL; } @@ -1387,6 +1388,7 @@ return (LIR_MoveKind)_flags; } + virtual bool is_patching() { return _patch != lir_patch_none; } virtual void emit_code(LIR_Assembler* masm); virtual LIR_Op1* as_Op1() { return this; } virtual const char * name() const PRODUCT_RETURN0; @@ -1619,6 +1621,7 @@ int profiled_bci() const { return _profiled_bci; } bool should_profile() const { return _should_profile; } + virtual bool is_patching() { return _info_for_patch != NULL; } virtual void emit_code(LIR_Assembler* masm); virtual LIR_OpTypeCheck* as_OpTypeCheck() { return this; } void print_instr(outputStream* out) const PRODUCT_RETURN; diff -r abb06af6059b -r 15766b73dc1d src/share/vm/c1/c1_LIRAssembler.cpp --- a/src/share/vm/c1/c1_LIRAssembler.cpp Fri May 23 14:46:59 2014 -0700 +++ b/src/share/vm/c1/c1_LIRAssembler.cpp Wed May 21 11:25:25 2014 +0200 @@ -58,7 +58,7 @@ _masm->nop(); } patch->install(_masm, patch_code, obj, info); - append_patching_stub(patch); + append_code_stub(patch); #ifdef ASSERT Bytecodes::Code code = info->scope()->method()->java_code_at_bci(info->stack()->bci()); @@ -131,11 +131,6 @@ } -void LIR_Assembler::append_patching_stub(PatchingStub* stub) { - _slow_case_stubs->append(stub); -} - - void LIR_Assembler::check_codespace() { CodeSection* cs = _masm->code_section(); if (cs->remaining() < (int)(NOT_LP64(1*K)LP64_ONLY(2*K))) { @@ -144,7 +139,7 @@ } -void LIR_Assembler::emit_code_stub(CodeStub* stub) { +void LIR_Assembler::append_code_stub(CodeStub* stub) { _slow_case_stubs->append(stub); } @@ -435,7 +430,7 @@ void LIR_Assembler::add_debug_info_for_null_check(int pc_offset, CodeEmitInfo* cinfo) { ImplicitNullCheckStub* stub = new ImplicitNullCheckStub(pc_offset, cinfo); - emit_code_stub(stub); + append_code_stub(stub); } void LIR_Assembler::add_debug_info_for_div0_here(CodeEmitInfo* info) { @@ -444,7 +439,7 @@ void LIR_Assembler::add_debug_info_for_div0(int pc_offset, CodeEmitInfo* cinfo) { DivByZeroStub* stub = new DivByZeroStub(pc_offset, cinfo); - emit_code_stub(stub); + append_code_stub(stub); } void LIR_Assembler::emit_rtcall(LIR_OpRTCall* op) { diff -r abb06af6059b -r 15766b73dc1d src/share/vm/c1/c1_LIRAssembler.hpp --- a/src/share/vm/c1/c1_LIRAssembler.hpp Fri May 23 14:46:59 2014 -0700 +++ b/src/share/vm/c1/c1_LIRAssembler.hpp Wed May 21 11:25:25 2014 +0200 @@ -143,7 +143,7 @@ // stubs void emit_slow_case_stubs(); void emit_static_call_stub(); - void emit_code_stub(CodeStub* op); + void append_code_stub(CodeStub* op); void add_call_info_here(CodeEmitInfo* info) { add_call_info(code_offset(), info); } // code patterns diff -r abb06af6059b -r 15766b73dc1d src/share/vm/c1/c1_LinearScan.cpp --- a/src/share/vm/c1/c1_LinearScan.cpp Fri May 23 14:46:59 2014 -0700 +++ b/src/share/vm/c1/c1_LinearScan.cpp Wed May 21 11:25:25 2014 +0200 @@ -2382,16 +2382,6 @@ int arg_count = frame_map()->oop_map_arg_count(); OopMap* map = new OopMap(frame_size, arg_count); - // Check if this is a patch site. - bool is_patch_info = false; - if (op->code() == lir_move) { - assert(!is_call_site, "move must not be a call site"); - assert(op->as_Op1() != NULL, "move must be LIR_Op1"); - LIR_Op1* move = (LIR_Op1*)op; - - is_patch_info = move->patch_code() != lir_patch_none; - } - // Iterate through active intervals for (Interval* interval = iw->active_first(fixedKind); interval != Interval::end(); interval = interval->next()) { int assigned_reg = interval->assigned_reg(); @@ -2406,7 +2396,7 @@ // moves, any intervals which end at this instruction are included // in the oop map since we may safepoint while doing the patch // before we've consumed the inputs. - if (is_patch_info || op->id() < interval->current_to()) { + if (op->is_patching() || op->id() < interval->current_to()) { // caller-save registers must not be included into oop-maps at calls 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");