RFR: 8335392: C2 MergeStores: enhanced pointer parsing [v6]

Emanuel Peter epeter at openjdk.org
Tue Oct 29 17:45:27 UTC 2024


On Tue, 29 Oct 2024 14:28:49 GMT, Emanuel Peter <epeter at openjdk.org> wrote:

>> src/hotspot/share/opto/mempointer.hpp line 365:
>> 
>>> 363:   {
>>> 364:     const jint max_distance = 1 << 30;
>>> 365:     assert(_distance < max_distance && _distance > -max_distance, "safe distance");
>> 
>> The variable name "max_distance" suggests that the assert should use `>=` and `<=`. Would that still be correct? Maybe you should add a comment about the max distance and why it has this value.
>
> Good point. I'll try to remember the reason and add better comments.

Woopsies. I think this was a left-over from something earlier. I was able to trigger this assert with this:


    static long[] arr201 = new long[1 << 28];

    public static void test201() {
        UNSAFE.putByte(arr201, Unsafe.ARRAY_LONG_BASE_OFFSET + (1L << 12),              (byte)64);
        UNSAFE.putByte(arr201, Unsafe.ARRAY_LONG_BASE_OFFSET + (1L << 12) + (1L << 30), (byte)64);
    }

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

PR Review Comment: https://git.openjdk.org/jdk/pull/19970#discussion_r1821292124


More information about the hotspot-compiler-dev mailing list