| JDK 20 |
|---|
| 20 b02Fixed |
|
Relates :
|
|
|
Relates :
|
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.
|