RFR JDK-8141491: Unaligned memory access in Bits.c

John Rose john.r.rose at oracle.com
Tue Jan 26 19:13:32 UTC 2016


On Jan 26, 2016, at 11:08 AM, Andrew Haley <aph at redhat.com> wrote:
> 
> On 01/26/2016 07:04 PM, John Rose wrote:
>> Unsafe.copyMemory bottoms out to Copy::conjoint_memory_atomic.
>> IMO that's a better starting point than memcpy.  Perhaps it can be
>> given an additional parameter (or overloading) to specify a swap size.
> 
> OK, but conjoint_memory_atomic doesn't guarantee that destination
> words won't be torn if their source is misaligned: in fact it
> guarantees that they will will be.

That's a good point, and argues for a new function with the
stronger guarantee.  Actually, it would be perfectly reasonable
to strengthen the guarantee on the existing function.  I don't
think anyone will care about the slight performance change,
especially since it is probably favorable.  Since it's Unsafe,
they are not supposed to care, either.

— John


More information about the hotspot-dev mailing list