< prev index next >

test/compiler/valhalla/valuetypes/ValueTypeTestBench.java

Print this page




  83 
  84     private MyValue1() {
  85         s = 0;
  86         this.x = 0;
  87         this.y = 0;
  88         this.v1 = MyValue2.createDefaultInline();
  89         this.v2 = MyValue2.createDefaultInline();
  90         this.c = 0;
  91     }
  92 
  93     @DontInline
  94     public static MyValue1 createDontInline(int x, long y) {
  95         return __Make MyValue1(x, y, MyValue2.createInline(x, true), MyValue2.createInline(x, false), ValueTypeTestBench.rI);
  96     }
  97 
  98     @ForceInline
  99     public static MyValue1 createInline(int x, long y) {
 100         return __Make MyValue1(x, y, MyValue2.createInline(x, true), MyValue2.createInline(x, false), ValueTypeTestBench.rI);
 101     }
 102 





 103     @ForceInline
 104     __ValueFactory static MyValue1 createDefaultInline() {
 105         return __MakeDefault MyValue1();
 106     }
 107 











 108     @ForceInline
 109     static MyValue1 createWithFieldsInline(int x, long y) {
 110         MyValue1 v = createDefaultInline();
 111         v = setX(v, x);
 112         v = setY(v, y);
 113         v = setV1(v, MyValue2.createWithFieldsInline(x, x < y));
 114         v = setV2(v, MyValue2.createWithFieldsInline(x, x > y));
 115         v = setC(v, ValueTypeTestBench.rI);
 116         return v;
 117     }
 118 
 119     @ForceInline
 120     public long hash() {
 121         return s + sf + x + y + c + v1.hash() + v2.hash() + v3.hash();
 122     }
 123 
 124     @DontCompile
 125     public long hashInterpreted() {
 126         return s + sf + x + y + c + v1.hashInterpreted() + v2.hashInterpreted() + v3.hashInterpreted();
 127     }


1193         MyValue1[] va = test48();
1194         Asserts.assertEQ(va.length, 0);
1195     }
1196 
1197     // Test that value type array loaded from field has correct type
1198     static MyValue1[] test49_va;
1199     @Test(failOn = (LOOP))
1200     public long test49() {
1201         return test49_va[0].hash();
1202     }
1203 
1204     @DontCompile
1205     public void test49_verifier(boolean warmup) {
1206         test49_va = new MyValue1[1];
1207         test49_va[0] = MyValue1.createInline(rI, rL);
1208         long result = test49();
1209         Asserts.assertEQ(result, hash());
1210     }
1211 
1212     // test vdefault
1213     @Test(failOn = ALLOC + STORE + TRAP)
1214     public long test50() {
1215         MyValue2 v = MyValue2.createDefaultInline();
1216         return v.hash();
1217     }
1218 
1219     @DontCompile
1220     public void test50_verifier(boolean warmup) {
1221         long result = test50();
1222         Asserts.assertEQ(result, MyValue2.createDefaultInline().hash());
1223     }
1224 
1225     @Test(failOn = ALLOC + STORE + TRAP)

