8216989: CardTableBarrierSetAssembler::gen_write_ref_array_post_barrier() does not check for zero length on AARCH64
Reviewed-by: adinn
This commit is contained in:
parent
9833d2a1cd
commit
975c61d4c9
@ -72,15 +72,12 @@ void G1BarrierSetAssembler::gen_write_ref_array_pre_barrier(MacroAssembler* masm
|
|||||||
}
|
}
|
||||||
|
|
||||||
void G1BarrierSetAssembler::gen_write_ref_array_post_barrier(MacroAssembler* masm, DecoratorSet decorators,
|
void G1BarrierSetAssembler::gen_write_ref_array_post_barrier(MacroAssembler* masm, DecoratorSet decorators,
|
||||||
Register start, Register end, Register scratch, RegSet saved_regs) {
|
Register start, Register count, Register scratch, RegSet saved_regs) {
|
||||||
__ push(saved_regs, sp);
|
__ push(saved_regs, sp);
|
||||||
// must compute element count unless barrier set interface is changed (other platforms supply count)
|
assert_different_registers(start, count, scratch);
|
||||||
assert_different_registers(start, end, scratch);
|
assert_different_registers(c_rarg0, count);
|
||||||
__ lea(scratch, Address(end, BytesPerHeapOop));
|
|
||||||
__ sub(scratch, scratch, start); // subtract start to get #bytes
|
|
||||||
__ lsr(scratch, scratch, LogBytesPerHeapOop); // convert to element count
|
|
||||||
__ mov(c_rarg0, start);
|
__ mov(c_rarg0, start);
|
||||||
__ mov(c_rarg1, scratch);
|
__ mov(c_rarg1, count);
|
||||||
__ call_VM_leaf(CAST_FROM_FN_PTR(address, G1BarrierSetRuntime::write_ref_array_post_entry), 2);
|
__ call_VM_leaf(CAST_FROM_FN_PTR(address, G1BarrierSetRuntime::write_ref_array_post_entry), 2);
|
||||||
__ pop(saved_regs, sp);
|
__ pop(saved_regs, sp);
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,7 @@ protected:
|
|||||||
void gen_write_ref_array_pre_barrier(MacroAssembler* masm, DecoratorSet decorators,
|
void gen_write_ref_array_pre_barrier(MacroAssembler* masm, DecoratorSet decorators,
|
||||||
Register addr, Register count, RegSet saved_regs);
|
Register addr, Register count, RegSet saved_regs);
|
||||||
void gen_write_ref_array_post_barrier(MacroAssembler* masm, DecoratorSet decorators,
|
void gen_write_ref_array_post_barrier(MacroAssembler* masm, DecoratorSet decorators,
|
||||||
Register start, Register end, Register tmp, RegSet saved_regs);
|
Register start, Register count, Register tmp, RegSet saved_regs);
|
||||||
|
|
||||||
void g1_write_barrier_pre(MacroAssembler* masm,
|
void g1_write_barrier_pre(MacroAssembler* masm,
|
||||||
Register obj,
|
Register obj,
|
||||||
|
@ -62,18 +62,22 @@ void CardTableBarrierSetAssembler::store_check(MacroAssembler* masm, Register ob
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CardTableBarrierSetAssembler::gen_write_ref_array_post_barrier(MacroAssembler* masm, DecoratorSet decorators,
|
void CardTableBarrierSetAssembler::gen_write_ref_array_post_barrier(MacroAssembler* masm, DecoratorSet decorators,
|
||||||
Register start, Register end, Register scratch, RegSet saved_regs) {
|
Register start, Register count, Register scratch, RegSet saved_regs) {
|
||||||
BarrierSet* bs = BarrierSet::barrier_set();
|
BarrierSet* bs = BarrierSet::barrier_set();
|
||||||
CardTableBarrierSet* ctbs = barrier_set_cast<CardTableBarrierSet>(bs);
|
CardTableBarrierSet* ctbs = barrier_set_cast<CardTableBarrierSet>(bs);
|
||||||
CardTable* ct = ctbs->card_table();
|
CardTable* ct = ctbs->card_table();
|
||||||
|
|
||||||
Label L_loop;
|
Label L_loop, L_done;
|
||||||
|
const Register end = count;
|
||||||
|
|
||||||
|
__ cbz(count, L_done); // zero count - nothing to do
|
||||||
|
|
||||||
|
__ lea(end, Address(start, count, Address::lsl(LogBytesPerHeapOop))); // end = start + count << LogBytesPerHeapOop
|
||||||
|
__ sub(end, end, BytesPerHeapOop); // last element address to make inclusive
|
||||||
__ lsr(start, start, CardTable::card_shift);
|
__ lsr(start, start, CardTable::card_shift);
|
||||||
__ lsr(end, end, CardTable::card_shift);
|
__ lsr(end, end, CardTable::card_shift);
|
||||||
__ sub(end, end, start); // number of bytes to copy
|
__ sub(count, end, start); // number of bytes to copy
|
||||||
|
|
||||||
const Register count = end; // 'end' register contains bytes count now
|
|
||||||
__ load_byte_map_base(scratch);
|
__ load_byte_map_base(scratch);
|
||||||
__ add(start, start, scratch);
|
__ add(start, start, scratch);
|
||||||
if (ct->scanned_concurrently()) {
|
if (ct->scanned_concurrently()) {
|
||||||
@ -83,6 +87,7 @@ void CardTableBarrierSetAssembler::gen_write_ref_array_post_barrier(MacroAssembl
|
|||||||
__ strb(zr, Address(start, count));
|
__ strb(zr, Address(start, count));
|
||||||
__ subs(count, count, 1);
|
__ subs(count, count, 1);
|
||||||
__ br(Assembler::GE, L_loop);
|
__ br(Assembler::GE, L_loop);
|
||||||
|
__ bind(L_done);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CardTableBarrierSetAssembler::oop_store_at(MacroAssembler* masm, DecoratorSet decorators, BasicType type,
|
void CardTableBarrierSetAssembler::oop_store_at(MacroAssembler* masm, DecoratorSet decorators, BasicType type,
|
||||||
|
@ -33,7 +33,7 @@ protected:
|
|||||||
void store_check(MacroAssembler* masm, Register obj, Address dst);
|
void store_check(MacroAssembler* masm, Register obj, Address dst);
|
||||||
|
|
||||||
virtual void gen_write_ref_array_post_barrier(MacroAssembler* masm, DecoratorSet decorators,
|
virtual void gen_write_ref_array_post_barrier(MacroAssembler* masm, DecoratorSet decorators,
|
||||||
Register start, Register end, Register tmp, RegSet saved_regs);
|
Register start, Register count, Register tmp, RegSet saved_regs);
|
||||||
virtual void oop_store_at(MacroAssembler* masm, DecoratorSet decorators, BasicType type,
|
virtual void oop_store_at(MacroAssembler* masm, DecoratorSet decorators, BasicType type,
|
||||||
Address dst, Register val, Register tmp1, Register tmp2);
|
Address dst, Register val, Register tmp1, Register tmp2);
|
||||||
|
|
||||||
|
@ -37,10 +37,10 @@ void ModRefBarrierSetAssembler::arraycopy_prologue(MacroAssembler* masm, Decorat
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ModRefBarrierSetAssembler::arraycopy_epilogue(MacroAssembler* masm, DecoratorSet decorators, bool is_oop,
|
void ModRefBarrierSetAssembler::arraycopy_epilogue(MacroAssembler* masm, DecoratorSet decorators, bool is_oop,
|
||||||
Register start, Register end, Register tmp,
|
Register start, Register count, Register tmp,
|
||||||
RegSet saved_regs) {
|
RegSet saved_regs) {
|
||||||
if (is_oop) {
|
if (is_oop) {
|
||||||
gen_write_ref_array_post_barrier(masm, decorators, start, end, tmp, saved_regs);
|
gen_write_ref_array_post_barrier(masm, decorators, start, count, tmp, saved_regs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ protected:
|
|||||||
virtual void gen_write_ref_array_pre_barrier(MacroAssembler* masm, DecoratorSet decorators,
|
virtual void gen_write_ref_array_pre_barrier(MacroAssembler* masm, DecoratorSet decorators,
|
||||||
Register addr, Register count, RegSet saved_regs) {}
|
Register addr, Register count, RegSet saved_regs) {}
|
||||||
virtual void gen_write_ref_array_post_barrier(MacroAssembler* masm, DecoratorSet decorators,
|
virtual void gen_write_ref_array_post_barrier(MacroAssembler* masm, DecoratorSet decorators,
|
||||||
Register start, Register end, Register tmp, RegSet saved_regs) {}
|
Register start, Register count, Register tmp, RegSet saved_regs) {}
|
||||||
|
|
||||||
virtual void oop_store_at(MacroAssembler* masm, DecoratorSet decorators, BasicType type,
|
virtual void oop_store_at(MacroAssembler* masm, DecoratorSet decorators, BasicType type,
|
||||||
Address dst, Register val, Register tmp1, Register tmp2) = 0;
|
Address dst, Register val, Register tmp1, Register tmp2) = 0;
|
||||||
@ -46,7 +46,7 @@ public:
|
|||||||
virtual void arraycopy_prologue(MacroAssembler* masm, DecoratorSet decorators, bool is_oop,
|
virtual void arraycopy_prologue(MacroAssembler* masm, DecoratorSet decorators, bool is_oop,
|
||||||
Register addr, Register count, RegSet saved_regs);
|
Register addr, Register count, RegSet saved_regs);
|
||||||
virtual void arraycopy_epilogue(MacroAssembler* masm, DecoratorSet decorators, bool is_oop,
|
virtual void arraycopy_epilogue(MacroAssembler* masm, DecoratorSet decorators, bool is_oop,
|
||||||
Register start, Register end, Register tmp, RegSet saved_regs);
|
Register start, Register count, Register tmp, RegSet saved_regs);
|
||||||
virtual void store_at(MacroAssembler* masm, DecoratorSet decorators, BasicType type,
|
virtual void store_at(MacroAssembler* masm, DecoratorSet decorators, BasicType type,
|
||||||
Address dst, Register val, Register tmp1, Register tmp2);
|
Address dst, Register val, Register tmp1, Register tmp2);
|
||||||
};
|
};
|
||||||
|
@ -73,16 +73,13 @@ void ShenandoahBarrierSetAssembler::arraycopy_prologue(MacroAssembler* masm, Dec
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ShenandoahBarrierSetAssembler::arraycopy_epilogue(MacroAssembler* masm, DecoratorSet decorators, bool is_oop,
|
void ShenandoahBarrierSetAssembler::arraycopy_epilogue(MacroAssembler* masm, DecoratorSet decorators, bool is_oop,
|
||||||
Register start, Register end, Register scratch, RegSet saved_regs) {
|
Register start, Register count, Register scratch, RegSet saved_regs) {
|
||||||
if (is_oop) {
|
if (is_oop) {
|
||||||
__ push(saved_regs, sp);
|
__ push(saved_regs, sp);
|
||||||
// must compute element count unless barrier set interface is changed (other platforms supply count)
|
assert_different_registers(start, count, scratch);
|
||||||
assert_different_registers(start, end, scratch);
|
assert_different_registers(c_rarg0, count);
|
||||||
__ lea(scratch, Address(end, BytesPerHeapOop));
|
|
||||||
__ sub(scratch, scratch, start); // subtract start to get #bytes
|
|
||||||
__ lsr(scratch, scratch, LogBytesPerHeapOop); // convert to element count
|
|
||||||
__ mov(c_rarg0, start);
|
__ mov(c_rarg0, start);
|
||||||
__ mov(c_rarg1, scratch);
|
__ mov(c_rarg1, count);
|
||||||
__ call_VM_leaf(CAST_FROM_FN_PTR(address, ShenandoahRuntime::write_ref_array_post_entry), 2);
|
__ call_VM_leaf(CAST_FROM_FN_PTR(address, ShenandoahRuntime::write_ref_array_post_entry), 2);
|
||||||
__ pop(saved_regs, sp);
|
__ pop(saved_regs, sp);
|
||||||
}
|
}
|
||||||
|
@ -78,7 +78,7 @@ public:
|
|||||||
virtual void arraycopy_prologue(MacroAssembler* masm, DecoratorSet decorators, bool is_oop,
|
virtual void arraycopy_prologue(MacroAssembler* masm, DecoratorSet decorators, bool is_oop,
|
||||||
Register addr, Register count, RegSet saved_regs);
|
Register addr, Register count, RegSet saved_regs);
|
||||||
virtual void arraycopy_epilogue(MacroAssembler* masm, DecoratorSet decorators, bool is_oop,
|
virtual void arraycopy_epilogue(MacroAssembler* masm, DecoratorSet decorators, bool is_oop,
|
||||||
Register start, Register end, Register tmp, RegSet saved_regs);
|
Register start, Register count, Register tmp, RegSet saved_regs);
|
||||||
virtual void load_at(MacroAssembler* masm, DecoratorSet decorators, BasicType type,
|
virtual void load_at(MacroAssembler* masm, DecoratorSet decorators, BasicType type,
|
||||||
Register dst, Address src, Register tmp1, Register tmp_thread);
|
Register dst, Address src, Register tmp1, Register tmp_thread);
|
||||||
virtual void store_at(MacroAssembler* masm, DecoratorSet decorators, BasicType type,
|
virtual void store_at(MacroAssembler* masm, DecoratorSet decorators, BasicType type,
|
||||||
|
@ -1375,8 +1375,6 @@ class StubGenerator: public StubCodeGenerator {
|
|||||||
__ pop(RegSet::of(d, count), sp);
|
__ pop(RegSet::of(d, count), sp);
|
||||||
if (VerifyOops)
|
if (VerifyOops)
|
||||||
verify_oop_array(size, d, count, r16);
|
verify_oop_array(size, d, count, r16);
|
||||||
__ sub(count, count, 1); // make an inclusive end pointer
|
|
||||||
__ lea(count, Address(d, count, Address::lsl(exact_log2(size))));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bs->arraycopy_epilogue(_masm, decorators, is_oop, d, count, rscratch1, RegSet());
|
bs->arraycopy_epilogue(_masm, decorators, is_oop, d, count, rscratch1, RegSet());
|
||||||
@ -1448,8 +1446,6 @@ class StubGenerator: public StubCodeGenerator {
|
|||||||
__ pop(RegSet::of(d, count), sp);
|
__ pop(RegSet::of(d, count), sp);
|
||||||
if (VerifyOops)
|
if (VerifyOops)
|
||||||
verify_oop_array(size, d, count, r16);
|
verify_oop_array(size, d, count, r16);
|
||||||
__ sub(count, count, 1); // make an inclusive end pointer
|
|
||||||
__ lea(count, Address(d, count, Address::lsl(exact_log2(size))));
|
|
||||||
}
|
}
|
||||||
bs->arraycopy_epilogue(_masm, decorators, is_oop, d, count, rscratch1, RegSet());
|
bs->arraycopy_epilogue(_masm, decorators, is_oop, d, count, rscratch1, RegSet());
|
||||||
__ leave();
|
__ leave();
|
||||||
@ -1842,8 +1838,7 @@ class StubGenerator: public StubCodeGenerator {
|
|||||||
__ br(Assembler::EQ, L_done_pop);
|
__ br(Assembler::EQ, L_done_pop);
|
||||||
|
|
||||||
__ BIND(L_do_card_marks);
|
__ BIND(L_do_card_marks);
|
||||||
__ add(to, to, -heapOopSize); // make an inclusive end pointer
|
bs->arraycopy_epilogue(_masm, decorators, is_oop, start_to, count_save, rscratch1, wb_post_saved_regs);
|
||||||
bs->arraycopy_epilogue(_masm, decorators, is_oop, start_to, to, rscratch1, wb_post_saved_regs);
|
|
||||||
|
|
||||||
__ bind(L_done_pop);
|
__ bind(L_done_pop);
|
||||||
__ pop(RegSet::of(r18, r19, r20, r21), sp);
|
__ pop(RegSet::of(r18, r19, r20, r21), sp);
|
||||||
|
Loading…
Reference in New Issue
Block a user