Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8295066

Folding of loads is broken in C2 after JDK-8242115

XMLWordPrintable

    • b22

        When merging JDK-8242115 into Valhalla, we noticed massive failures with our IR verification tests. It turned out that (at least) folding of loads is broken. For example, with the following test (attached):

            static class MyClass {
                int x = 42;
            }

            public static int test() {
                MyClass[] array = new MyClass[1];
                array[0] = new MyClass();
                return array[0].x;
            }

        Before JDK-8242115, the load from the array is constant folded to 42 and the MyClass array and object allocations are removed. This does not work anymore after the fix, leading to a significant performance regression in microbenchmarks.

        To reproduce, simply run:
        java -XX:+AlwaysIncrementalInline -XX:CompileCommand=quiet -XX:CompileCommand=compileonly,Test::test -Xbatch -XX:CompileCommand=print,Test::test -XX:-TieredCompilation Test.java

        and check _new_array_Java and _new_instance_Java calls in compiled code.

        There might be more issues but we can check that by applying a prototype fix and re-running Valhalla tests. For now, we omitted JDK-8242115 when merging master into Valhalla.

          1. 8295066.patch
            1 kB
          2. 8295066-2.patch
            15 kB
          3. Test.java
            0.3 kB
          4. Test2.java
            0.7 kB

              iveresov Igor Veresov
              thartmann Tobias Hartmann
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Created:
                Updated:
                Resolved: