RFR: 8237521: Memory Access API fixes for 32-bit
nick.gasson at arm.com
Thu Jan 23 08:02:26 UTC 2020
On 01/23/20 15:46 pm, David Holmes wrote:
> So on 32-bit size_t is 32-bit and so may have ~half the capacity allowed
> for by the jlong size variable. On 64-bit overflow is not possible
> because jlong is signed and size_t is not.
> So we only need an overflow check on 32-bit.
OK. So wrap the check in #ifndef _LP64?
> But your checks don't look correct to me. If size is already aligned to
> HeapWordSize then "sz < (size_t)size" won't be true but you already have
> a completely bogus value for sz when you truncated size to 32-bits.
On a 32-bit system we already know the upper 32-bits of `size' are zero
because Unsafe.checkSize() checks this prior to calling the native
function, so I think the cast is OK.
More information about the hotspot-runtime-dev