RFR: 8264135: UnsafeGetStableArrayElement should account for different JIT implementation details [v2]
Vladimir Ivanov
vlivanov at openjdk.java.net
Fri Mar 26 10:07:25 UTC 2021
On Wed, 24 Mar 2021 22:15:00 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.
>
> 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.
Looks good.
-------------
Marked as reviewed by vlivanov (Reviewer).
PR: https://git.openjdk.java.net/jdk/pull/3180
More information about the hotspot-compiler-dev
mailing list