-
Bug
-
Resolution: Fixed
-
P3
-
21
-
b03
-
arm
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8311331 | 21.0.1 | Tobias Hartmann | P3 | Resolved | Fixed | b02 |
JDK-8310604 | 21 | Tobias Hartmann | P3 | Resolved | Fixed | b29 |
TestBooleanVector crashes on Arm32 after these changes:
From 6b2a86a65ef530002aea35ded45d75e04c223802 Mon Sep 17 00:00:00 2001
From: Roland Westrelin <roland@openjdk.org>
Date: Fri, 7 Apr 2023 12:51:44 +0000
Subject: [PATCH] 8300257: C2: vectorization fails on some simple Memory
The reason for the crash is that after moving an invariant out of the loop, the vector store instruction gets an unaligned address of the array.
;; B20: # out( B20 B21 ) <- in( B19 B20 ) Loop( B20-B20 inner main of N111 strip mined) Freq: 1.04314e+07
0xf3dbdd10: sub r5, r7, r6
0xf3dbdd14: add r8, r4, r5
0xf3dbdd18: mvn ip, #2
0xf3dbdd1c: add r9, r8, #5
0xf3dbdd20: add r5, r8, ip
=> 0xf3dbdd24: vstr d13, [r9]
The issue can be reproduced using this simple program:
public class TestBooleanVect {
public static void main(String args[]) {
boolean[] a = new boolean[997];
for (int i = 0; i < 1000; i++) {
int limit = a.length-1;
for (int j = 0; j < a.length; j+=1) {
a[limit-j] = false;
}
}
}
}
The alignment of Array likely changes on all platforms, when we move the invariant out of the loop. ARM32 doesn't allow unaligned access by vector instruction and crashes.
From 6b2a86a65ef530002aea35ded45d75e04c223802 Mon Sep 17 00:00:00 2001
From: Roland Westrelin <roland@openjdk.org>
Date: Fri, 7 Apr 2023 12:51:44 +0000
Subject: [PATCH] 8300257: C2: vectorization fails on some simple Memory
The reason for the crash is that after moving an invariant out of the loop, the vector store instruction gets an unaligned address of the array.
;; B20: # out( B20 B21 ) <- in( B19 B20 ) Loop( B20-B20 inner main of N111 strip mined) Freq: 1.04314e+07
0xf3dbdd10: sub r5, r7, r6
0xf3dbdd14: add r8, r4, r5
0xf3dbdd18: mvn ip, #2
0xf3dbdd1c: add r9, r8, #5
0xf3dbdd20: add r5, r8, ip
=> 0xf3dbdd24: vstr d13, [r9]
The issue can be reproduced using this simple program:
public class TestBooleanVect {
public static void main(String args[]) {
boolean[] a = new boolean[997];
for (int i = 0; i < 1000; i++) {
int limit = a.length-1;
for (int j = 0; j < a.length; j+=1) {
a[limit-j] = false;
}
}
}
}
The alignment of Array likely changes on all platforms, when we move the invariant out of the loop. ARM32 doesn't allow unaligned access by vector instruction and crashes.
- backported by
-
JDK-8310604 ARM32: TestBooleanVector crashes after 8300257
-
- Resolved
-
-
JDK-8311331 ARM32: TestBooleanVector crashes after 8300257
-
- Resolved
-
- relates to
-
JDK-8300257 C2: vectorization fails on some simple Memory Segment loops
-
- Resolved
-
- links to
-
Commit openjdk/jdk21/5357bcd7
-
Commit openjdk/jdk/266f9838
-
Review openjdk/jdk21/48
-
Review openjdk/jdk/14508
(2 links to)