< prev index next >

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

Print this page




  77         return x + vtField1.x + vtField2.x;
  78     }
  79 
  80     public MyValue1 testWithField(int x) {
  81         return __WithField(this.x, x);
  82     }
  83 }
  84 
  85 final inline class MyValue2 {
  86     static int cnt = 0;
  87     final int x;
  88     public MyValue2() {
  89         this.x = ++cnt;
  90     }
  91 }
  92 
  93 public class TestDeoptimizationWhenBuffering {
  94     static {
  95         try {
  96             Class<?> clazz = TestDeoptimizationWhenBuffering.class;
  97             ClassLoader loader = clazz.getClassLoader();
  98             MethodHandles.Lookup lookup = MethodHandles.lookup();
  99 
 100             MethodType mt = MethodType.methodType(MyValue1.class);
 101             test9_mh = lookup.findStatic(clazz, "test9Callee", mt);
 102             test10_mh = lookup.findStatic(clazz, "test10Callee", mt);
 103         } catch (NoSuchMethodException | IllegalAccessException e) {
 104             e.printStackTrace();
 105             throw new RuntimeException("Method handle lookup failed");
 106         }
 107     }
 108 
 109     MyValue1 test1() {
 110         return new MyValue1();
 111     }
 112 
 113     static MyValue1 vtField1;
 114 
 115     MyValue1 test2() {
 116         vtField1 = new MyValue1();
 117         return vtField1;




  77         return x + vtField1.x + vtField2.x;
  78     }
  79 
  80     public MyValue1 testWithField(int x) {
  81         return __WithField(this.x, x);
  82     }
  83 }
  84 
  85 final inline class MyValue2 {
  86     static int cnt = 0;
  87     final int x;
  88     public MyValue2() {
  89         this.x = ++cnt;
  90     }
  91 }
  92 
  93 public class TestDeoptimizationWhenBuffering {
  94     static {
  95         try {
  96             Class<?> clazz = TestDeoptimizationWhenBuffering.class;

  97             MethodHandles.Lookup lookup = MethodHandles.lookup();
  98 
  99             MethodType mt = MethodType.methodType(MyValue1.class);
 100             test9_mh = lookup.findStatic(clazz, "test9Callee", mt);
 101             test10_mh = lookup.findStatic(clazz, "test10Callee", mt);
 102         } catch (NoSuchMethodException | IllegalAccessException e) {
 103             e.printStackTrace();
 104             throw new RuntimeException("Method handle lookup failed");
 105         }
 106     }
 107 
 108     MyValue1 test1() {
 109         return new MyValue1();
 110     }
 111 
 112     static MyValue1 vtField1;
 113 
 114     MyValue1 test2() {
 115         vtField1 = new MyValue1();
 116         return vtField1;


< prev index next >