[aarch64-port-dev ] RFR: Fix out by one in writing array barriers
Edward Nevill
edward.nevill at linaro.org
Thu Dec 12 06:30:12 PST 2013
On Thu, 2013-12-12 at 13:30 +0000, Andrew Haley wrote:
> The first store is done to [base + [end >> card_shift]]. I think this
> is wrong, because [base + [end >> card_shift]] is outside the range.
> We need to make in an inclusive pointer. So, we need to subtract 1
> from end, not add it:
>
> __ lsr(start, start, CardTableModRefBS::card_shift);
> __ sub(end, end, BytesPerHeapOop); // end - 1 to make inclusive
> __ lsr(end, end, CardTableModRefBS::card_shift);
> __ sub(end, end, start); // number of bytes to copy
>
> const Register count = end; // 'end' register contains bytes count now
> __ mov(scratch, (address)ct->byte_map_base);
> __ add(start, start, scratch);
> __ BIND(L_loop);
> __ strb(zr, Address(start, count));
> __ subs(count, count, 1);
> __ br(Assembler::HS, L_loop);
But the end pointer is already inclusive, looking at the 3 calls to gen_write_ref_array_post_barrier in stubGenerator_aarch64.cpp
1)
1268 __ sub(count, count, 1); // make an inclusive end pointer
1269 __ lea(count, Address(d, count, Address::uxtw(exact_log2(size))));
1270 gen_write_ref_array_post_barrier(d, count, rscratch1);
2)
1320 __ sub(count, count, 1); // make an inclusive end pointer
1321 __ lea(count, Address(d, count, Address::uxtw(exact_log2(size))));
1322 gen_write_ref_array_post_barrier(d, count, rscratch1);
3)
1699 __ add(to, to, -heapOopSize); // make an inclusive end point er
1700 gen_write_ref_array_post_barrier(start_to, to, rscratch1);
Regards,
Ed.
More information about the aarch64-port-dev
mailing list