[aarch64-port-dev ] [OpenJDK8u] java.nio.Bits.unaligned() doesn't handle aarch64
White, Derek
Derek.White at cavium.com
Thu May 11 17:20:08 UTC 2017
In aarch64-port/jdk8u, java.nio.Bits.unaligned() only returns true for x86(s).
This ends up being important because Apache Spark uses Bits.unaligned() to decide if it can use off-heap memory or not.
In mainline jdk8u, this was updated to include PPC as well (See https://bugs.openjdk.java.net/browse/JDK-8165231). JDK9 has a much better fix that supports aarch64 already.
Tested on Spark and off-heap memory was being used. Note: The PPC fix also patched sun/security/provider/ByteArrayAccess.java, but I didn't include this in the patch below (not sure if it matters, or how to test it).
This is my first attempt at an aarch64-jdk8u patch. Please let me know if I'm not following protocol correctly.
Thanks,
- Derek
Patch follows (in jdk/src).
--- old/src/share/classes/java/nio/Bits.java 2017-05-11 13:10:31.916219496 -0400
+++ new/src/share/classes/java/nio/Bits.java 2017-05-11 13:10:31.832221728 -0400
@@ -614,7 +614,9 @@
String arch = AccessController.doPrivileged(
new sun.security.action.GetPropertyAction("os.arch"));
unaligned = arch.equals("i386") || arch.equals("x86")
- || arch.equals("amd64") || arch.equals("x86_64");
+ || arch.equals("amd64") || arch.equals("x86_64")
+ || arch.equals("ppc64") || arch.equals("ppc64le")
+ || arch.equals("aarch64");
unalignedKnown = true;
return unaligned;
}
More information about the aarch64-port-dev
mailing list