Details
-
Bug
-
Resolution: Fixed
-
P3
-
11.0.2, 17, 19.0.2, 21
-
b25
-
aarch64
-
os_x
Backports
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8311924 | 17.0.9-oracle | Tobias Hartmann | P3 | Resolved | Fixed | b03 |
JDK-8312449 | 17.0.9 | Goetz Lindenmaier | P3 | Resolved | Fixed | b01 |
Description
aarch64, Apple M1 Max, macOS 13.2.1
A DESCRIPTION OF THE PROBLEM :
Math.log using the generic dlog intrinsic is much slower than StrictMath.log on aarch64.
Caused by
Related to
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
javac Main.java
java Main
java -XX:+UnlockDiagnosticVMOptions -XX:DisableIntrinsic=_dlog Main
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The elapsed time without additional options is less than or equal to the time with the _dlog intrinsic disabled.
ACTUAL -
java Main
6200ms
java -XX:+UnlockDiagnosticVMOptions -XX:DisableIntrinsic=_dlog Main
860ms
---------- BEGIN SOURCE ----------
import java.util.Random;
import java.util.concurrent.TimeUnit;
public class Main {
public static void main(String[] args) throws Exception {
while (true) {
final Random random = new Random();
final double[] values = new double[100_000_000];
for (int i = 0; i < values.length; i++)
values[i] = random.nextDouble();
System.gc();
final long start = System.nanoTime();
double blackhole = 0;
for (int i = 0; i < values.length; i++)
blackhole += Math.log(values[i]);
final long elapsed = TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - start);
System.out.println(elapsed + "ms (" + blackhole + ")");
}
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Disable the _dlog intrinsic on aarch64 like -XX:DisableIntrinsic=_dlog do and use the StrictMath implementation.
FREQUENCY : always
Attachments
Issue Links
- backported by
-
JDK-8311924 Major performance regression in Math.log on aarch64
- Resolved
-
JDK-8312449 Major performance regression in Math.log on aarch64
- Resolved
- relates to
-
JDK-8215133 AARCH64: disable Math.log intrinsic publishing
- Resolved
-
JDK-8307817 AARCH64: make macOS W^X locking more fine grained
- In Progress
-
JDK-8327036 [macosx-aarch64] SIGBUS in MarkActivationClosure::do_code_blob reached from Unsafe_CopySwapMemory0
- Resolved
-
JDK-8316392 compiler/interpreter/TestVerifyStackAfterDeopt.java failed with SIGBUS in PcDescContainer::find_pc_desc_internal
- Closed
-
JDK-8330171 Lazy W^X switch implementation
- Closed
- links to
-
Commit openjdk/jdk17u-dev/4b8c6b8f
-
Commit openjdk/jdk/466ec300
-
Review openjdk/jdk17u-dev/1588
-
Review openjdk/jdk/13606