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

[lworld][lw3] C1 produces incorrect code when GlobalValueNumbering is used

XMLWordPrintable

      C1 sometimes produces incorrect code when GlobalValueNumbering is used.

      To reproduce the issue:

      public class PutFieldTest {
          static primitive class Point {
      int x,y;
      public Point() {
      x = 0; y = 0;
      }
      public Point(int x, int y) {
      this.x = x; this.y = y;
      }
          }

          Point p;
          
          static void test() {
      Point p = new Point(4,5);
      PutFieldTest test = new PutFieldTest();
      assert test.p.x == 0;
      assert test.p.y == 0;
      test.p = p;
      System.out.println(test.p);
      assert test.p.x == 4;
      assert test.p.y == 5;
          }

          public static void main(String[] args) {
      for (int i = 0; i < 10; i++) {
      test();
      }
          }
      }

      Run with GlobalValueNumbering on:
      $ ./build/lworld/images/jdk/bin/java -ea -Xcomp -XX:TieredStopAtLevel=1 -XX:-UseLocalValueNumbering -XX:+UseGlobalValueNumbering -XX:CompileCommand=compileonly,PutFieldTest::\* PutFieldTest
      CompileCommand: compileonly PutFieldTest.* bool compileonly = true
      [PutFieldTest$Point x=4 y=5]
      [PutFieldTest$Point x=0 y=0]
      [PutFieldTest$Point x=0 y=0]
      [PutFieldTest$Point x=0 y=0]
      [PutFieldTest$Point x=0 y=0]
      [PutFieldTest$Point x=0 y=0]
      [PutFieldTest$Point x=0 y=0]
      [PutFieldTest$Point x=0 y=0]
      [PutFieldTest$Point x=0 y=0]
      [PutFieldTest$Point x=0 y=0]

      Run with GlobalValueNumbering off:

      $ ./build/lworld/images/jdk/bin/java -ea -Xcomp -XX:TieredStopAtLevel=1 -XX:-UseLocalValueNumbering -XX:-UseGlobalValueNumbering -XX:CompileCommand=compileonly,PutFieldTest::\* PutFieldTest
      CompileCommand: compileonly PutFieldTest.* bool compileonly = true
      [PutFieldTest$Point x=4 y=5]
      [PutFieldTest$Point x=4 y=5]
      [PutFieldTest$Point x=4 y=5]
      [PutFieldTest$Point x=4 y=5]
      [PutFieldTest$Point x=4 y=5]
      [PutFieldTest$Point x=4 y=5]
      [PutFieldTest$Point x=4 y=5]
      [PutFieldTest$Point x=4 y=5]
      [PutFieldTest$Point x=4 y=5]
      [PutFieldTest$Point x=4 y=5]

            fparain Frederic Parain
            fparain Frederic Parain
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: