--- old/test/compiler/valhalla/valuetypes/ValueTypeTestBench.java 2017-03-23 15:38:40.710380454 +0100 +++ new/test/compiler/valhalla/valuetypes/ValueTypeTestBench.java 2017-03-23 15:38:40.642380452 +0100 @@ -71,15 +71,17 @@ static final long sf = ValueTypeTestBench.rL; final int x; final long y; + final short z; final MyValue2 v1; final MyValue2 v2; static final MyValue2 v3 = MyValue2.createInline(ValueTypeTestBench.rI, true); final int c; - private MyValue1(int x, long y, MyValue2 v1, MyValue2 v2, int c) { + private MyValue1(int x, long y, short z, MyValue2 v1, MyValue2 v2, int c) { s = x; this.x = x; this.y = y; + this.z = z; this.v1 = v1; this.v2 = v2; this.c = c; @@ -89,6 +91,7 @@ s = 0; this.x = 0; this.y = 0; + this.z = 0; this.v1 = MyValue2.createDefaultInline(); this.v2 = MyValue2.createDefaultInline(); this.c = 0; @@ -96,12 +99,12 @@ @DontInline public static MyValue1 createDontInline(int x, long y) { - return __Make MyValue1(x, y, MyValue2.createInline(x, true), MyValue2.createInline(x, false), ValueTypeTestBench.rI); + return __Make MyValue1(x, y, (short)x, MyValue2.createInline(x, true), MyValue2.createInline(x, false), ValueTypeTestBench.rI); } @ForceInline public static MyValue1 createInline(int x, long y) { - return __Make MyValue1(x, y, MyValue2.createInline(x, true), MyValue2.createInline(x, false), ValueTypeTestBench.rI); + return __Make MyValue1(x, y, (short)x, MyValue2.createInline(x, true), MyValue2.createInline(x, false), ValueTypeTestBench.rI); } @DontInline @@ -119,6 +122,7 @@ MyValue1 v = createDefaultInline(); v = setX(v, x); v = setY(v, y); + v = setZ(v, (short)x); v = setV1(v, MyValue2.createWithFieldsInline(x, x < y)); v = setV2(v, MyValue2.createWithFieldsInline(x, x > y)); v = setC(v, ValueTypeTestBench.rI); @@ -130,6 +134,7 @@ MyValue1 v = createDefaultInline(); v = setX(v, x); v = setY(v, y); + v = setZ(v, (short)x); v = setV1(v, MyValue2.createWithFieldsInline(x, x < y)); v = setV2(v, MyValue2.createWithFieldsInline(x, x > y)); v = setC(v, ValueTypeTestBench.rI); @@ -138,17 +143,17 @@ @ForceInline public long hash() { - return s + sf + x + y + c + v1.hash() + v2.hash() + v3.hash(); + return s + sf + x + y + z + c + v1.hash() + v2.hash() + v3.hash(); } @DontCompile public long hashInterpreted() { - return s + sf + x + y + c + v1.hashInterpreted() + v2.hashInterpreted() + v3.hashInterpreted(); + return s + sf + x + y + z + c + v1.hashInterpreted() + v2.hashInterpreted() + v3.hashInterpreted(); } @ForceInline public void print() { - System.out.print("s=" + s + ", sf=" + sf + ", x=" + x + ", y=" + y + ", v1["); + System.out.print("s=" + s + ", sf=" + sf + ", x=" + x + ", y=" + y + ", z=" + z + ", v1["); v1.print(); System.out.print("], v2["); v2.print(); @@ -170,6 +175,12 @@ } @ForceInline + __ValueFactory static MyValue1 setZ(MyValue1 v, short z) { + v.z = z; + return v; + } + + @ForceInline __ValueFactory static MyValue1 setC(MyValue1 v, int c) { v.c = c; return v; @@ -190,24 +201,27 @@ __ByValue final class MyValue2 { final int x; + final byte y; final boolean b; final long c; - private MyValue2(int x, boolean b, long c) { + private MyValue2(int x, byte y, boolean b, long c) { this.x = x; + this.y = y; this.b = b; this.c = c; } private MyValue2() { this.x = 0; + this.y = 0; this.b = false; this.c = 0; } @ForceInline public static MyValue2 createInline(int x, boolean b) { - return __Make MyValue2(x, b, ValueTypeTestBench.rL); + return __Make MyValue2(x, (byte)x, b, ValueTypeTestBench.rL); } @ForceInline @@ -219,6 +233,7 @@ public static MyValue2 createWithFieldsInline(int x, boolean b) { MyValue2 v = createDefaultInline(); v = setX(v, x); + v = setY(v, (byte)x); v = setB(v, b); v = setC(v, ValueTypeTestBench.rL); return v; @@ -226,17 +241,17 @@ @ForceInline public long hash() { - return x + (b ? 0 : 1) + c; + return x + y + (b ? 0 : 1) + c; } @DontInline public long hashInterpreted() { - return x + (b ? 0 : 1) + c; + return x + y + (b ? 0 : 1) + c; } @ForceInline public void print() { - System.out.print("x=" + x + ", b=" + b + ", c=" + c); + System.out.print("x=" + x + "y=" + y + ", b=" + b + ", c=" + c); } @ForceInline @@ -246,6 +261,12 @@ } @ForceInline + __ValueFactory static MyValue2 setY(MyValue2 v, byte y) { + v.y = y; + return v; + } + + @ForceInline __ValueFactory static MyValue2 setC(MyValue2 v, long c) { v.c = c; return v; @@ -317,7 +338,7 @@ } // Return incoming value type without accessing fields - @Test(valid = ValueTypePassFieldsAsArgsOn, match = {ALLOC, STORE}, matchCount = {1, 9}, failOn = LOAD + TRAP) + @Test(valid = ValueTypePassFieldsAsArgsOn, match = {ALLOC, STORE}, matchCount = {1, 11}, failOn = LOAD + TRAP) @Test(valid = ValueTypePassFieldsAsArgsOff, failOn = ALLOC + LOAD + STORE + TRAP) public MyValue1 test3(MyValue1 v) { return v; @@ -412,9 +433,7 @@ } // Merge value types created from two branches - @Test(valid = ValueTypePassFieldsAsArgsOn, match = {LOAD}, matchCount = {7}, failOn = TRAP + ALLOC + STORE) - // FIXME - //@Test(valid = ValueTypePassFieldsAsArgsOff, match = {ALLOC, STORE}, matchCount = {1, 9}, failOn = LOAD + TRAP) + @Test(valid = ValueTypePassFieldsAsArgsOn, match = {LOAD}, matchCount = {10}, failOn = TRAP + ALLOC + STORE) @Test(valid = ValueTypePassFieldsAsArgsOff, match = {ALLOC, STORE}, matchCount = {1, 3}, failOn = LOAD + TRAP) public MyValue1 test9(boolean b) { MyValue1 v; @@ -540,7 +559,7 @@ // Create a value type in a non-inlined method and then call a // non-inlined method on that value type. - @Test(valid = ValueTypePassFieldsAsArgsOn, failOn = (ALLOC + STORE + TRAP), match = {LOAD}, matchCount = {7}) + @Test(valid = ValueTypePassFieldsAsArgsOn, failOn = (ALLOC + STORE + TRAP), match = {LOAD}, matchCount = {10}) @Test(valid = ValueTypePassFieldsAsArgsOff, failOn = (ALLOC + LOAD + STORE + TRAP)) public long test14() { MyValue1 v = MyValue1.createDontInline(rI, rL); @@ -1485,7 +1504,7 @@ } public static void main(String[] args) throws Throwable { - //tests.values().removeIf(p -> !p.getName().equals("test58")); // Run single test + //tests.values().removeIf(p -> !p.getName().equals("test61")); // Run single test if (args.length == 0) { execute_vm("-XX:+IgnoreUnrecognizedVMOptions", "-XX:-BackgroundCompilation", "-XX:+PrintCompilation", "-XX:+PrintIdeal", "-XX:+PrintOptoAssembly",