< prev index next >

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

Print this page




   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  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 




   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  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 
  27 import jdk.experimental.value.MethodHandleBuilder;
  28 import jdk.incubator.mvt.ValueType;
  29 
  30 import static jdk.test.lib.Asserts.*;
  31 
  32 /*
  33  * @test VboxUnbox
  34  * @summary Exercise vbox & vunbox bytecodes
  35  * @modules java.base/jdk.experimental.value
  36  *          jdk.incubator.mvt
  37  * @library /test/lib
  38  * @build runtime.valhalla.valuetypes.ValueCapableClass
  39  * @run main/othervm -Xint -noverify -XX:+EnableMVT runtime.valhalla.valuetypes.VboxUnbox
  40  * @run main/othervm -Xcomp -noverify -XX:+EnableMVT runtime.valhalla.valuetypes.VboxUnbox
  41  */
  42 public class VboxUnbox {
  43 
  44     public static void main(String[] args) {
  45         testCorrectBoxing();
  46         testIncorrectBoxing();
  47     }
  48 
  49     public static void testCorrectBoxing() {
  50         Class<?> vcc = ValueCapableClass.class;
  51         Class<?> dvt = ValueType.forClass(vcc).valueClass();
  52 
  53         MethodHandle newDvt = newDvtMh(dvt);
  54         MethodHandle box = boxMh(dvt, vcc);
  55         MethodHandle unbox = unboxMh(vcc, dvt);
  56 


< prev index next >