RFR: 8256732: Zero: broken +ZeroTLAB exposes badly initialized memory

Aleksey Shipilev shade at openjdk.java.net
Tue Mar 16 08:58:06 UTC 2021


On Fri, 5 Mar 2021 13:52:08 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:

>>> 
>>> 
>>> > But isn't the memory returned by ThreadLocalAllocBuffer::allocate implicitly already zeroed when ZeroTLAB is specified?
>>> 
>>> No! That tripped me too! The comment at `ThreadLocalAllocBuffer::allocate` actually says: `// Allocate size HeapWords. The memory is NOT initialized to zero.`
>> 
>> But is that comment true? Does it really mean "The memory is NOT initialized (unless ZeroTLAB has been set)" ?
>> 
>> If ZeroTLAB is not actually zeroing all memory returned via TLAB then something seems far more broken than just Zero!
>
>> If ZeroTLAB is not actually zeroing all memory returned via TLAB then something seems far more broken than just Zero!
> 
> I think I figured it out: Zero picks the short stick with space mangling. The rest of Hotspot code does not call that method directly, and instead goes through various `MemoryAllocator` classes (which I am not sure we can touch without the VM transition). So, I fixed this by allowing debug builds to initialize object field block again.

Anyone? :)

-------------

PR: https://git.openjdk.java.net/jdk/pull/1343


More information about the hotspot-runtime-dev mailing list