< prev index next >

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

Print this page




  55 
  56     @ForceInline
  57     static MyValue1 createDefaultInline() {
  58         return MyValue1.default;
  59     }
  60 
  61     @DontInline
  62     static MyValue1 createWithFieldsDontInline(int x, long y) {
  63         return createWithFieldsInline(x, y);
  64     }
  65 
  66     @ForceInline
  67     static MyValue1 createWithFieldsInline(int x, long y) {
  68         MyValue1 v = createDefaultInline();
  69         v = setX(v, x);
  70         v = setY(v, y);
  71         v = setZ(v, (short)x);
  72         v = setO(v, new Integer(x));
  73         int[] oa = {x};
  74         v = setOA(v, oa);
  75         v = setV1(v, MyValue2.createWithFieldsInline(x, true));
  76         v = setV2(v, MyValue2.createWithFieldsInline(x, false));
  77         v = setC(v, ValueTypeTest.rI);
  78         return v;
  79     }
  80 
  81     // Hash only primitive and value type fields to avoid NullPointerException
  82     @ForceInline
  83     public long hashPrimitive() {
  84         return s + sf + x + y + z + c + v1.hash() + v2.hash() + v3.hash();
  85     }
  86 
  87     @ForceInline
  88     public long hash() {
  89         long res = hashPrimitive();
  90         try {
  91             res += o;
  92         } catch(NullPointerException npe) {}
  93         try {
  94             res += oa[0];
  95         } catch(NullPointerException npe) {}
  96         return res;
  97     }




  55 
  56     @ForceInline
  57     static MyValue1 createDefaultInline() {
  58         return MyValue1.default;
  59     }
  60 
  61     @DontInline
  62     static MyValue1 createWithFieldsDontInline(int x, long y) {
  63         return createWithFieldsInline(x, y);
  64     }
  65 
  66     @ForceInline
  67     static MyValue1 createWithFieldsInline(int x, long y) {
  68         MyValue1 v = createDefaultInline();
  69         v = setX(v, x);
  70         v = setY(v, y);
  71         v = setZ(v, (short)x);
  72         v = setO(v, new Integer(x));
  73         int[] oa = {x};
  74         v = setOA(v, oa);
  75         v = setV1(v, MyValue2.createWithFieldsInline(x, y, true));
  76         v = setV2(v, MyValue2.createWithFieldsInline(x, y, false));
  77         v = setC(v, (int)(x+y));
  78         return v;
  79     }
  80 
  81     // Hash only primitive and value type fields to avoid NullPointerException
  82     @ForceInline
  83     public long hashPrimitive() {
  84         return s + sf + x + y + z + c + v1.hash() + v2.hash() + v3.hash();
  85     }
  86 
  87     @ForceInline
  88     public long hash() {
  89         long res = hashPrimitive();
  90         try {
  91             res += o;
  92         } catch(NullPointerException npe) {}
  93         try {
  94             res += oa[0];
  95         } catch(NullPointerException npe) {}
  96         return res;
  97     }


< prev index next >