RFR: 8372779: C2: Disambiguate Node::adr_type for the IR graph [v3]

Quan Anh Mai qamai at openjdk.org
Wed Dec 10 17:40:43 UTC 2025


On Wed, 10 Dec 2025 13:18:48 GMT, Emanuel Peter <epeter at openjdk.org> wrote:

>> Quan Anh Mai has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains three additional commits since the last revision:
>> 
>>  - Merge branch 'master' into adrtype
>>  - store_to_memory does not emit MemBars
>>  - Disambiguate Node::adr_type
>
> @merykitty I can't promise that I'll review the PR yet. But I have an initial question:
> Since some cases were wrong, does that mean we can find reproducers for those cases? Because it may be worth backporting some cases, but we would first need to know if there are cases that actually are currently wrong.

@eme64 Thanks a lot for taking a look. Normally, those intrinsics are not exposed bare, so it is hard to misschedule them. But I can craft one, at least on my machine, it fails with only `--add-opens=java.base/java.lang=ALL-UNNAMED`

    import java.lang.invoke.MethodHandle;
    import java.lang.invoke.MethodHandles;
    import java.lang.invoke.MethodType;

    public class TestAntiDependency {
        static final MethodHandle COMPRESS_HANDLE;
        static {
            try {
                var lookup = MethodHandles.privateLookupIn(String.class, MethodHandles.lookup());
                Class<?> stringUtf16Class = lookup.findClass("java.lang.StringUTF16");
                COMPRESS_HANDLE = lookup.findStatic(stringUtf16Class, "compress", MethodType.methodType(int.class, char[].class, int.class, byte[].class, int.class, int.class));
            } catch (Exception e) {
                throw new RuntimeException(e);
            }
        }

        public static void main(String[] args) throws Throwable {
            for (int i = 0; i < 50000; i++) {
                if (test() != 0) {
                    throw new AssertionError();
                }
            }
        }

        static int test() throws Throwable {
            char[] src = new char[4];
            byte[] dst = new byte[4];

            int l = (int) COMPRESS_HANDLE.invokeExact(src, 0, dst, 0, 4);
            src[0] = 1;
            return dst[0];
        }
    }

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

PR Comment: https://git.openjdk.org/jdk/pull/28570#issuecomment-3638228258


More information about the shenandoah-dev mailing list