On 01/26/2016 06:32 PM, John Rose wrote:
> On Jan 26, 2016, at 1:04 AM, Andrew Haley <[email protected]> wrote:
>>
>> I agree that memcpy is the right thing to use. It's portable and is
>> inlined well on production-quality C compilers.
>
> But it is not strong enough to uphold the Java memory model,
> because it is allows to copy byte-wise, which can tear shorts,
> ints, or longs, creating illegal race states.
>
> So we try to avoid memcpy when we can.
Yes, I see. I guess the best we can do is something like the fun and
games in Unsafe.{get, put}LongUnaligned(), which always do the best
they can to align everything.
Andrew.