RFR: 8225716: G1 GC: Undefined behaviour in G1BlockOffsetTablePart::block_at_or_preceding

Kim Barrett kim.barrett at oracle.com
Fri Jun 14 21:51:29 UTC 2019

> On Jun 14, 2019, at 3:32 PM, Kim Barrett <kim.barrett at oracle.com> wrote:
>> On Jun 14, 2019, at 11:23 AM, Andrew Haley <aph at redhat.com> wrote:
>> One thing which gave me pause was the need to cast away const when

And just to be clear, it’s a const_cast to cast away _volatile_.  It’s unfortunate
that const_cast has that double duty.

>> calling memset_with_concurrent_readers(). I don't think it's actually
>> wrong, given that memset_with_concurrent_readers() has the
>> specification we need: we don't need strict volatile behaviour in the
>> sense of ordering. We just need to be sure that there are no
>> intermediate values other than what we ask for.
> I think it's probably a bug that memset_with_concurrent_readers
> doesn't take a pointer to volatile buffer or doesn't have an
> appropriate overload.  Of course, that function ought to be merged
> into Copy::fill_to_memory_atomic (see JDK-8142349).  It's probably a
> bug that the Copy::*_atomic functions don't provide support for
> volatile buffers.  I'm okay with the const_cast here.

More information about the hotspot-gc-dev mailing list