-
Enhancement
-
Resolution: Fixed
-
P4
-
17, 18
-
b28
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8278716 | 19 | Roland Westrelin | P4 | Resolved | Fixed | b28 |
((segmentBaseAddress + accessedOffset) & alignmentMask) == 0
However, when accessing a segment using a var handle obtained from a layout featuring a non-trivial alignment mask, access performance is slower than in the case where the alignment mask is 0.
The attached patch adds a benchmark which shows the problem; the benchmark compares accessing a segment using a 4-byte aligned vs. a 1-byte aligned layout:
```
Benchmark Mode Cnt Score Error Units
LoopOverNonConstant.segment_loop_instance_index avgt 30 0.229 ? 0.001 ms/op
LoopOverNonConstant.segment_loop_instance_index_aligned avgt 30 0.329 ? 0.005 ms/op
```
As it can be seen, access with alignment constraints is slower.
This is mildly surprising - after all, in the above formula, segmentBaseAddress is a loop invariant - whereas accessedOffset typically depends on the loop variable, so existing BCE logic should kick in and detect that the offset is always aligned (given the loop stride).
- backported by
-
JDK-8278716 C2: optimize mask checks in counted loops
-
- Resolved
-
- relates to
-
JDK-8288683 C2: And node gets wrong type due to not adding it back to the worklist in CCP
-
- Closed
-
-
JDK-8278857 C2: optimize (x << 2) & -4 to x (and similar patterns)
-
- Open
-
-
JDK-8278949 Cleanups for 8277850
-
- Resolved
-
-
JDK-8285793 C2: optimization of mask checks in counted loops fail in the presence of cast nodes
-
- Resolved
-
-
JDK-8346664 C2: Optimize mask check with constant offset
-
- Resolved
-
-
JDK-8307619 C2 failed: Not monotonic (AndI CastII LShiftI) in TestShiftCastAndNotification.java
-
- Resolved
-