-
Enhancement
-
Resolution: Won't Fix
-
P4
-
19
file this on hehalf of xiangyuan@tencent.com
https://bugs.openjdk.java.net/browse/JDK-8072070 has optimzied stack bang performance. In this optimization when the sp is below than growth watermark, the value of sp will set as growth watermark directly. In fact, when the sp remains in the same page, the n_shadow_pages pages below sp are all banged. Therefore, sp can be aligned to page boundary first, and set the aligned value to growth watermark, it will likely save some unnecessary growth watermark saving operations and stack banging.
test Xint with following recursive example, both x86-64 and aarch64 show improvements up to 50%.
@Param({"128", "256", "512", "1024"})
public int depth = 0;
@Param({"1", "10", "100", "1000"})
public int count = 0;
@Benchmark
public void testStackBang() throws Exception {
Thread thread = new Thread(new Runnable() {
public void run() {
for (int i = 0;i < count; i++) {
recursive(depth);
}
}
});
thread.start();
thread.join();
}
private void recursive(int i) {
if (i == 0) {
return;
}
recursive(i - 1);
}
https://bugs.openjdk.java.net/browse/JDK-8072070 has optimzied stack bang performance. In this optimization when the sp is below than growth watermark, the value of sp will set as growth watermark directly. In fact, when the sp remains in the same page, the n_shadow_pages pages below sp are all banged. Therefore, sp can be aligned to page boundary first, and set the aligned value to growth watermark, it will likely save some unnecessary growth watermark saving operations and stack banging.
test Xint with following recursive example, both x86-64 and aarch64 show improvements up to 50%.
@Param({"128", "256", "512", "1024"})
public int depth = 0;
@Param({"1", "10", "100", "1000"})
public int count = 0;
@Benchmark
public void testStackBang() throws Exception {
Thread thread = new Thread(new Runnable() {
public void run() {
for (int i = 0;i < count; i++) {
recursive(depth);
}
}
});
thread.start();
thread.join();
}
private void recursive(int i) {
if (i == 0) {
return;
}
recursive(i - 1);
}
- relates to
-
JDK-8072070 Improve interpreter stack banging
- Resolved
- links to
-
Review openjdk/jdk/8951