There is a system register bit to read, but I don't think it can be accessed by an application, only the kernel. If the OS won't provide this information, you could do something similar to safeFetchN and catch the
resulting SIGBUS.

dl

On 2/13/2015 4:05 PM, Vladimir Kozlov wrote:
x86 has flag UseUnalignedLoadStores which is set to true depending on which version of CPU VM runs. The CPU version is determined based on CPUID instruction results.

Does AARCH64 has something similar?

Regards,
Vladimir

On 2/13/15 3:41 PM, Dean Long wrote:
On 2/13/2015 3:04 PM, chris...@zoulas.com wrote:
On Feb 13,  2:52pm, dean.l...@oracle.com (Dean Long) wrote:
-- Subject: Re: RFR: 8073093: AARCH64: C2 generates poor code for
ByteBuffer

| My understanding is that whether or not aarch64 allows unaligned=20
| accesses is based on a
| system setting, so this change is too simplistic.  I would prefer
that=20
| this was controlled with
| something more flexible, like "sun.cpu.unaligned".

So does x86_64 and you can ask the CPU if it is enabled... I am not sure
if a variable setting makes sense because if alignment is required you
get a signal (BUS error -- hi linux, SEGV), or incorrect results.

christos

So it sounds like we need to determine if unaligned accesses are
supported during startup,
in a platform-specific way.  This could be exposed through a property
like I suggested,
or perhaps a new Unsafe method.

Regarding x86_64, there may be places in the JVM that already assume
unaligned accesses
are allowed, so disabling them may completely break the JVM until those
assumptions
are fixed.

dl

Reply via email to