< prev index next >

test/hotspot/jtreg/compiler/valhalla/valuetypes/TestC1.java

Print this page




  89     }
  90 
  91     // JDK-8229799
  92     @Test(compLevel=C1)
  93     public long test1(Object a, Object b, long n) {
  94         long r;
  95         n += (a == b) ? 0x5678123456781234L : 0x1234567812345678L;
  96         n -= 1;
  97         return n;
  98     }
  99 
 100     @DontCompile
 101     public void test1_verifier(boolean warmup) {
 102         MyValue1 v1 = MyValue1.createWithFieldsInline(rI, rL);
 103         MyValue1 v2 = MyValue1.createWithFieldsInline(rI, rL+1);
 104         long r1 = test1(v1, v1, 1);
 105         long r2 = test1(v1, v2, 1);
 106         Asserts.assertEQ(r1, 0x5678123456781234L);
 107         Asserts.assertEQ(r2, 0x1234567812345678L);
 108     }























 109 }


  89     }
  90 
  91     // JDK-8229799
  92     @Test(compLevel=C1)
  93     public long test1(Object a, Object b, long n) {
  94         long r;
  95         n += (a == b) ? 0x5678123456781234L : 0x1234567812345678L;
  96         n -= 1;
  97         return n;
  98     }
  99 
 100     @DontCompile
 101     public void test1_verifier(boolean warmup) {
 102         MyValue1 v1 = MyValue1.createWithFieldsInline(rI, rL);
 103         MyValue1 v2 = MyValue1.createWithFieldsInline(rI, rL+1);
 104         long r1 = test1(v1, v1, 1);
 105         long r2 = test1(v1, v2, 1);
 106         Asserts.assertEQ(r1, 0x5678123456781234L);
 107         Asserts.assertEQ(r2, 0x1234567812345678L);
 108     }
 109 
 110     static inline class SimpleValue2 {
 111         final int value;
 112         SimpleValue2(int value) {
 113             this.value = value;
 114         }
 115     }
 116 
 117     // JDK-8231961
 118     // Test that the value numbering optimization does not remove
 119     // the second load from the buffered array element.
 120     @Test(compLevel=C1)
 121     public int test2(SimpleValue2[] array) {
 122         return array[0].value + array[0].value;
 123     }
 124 
 125     @DontCompile
 126     public void test2_verifier(boolean warmup) {
 127         SimpleValue2[] array = new SimpleValue2[1];
 128         array[0] = new SimpleValue2(rI);
 129         int result = test2(array);
 130         Asserts.assertEQ(result, 2*rI);
 131     }
 132 }
< prev index next >