-
Bug
-
Resolution: Fixed
-
P4
-
11, 17
-
b16
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8321453 | 11.0.23-oracle | Mimoun Ghordou | P4 | Resolved | Fixed | b01 |
JDK-8322948 | 11.0.23 | Andrew Lu | P4 | Resolved | Fixed | b01 |
The UnsafeGetStableArrayElement jtreg tests fails on GraalVM because it asserts semantics implemented by C1 and C2 that are beyond the spec of @Stable. In particular, it asserts that the JIT will not constant fold an unsafe read of a stable array element if the type of the read does not match the type of the array element. For example:
@Stable static final byte[] STABLE_BYTE_ARRAY = {Byte.MAX_VALUE, 0, 0, 0};
@Stable static final int[] STABLE_INT_ARRAY = {Integer.MAX_VALUE, 0, 0, 0};
unsafe.getInt(STABLE_BYTE_ARRAY, ARRAY_BYTE_BASE_OFFSET);
unsafe.getByte(STABLE_INT_ARRAY, ARRAY_INT_BASE_OFFSET);
The Graal compiler will constant fold these reads where as C1 and C2 will not. Both implementations are permissible. There are no predictability guarantees about constant-folding provided by Stable and it's perfectly fine not to optimize stable fields/arrays at all.
The test should be modified to take into account the JIT being used when deciding what is to be asserted.
@Stable static final byte[] STABLE_BYTE_ARRAY = {Byte.MAX_VALUE, 0, 0, 0};
@Stable static final int[] STABLE_INT_ARRAY = {Integer.MAX_VALUE, 0, 0, 0};
unsafe.getInt(STABLE_BYTE_ARRAY, ARRAY_BYTE_BASE_OFFSET);
unsafe.getByte(STABLE_INT_ARRAY, ARRAY_INT_BASE_OFFSET);
The Graal compiler will constant fold these reads where as C1 and C2 will not. Both implementations are permissible. There are no predictability guarantees about constant-folding provided by Stable and it's perfectly fine not to optimize stable fields/arrays at all.
The test should be modified to take into account the JIT being used when deciding what is to be asserted.
- backported by
-
JDK-8321453 UnsafeGetStableArrayElement should account for different JIT implementation details
-
- Resolved
-
-
JDK-8322948 UnsafeGetStableArrayElement should account for different JIT implementation details
-
- Resolved
-
- relates to
-
JDK-8309104 [JVMCI] compiler/unsafe/UnsafeGetStableArrayElement test asserts wrong values with Graal
-
- Resolved
-
- links to
-
Commit openjdk/jdk11u-dev/325fc37c
-
Commit openjdk/jdk/5a930c42
-
Review openjdk/jdk11u-dev/2420
-
Review openjdk/jdk/3180
(2 links to)