-
Enhancement
-
Resolution: Fixed
-
P4
-
19, 20
-
b02
The loop body to optimize is:
for (int i = 0; i < size; i++) {
long j = i * UNSAFE.ARRAY_INT_INDEX_SCALE;
j = Objects.checkIndex(j, size * 4);
if (((base + j) & 3) != 0) {
throw new RuntimeException();
}
v += UNSAFE.getInt(base + j);
}
loop iv is first scaled, result is then casted to long, range checked and finally address of memory location is computed.
for (int i = 0; i < size; i++) {
long j = i * UNSAFE.ARRAY_INT_INDEX_SCALE;
j = Objects.checkIndex(j, size * 4);
if (((base + j) & 3) != 0) {
throw new RuntimeException();
}
v += UNSAFE.getInt(base + j);
}
loop iv is first scaled, result is then casted to long, range checked and finally address of memory location is computed.
- relates to
-
JDK-8328938 C2 SuperWord: disable vectorization for large stride and scale
-
- Resolved
-