RFR(S): 8241091: AArch64: "bad AD file" with VM option "-XX:-UsePopCountInstruction"
Pengfei Li
Pengfei.Li at arm.com
Thu Mar 19 08:08:00 UTC 2020
Hi,
AArch64 C2 shows an internal error of "bad AD file" when VM option "UsePopCountInstruction" is disabled. This can be reproduced by below simple case with fastdebug build.
public class Foo {
private static int bar(int x) {
return Integer.bitCount(x);
}
public static void main(String[] args) {
int sum = 0;
for (int i = 0; i < 30000; i++) {
sum += bar(i);
}
System.out.println(sum);
}
}
Cause is that the PopCountINode or PopCountLNode is created but no match rule for it without "UsePopCountInstruction" enabled. One fix [1] for this is to avoid creating the nodes. As the CNT instruction is available on all AArch64 CPUs and the bitCount() would be ~7x slower (according to my local test) if it's disabled, there is another fix [2] that force the flag to be true on AArch64. But I'm not sure if it's good to ignore a general vm option in an architecture backend.
[1] http://cr.openjdk.java.net/~pli/rfr/8241091/webrev.00/
[2] http://cr.openjdk.java.net/~pli/rfr/8241091/webrev.01/
JBS: https://bugs.openjdk.java.net/browse/JDK-8241091
Please let me know which kind of fix do you prefer, or any other comments.
--
Thanks,
Pengfei
More information about the hotspot-compiler-dev
mailing list