RFR: 8264135: UnsafeGetStableArrayElement should account for different JIT implementation details [v2]

Doug Simon dnsimon at openjdk.java.net
Wed Mar 24 22:15:00 UTC 2021


> The `UnsafeGetStableArrayElement` test fails on GraalVM because it asserts implementation specific behavior of C1 and C2. 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.
> 
> This PR modifies the test to take into account the JIT being used when deciding what to assert.

Doug Simon has refreshed the contents of this pull request, and previous commits have been removed. The incremental views will show differences compared to the previous content of the PR. The pull request contains one new commit since the last revision:

  8264135: UnsafeGetStableArrayElement should account for different JIT implementation details

-------------

Changes:
  - all: https://git.openjdk.java.net/jdk/pull/3180/files
  - new: https://git.openjdk.java.net/jdk/pull/3180/files/2f85ab06..2f679955

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk&pr=3180&range=01
 - incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=3180&range=00-01

  Stats: 85 lines in 1 file changed: 10 ins; 2 del; 73 mod
  Patch: https://git.openjdk.java.net/jdk/pull/3180.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/3180/head:pull/3180

PR: https://git.openjdk.java.net/jdk/pull/3180


More information about the hotspot-compiler-dev mailing list