Integrated: 8264135: UnsafeGetStableArrayElement should account for different JIT implementation details
Doug Simon
dnsimon at openjdk.java.net
Fri Mar 26 10:14:27 UTC 2021
On Wed, 24 Mar 2021 21:03:15 GMT, Doug Simon <dnsimon at openjdk.org> wrote:
> 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.
This pull request has now been integrated.
Changeset: 5a930c42
Author: Doug Simon <dnsimon at openjdk.org>
URL: https://git.openjdk.java.net/jdk/commit/5a930c42
Stats: 18 lines in 1 file changed: 13 ins; 0 del; 5 mod
8264135: UnsafeGetStableArrayElement should account for different JIT implementation details
Reviewed-by: vlivanov, never
-------------
PR: https://git.openjdk.java.net/jdk/pull/3180
More information about the hotspot-compiler-dev
mailing list