< prev index next >

hotspot/test/runtime/valhalla/valuetypes/VboxUnbox.java

Print this page




  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 package runtime.valhalla.valuetypes;
  24 
  25 import java.lang.invoke.*;
  26 import jdk.experimental.value.*;
  27 
  28 import static jdk.test.lib.Asserts.*;
  29 
  30 /*
  31  * @test VboxUnbox
  32  * @summary Exercise vbox & vunbox bytecodes
  33  * @library /test/lib
  34  * @build runtime.valhalla.valuetypes.ValueCapableClass
  35  * @run main/othervm -Xint -noverify -XX:+EnableMVT runtime.valhalla.valuetypes.VboxUnbox
  36  * @run main/othervm -Xcomp -noverify -XX:+EnableMVT runtime.valhalla.valuetypes.VboxUnbox


  37  */
  38 public class VboxUnbox {
  39 
  40     public static void main(String[] args) {
  41         testCorrectBoxing();
  42         testIncorrectBoxing();
  43     }
  44 
  45     public static void testCorrectBoxing() {
  46         Class<?> vcc = ValueCapableClass.class;
  47         Class<?> dvt = ValueType.forClass(vcc).valueClass();
  48 
  49         MethodHandle newDvt = newDvtMh(dvt);
  50         MethodHandle box = boxMh(dvt, vcc);
  51         MethodHandle unbox = unboxMh(vcc, dvt);
  52 
  53         ValueCapableClass newObject = ValueCapableClass.create(3, (short)7, (short)11);
  54         ValueCapableClass newBoxed = null;
  55 
  56         try {




  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 package runtime.valhalla.valuetypes;
  24 
  25 import java.lang.invoke.*;
  26 import jdk.experimental.value.*;
  27 
  28 import static jdk.test.lib.Asserts.*;
  29 
  30 /*
  31  * @test VboxUnbox
  32  * @summary Exercise vbox & vunbox bytecodes
  33  * @library /test/lib
  34  * @build runtime.valhalla.valuetypes.ValueCapableClass
  35  * @run main/othervm -Xint -noverify -XX:+EnableMVT runtime.valhalla.valuetypes.VboxUnbox
  36  * @run main/othervm -Xcomp -noverify -XX:+EnableMVT
  37  *                   -XX:+UnlockDiagnosticVMOptions -XX:DisableIntrinsic=_isAssignableFrom
  38  *                   runtime.valhalla.valuetypes.VboxUnbox
  39  */
  40 public class VboxUnbox {
  41 
  42     public static void main(String[] args) {
  43         testCorrectBoxing();
  44         testIncorrectBoxing();
  45     }
  46 
  47     public static void testCorrectBoxing() {
  48         Class<?> vcc = ValueCapableClass.class;
  49         Class<?> dvt = ValueType.forClass(vcc).valueClass();
  50 
  51         MethodHandle newDvt = newDvtMh(dvt);
  52         MethodHandle box = boxMh(dvt, vcc);
  53         MethodHandle unbox = unboxMh(vcc, dvt);
  54 
  55         ValueCapableClass newObject = ValueCapableClass.create(3, (short)7, (short)11);
  56         ValueCapableClass newBoxed = null;
  57 
  58         try {


< prev index next >