Unsafe.{get,put}-X-Unaligned; Efficient array comparison intrinsics

Andrew Haley aph at redhat.com
Mon Mar 9 09:06:51 UTC 2015

On 08/03/15 23:04, 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?

That's right.  You really have to look at both of these patches, the
HotSpot and the JDK part, for this approach to make sense.


More information about the hotspot-compiler-dev mailing list