1226     public long test51() {
1227         MyValue1 v = MyValue1.createDefaultInline();
1228         return v.hash();

1229     }
1230 
1231     @DontCompile
1232     public void test51_verifier(boolean warmup) {
1233         long result = test51();
1234         Asserts.assertEQ(result, MyValue1.createDefaultInline().hash());
1235     }
1236 
1237     // test vwithfield
1238     @Test(failOn = ALLOC + LOAD + STORE + TRAP)
1239     public long test52() {
1240         MyValue2 v = MyValue2.createWithFieldsInline(rI, true);
1241         return v.hash();
1242     }
1243 
1244     @DontCompile
1245     public void test52_verifier(boolean warmup) {
1246         long result = test52();
1247         Asserts.assertEQ(result, MyValue2.createWithFieldsInline(rI, true).hash());
1248     }
1249 
1250     // test vwithfield
1251     @Test(failOn = ALLOC + LOAD + STORE + TRAP)
1252     public long test53() {
1253         MyValue1 v = MyValue1.createWithFieldsInline(rI, rL);
1254         return v.hash();

1255     }
1256 
1257     @DontCompile
1258     public void test53_verifier(boolean warmup) {
1259         long result = test53();
1260         Asserts.assertEQ(result, hash());
1261     }
1262 
1263     // multi-dimensional arrays
1264     @Test()
1265     public MyValue1[][][] test54(int len1, int len2, int len3) {
1266         MyValue1[][][] arr = new MyValue1[len1][len2][len3];
1267         for (int i = 0; i < len1; i++) {
1268             for (int j = 0; j < len2; j++) {
1269                 for (int k = 0; k < len3; k++) {
1270                     arr[i][j][k] = MyValue1.createDontInline(rI + i , rL + j + k);
1271                 }
1272             }
1273         }
1274         return arr;
1275     }
1276 
1277     @DontCompile
1278     public void test54_verifier(boolean warmup) {
1279         MyValue1[][][] arr = test54(2, 3, 4);
1280         for (int i = 0; i < 2; i++) {




  83 
  84     private MyValue1() {
  85         s = 0;
  86         this.x = 0;
  87         this.y = 0;
  88         this.v1 = MyValue2.createDefaultInline();
  89         this.v2 = MyValue2.createDefaultInline();
  90         this.c = 0;
  91     }
  92 
  93     @DontInline
  94     public static MyValue1 createDontInline(int x, long y) {
  95         return __Make MyValue1(x, y, MyValue2.createInline(x, true), MyValue2.createInline(x, false), ValueTypeTestBench.rI);
  96     }
  97 
  98     @ForceInline
  99     public static MyValue1 createInline(int x, long y) {
 100         return __Make MyValue1(x, y, MyValue2.createInline(x, true), MyValue2.createInline(x, false), ValueTypeTestBench.rI);
 101     }
 102 
 103     @DontInline
 104     __ValueFactory static MyValue1 createDefaultDontInline() {
 105         return __MakeDefault MyValue1();
 106     }
 107 
 108     @ForceInline
 109     __ValueFactory static MyValue1 createDefaultInline() {
 110         return __MakeDefault MyValue1();
 111     }
 112 
 113     @DontInline
 114     static MyValue1 createWithFieldsDontInline(int x, long y) {
 115         MyValue1 v = createDefaultInline();
 116         v = setX(v, x);
 117         v = setY(v, y);
 118         v = setV1(v, MyValue2.createWithFieldsInline(x, x < y));
 119         v = setV2(v, MyValue2.createWithFieldsInline(x, x > y));
 120         v = setC(v, ValueTypeTestBench.rI);
 121         return v;
 122     }
 123 
 124     @ForceInline
 125     static MyValue1 createWithFieldsInline(int x, long y) {
 126         MyValue1 v = createDefaultInline();
 127         v = setX(v, x);
 128         v = setY(v, y);
 129         v = setV1(v, MyValue2.createWithFieldsInline(x, x < y));
 130         v = setV2(v, MyValue2.createWithFieldsInline(x, x > y));
 131         v = setC(v, ValueTypeTestBench.rI);
 132         return v;
 133     }
 134 
 135     @ForceInline
 136     public long hash() {
 137         return s + sf + x + y + c + v1.hash() + v2.hash() + v3.hash();
 138     }
 139 
 140     @DontCompile
 141     public long hashInterpreted() {
 142         return s + sf + x + y + c + v1.hashInterpreted() + v2.hashInterpreted() + v3.hashInterpreted();
 143     }


1209         MyValue1[] va = test48();
1210         Asserts.assertEQ(va.length, 0);
1211     }
1212 
1213     // Test that value type array loaded from field has correct type
1214     static MyValue1[] test49_va;
1215     @Test(failOn = (LOOP))
1216     public long test49() {
1217         return test49_va[0].hash();
1218     }
1219 
1220     @DontCompile
1221     public void test49_verifier(boolean warmup) {
1222         test49_va = new MyValue1[1];
1223         test49_va[0] = MyValue1.createInline(rI, rL);
1224         long result = test49();
1225         Asserts.assertEQ(result, hash());
1226     }
1227 
1228     // test vdefault
1229     @Test(failOn = ALLOC + LOAD + STORE + LOOP + TRAP)
1230     public long test50() {
1231         MyValue2 v = MyValue2.createDefaultInline();
1232         return v.hash();
1233     }
1234 
1235     @DontCompile
1236     public void test50_verifier(boolean warmup) {
1237         long result = test50();
1238         Asserts.assertEQ(result, MyValue2.createDefaultInline().hash());
1239     }
1240 
1241     // test vdefault
1242     @Test(failOn = ALLOC + STORE + LOOP + TRAP)
1243     public long test51() {
1244         MyValue1 v1 = MyValue1.createDefaultInline();
1245         MyValue1 v2 = MyValue1.createDefaultDontInline();
1246         return v1.hash() + v2.hash();
1247     }
1248 
1249     @DontCompile
1250     public void test51_verifier(boolean warmup) {
1251         long result = test51();
1252         Asserts.assertEQ(result, 2 * MyValue1.createDefaultInline().hash());
1253     }
1254 
1255     // test vwithfield
1256     @Test(failOn = ALLOC + LOAD + STORE + LOOP + TRAP)
1257     public long test52() {
1258         MyValue2 v = MyValue2.createWithFieldsInline(rI, true);
1259         return v.hash();
1260     }
1261 
1262     @DontCompile
1263     public void test52_verifier(boolean warmup) {
1264         long result = test52();
1265         Asserts.assertEQ(result, MyValue2.createWithFieldsInline(rI, true).hash());
1266     }
1267 
1268     // test vwithfield
1269     @Test(failOn = ALLOC + STORE + LOOP + TRAP)
1270     public long test53() {
1271         MyValue1 v1 = MyValue1.createWithFieldsInline(rI, rL);
1272         MyValue1 v2 = MyValue1.createWithFieldsDontInline(rI, rL);
1273         return v1.hash() + v2.hash();
1274     }
1275 
1276     @DontCompile
1277     public void test53_verifier(boolean warmup) {
1278         long result = test53();
1279         Asserts.assertEQ(result, 2 * hash());
1280     }
1281 
1282     // multi-dimensional arrays
1283     @Test()
1284     public MyValue1[][][] test54(int len1, int len2, int len3) {
1285         MyValue1[][][] arr = new MyValue1[len1][len2][len3];
1286         for (int i = 0; i < len1; i++) {
1287             for (int j = 0; j < len2; j++) {
1288                 for (int k = 0; k < len3; k++) {
1289                     arr[i][j][k] = MyValue1.createDontInline(rI + i , rL + j + k);
1290                 }
1291             }
1292         }
1293         return arr;
1294     }
1295 
1296     @DontCompile
1297     public void test54_verifier(boolean warmup) {
1298         MyValue1[][][] arr = test54(2, 3, 4);
1299         for (int i = 0; i < 2; i++) {


< prev index next >