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

C2: iterative EA

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P4 P4
    • 19
    • 18
    • hotspot
    • b02

      There is issue with nested initialization when Escape Analysis can not scalarize allocations: `new A(new B( new C)))`

      public class TestIterativeEA {

        static class B {
          int i;

          public B(int i) {
            this.i = i;
          }
        }

        static class A {
          B b;

          public A(B b) {
            this.b = b;
          }
        }

        static class C {
          A a;

          public C(A a) {
            this.a = a;
          }
        }

        static int test0(int i) {
          C c = new C(new A(new B(i)));
          return c.a.b.i;
        }

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

      JavaObject NoEscape(NoEscape) [ 347F [ 38 43 ]] 26 Allocate === 5 6 7 8 1 ( 24 22 23 1 10 1 ) [[ 27 28 29 36 37 38 ]] rawptr:NotNull ( int:>=0, java/lang/Object:NotNull *, bool, top ) TestIterativeEA::test0 @ bci:0 (line 28) Type:{0:control, 1:abIO, 2:memory, 3:rawptr:BotPTR, 4:return_address, 5:rawptr:NotNull} !jvms: TestIterativeEA::test0 @ bci:0 (line 28)

      JavaObject ArgEscape(ArgEscape) [ 191F 525F [ 60 65 401 347 365 509 366 510 524 ]] 48 Allocate === 40 37 25 8 1 ( 24 46 23 1 10 1 43 43 ) [[ 49 50 51 58 59 60 ]] rawptr:NotNull ( int:>=0, java/lang/Object:NotNull *, bool, top ) TestIterativeEA::test0 @ bci:4 (line 28) Type:{0:control, 1:abIO, 2:memory, 3:rawptr:BotPTR, 4:return_address, 5:rawptr:NotNull} !jvms: TestIterativeEA::test0 @ bci:4 (line 28)

      JavaObject GlobalEscape(GlobalEscape) [ 144F 541F [ 90 95 192 191 525 526 527 540 ]] 78 Allocate === 62 59 47 8 1 ( 24 76 23 1 10 1 43 43 65 65 ) [[ 79 80 81 88 89 90 ]] rawptr:NotNull ( int:>=0, java/lang/Object:NotNull *, bool, top ) TestIterativeEA::test0 @ bci:8 (line 28) Type:{0:control, 1:abIO, 2:memory, 3:rawptr:BotPTR, 4:return_address, 5:rawptr:NotNull} !jvms: TestIterativeEA::test0 @ bci:8 (line 28)

            kvn Vladimir Kozlov
            kvn Vladimir Kozlov
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: