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

[lworld] Redundant allocations should be removed even when loop opts are not triggered

XMLWordPrintable

          static primitive class MyPrimitive41_2 {
              int x;

              @ForceInline
              public MyPrimitive41_2() {
                  this.x = 42;
              }
          }

          static primitive class MyPrimitive41_1 {
              MyPrimitive41_2.ref val;

              @ForceInline
              public MyPrimitive41_1() {
                  this.val = new MyPrimitive41_2();
              }
          }

          static MyPrimitive41_1 f1;
          static MyPrimitive41_1 f2;

          // Verify that redundant allocations are removed even when loop opts are not triggered
          @Test
          @IR(counts = {ALLOC_G, "= 2"})
          public void test41() {
              f1 = new MyPrimitive41_1();
              f2 = new MyPrimitive41_1();
          }

          @Run(test = "test41")
          public void test41_verifier() {
              test41();
              Asserts.assertEQ(f1, new MyPrimitive41_1());
              Asserts.assertEQ(f1, f2);
          }

            Unassigned Unassigned
            thartmann Tobias Hartmann
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: