On 03/09/2015 12:04 AM, Peter Levart wrote:


On 03/08/2015 12:13 PM, Andrew Haley wrote:
>That's OK if you think this approach is a better division of
>concerns (Unsafe being low-level), but in Heap-X-Buffer you are only
>using Unsafe.get|putXXXUnaligned() and don't consider using
>get|putXXX directly when unalignedAccess() == true.
Right, because there's no point in doing so when unalignedAccess() ==
true because the exact same code will be generated.  In my Utopian
world nothing except Unsafe would have to deal with issues such as
this.  However, I think that people writing library code (e.g. array
comparison intrinsics) might still need to know.

Ah, sorry. I haven't realized that the same code will be generated by compiler intrinsics. So the Java part is just for interpreter and platforms not supporting unaligned access and when UseUnalignedAccesses is explicitly disabled?

If the last statement is true, then perhaps instead of UseUnalignedAccesses, the flag could be called EmulateUnalignedAccesses (with the opposite meaning), so that you can always turn it ON (for testing), but can't turn it OFF on platforms that don't support unaligned access.

Peter

Reply via email to