< prev index next >

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

Print this page


   1 /*
   2  * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   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  */


  29 import jdk.incubator.mvt.ValueType;
  30 import jdk.test.lib.Asserts;
  31 
  32 import java.lang.invoke.*;
  33 import java.lang.reflect.Method;
  34 
  35 /*
  36  * @test
  37  * @summary Test Minimal Value Types
  38  * @library /testlibrary /test/lib /compiler/whitebox /
  39  * @requires os.simpleArch == "x64"
  40  * @modules java.base/jdk.experimental.bytecode
  41  *          java.base/jdk.experimental.value
  42  *          java.base/jdk.internal.misc:+open
  43  *          jdk.incubator.mvt
  44  * @compile -XDenableValueTypes ValueCapableClass1.java ValueCapableClass2.java TestMinimalValueTypes.java
  45  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  46  * @run main ClassFileInstaller jdk.test.lib.Platform
  47  * @run main/othervm/timeout=120 -Xbootclasspath/a:. -ea -XX:+IgnoreUnrecognizedVMOptions -XX:+UnlockDiagnosticVMOptions
  48  *                   -XX:+UnlockExperimentalVMOptions -XX:+WhiteBoxAPI -XX:+AlwaysIncrementalInline
  49  *                   -XX:+EnableMVT -XX:+ValueTypePassFieldsAsArgs -XX:+ValueTypeReturnedAsFields -XX:+ValueArrayFlatten
  50  *                   -XX:ValueFieldMaxFlatSize=-1 -XX:ValueArrayElemMaxFlatSize=-1 -XX:ValueArrayElemMaxFlatOops=-1
  51  *                   compiler.valhalla.valuetypes.TestMinimalValueTypes
  52  * @run main/othervm/timeout=120 -Xbootclasspath/a:. -ea -XX:+IgnoreUnrecognizedVMOptions -XX:+UnlockDiagnosticVMOptions
  53  *                   -XX:+UnlockExperimentalVMOptions -XX:+WhiteBoxAPI -XX:-UseCompressedOops
  54  *                   -XX:+EnableMVT -XX:-ValueTypePassFieldsAsArgs -XX:-ValueTypeReturnedAsFields -XX:+ValueArrayFlatten
  55  *                   -XX:ValueFieldMaxFlatSize=-1 -XX:ValueArrayElemMaxFlatSize=-1 -XX:ValueArrayElemMaxFlatOops=-1
  56  *                   compiler.valhalla.valuetypes.TestMinimalValueTypes
  57  * @run main/othervm/timeout=120 -Xbootclasspath/a:. -ea -XX:+IgnoreUnrecognizedVMOptions -XX:+UnlockDiagnosticVMOptions
  58  *                   -XX:+UnlockExperimentalVMOptions -XX:+WhiteBoxAPI -XX:-UseCompressedOops
  59  *                   -XX:+EnableMVT -XX:+ValueTypePassFieldsAsArgs -XX:+ValueTypeReturnedAsFields -XX:-ValueArrayFlatten
  60  *                   -XX:ValueFieldMaxFlatSize=0 -XX:ValueArrayElemMaxFlatSize=0 -XX:ValueArrayElemMaxFlatOops=0
  61  *                   -DVerifyIR=false compiler.valhalla.valuetypes.TestMinimalValueTypes
  62  * @run main/othervm/timeout=120 -Xbootclasspath/a:. -ea -XX:+IgnoreUnrecognizedVMOptions -XX:+UnlockDiagnosticVMOptions
  63  *                   -XX:+UnlockExperimentalVMOptions -XX:+WhiteBoxAPI -XX:+AlwaysIncrementalInline
  64  *                   -XX:+EnableMVT -XX:-ValueTypePassFieldsAsArgs -XX:-ValueTypeReturnedAsFields -XX:-ValueArrayFlatten
  65  *                   -XX:ValueFieldMaxFlatSize=0 -XX:ValueArrayElemMaxFlatSize=0 -XX:ValueArrayElemMaxFlatOops=0
  66  *                   -DVerifyIR=false compiler.valhalla.valuetypes.TestMinimalValueTypes
  67  * @run main/othervm/timeout=120 -Xbootclasspath/a:. -ea -XX:+IgnoreUnrecognizedVMOptions -XX:+UnlockDiagnosticVMOptions
  68  *                   -XX:+UnlockExperimentalVMOptions -XX:+WhiteBoxAPI
  69  *                   -XX:+EnableMVT -XX:+ValueTypePassFieldsAsArgs -XX:-ValueTypeReturnedAsFields -XX:+ValueArrayFlatten
  70  *                   -XX:ValueFieldMaxFlatSize=0 -XX:ValueArrayElemMaxFlatSize=-1 -XX:ValueArrayElemMaxFlatOops=-1
  71  *                   -DVerifyIR=false compiler.valhalla.valuetypes.TestMinimalValueTypes
  72  */
  73 public class TestMinimalValueTypes extends ValueTypeTest {
  74 
  75     static {
  76         try {
  77             MethodHandles.Lookup lookup = MethodHandles.lookup();
  78 
  79             // Generate a MethodHandle that obtains field t of the derived value type
  80             vccUnboxLoadLongMH = MethodHandleBuilder.loadCode(lookup,
  81                     "vccUnboxLoadLong",
  82                     MethodType.methodType(long.class, ValueCapableClass1.class),
  83                     CODE -> {
  84                         CODE.
  85                         aload_0().
  86                         vunbox(ValueType.forClass(ValueCapableClass1.class).valueClass()).
  87                         getfield(ValueType.forClass(ValueCapableClass1.class).valueClass(), "t", "J").
  88                         lreturn();
  89                     }


   1 /*
   2  * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   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  */


  29 import jdk.incubator.mvt.ValueType;
  30 import jdk.test.lib.Asserts;
  31 
  32 import java.lang.invoke.*;
  33 import java.lang.reflect.Method;
  34 
  35 /*
  36  * @test
  37  * @summary Test Minimal Value Types
  38  * @library /testlibrary /test/lib /compiler/whitebox /
  39  * @requires os.simpleArch == "x64"
  40  * @modules java.base/jdk.experimental.bytecode
  41  *          java.base/jdk.experimental.value
  42  *          java.base/jdk.internal.misc:+open
  43  *          jdk.incubator.mvt
  44  * @compile -XDenableValueTypes ValueCapableClass1.java ValueCapableClass2.java TestMinimalValueTypes.java
  45  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  46  * @run main ClassFileInstaller jdk.test.lib.Platform
  47  * @run main/othervm/timeout=120 -Xbootclasspath/a:. -ea -XX:+IgnoreUnrecognizedVMOptions -XX:+UnlockDiagnosticVMOptions
  48  *                   -XX:+UnlockExperimentalVMOptions -XX:+WhiteBoxAPI -XX:+AlwaysIncrementalInline
  49  *                   -XX:+ValueTypePassFieldsAsArgs -XX:+ValueTypeReturnedAsFields -XX:+ValueArrayFlatten
  50  *                   -XX:ValueFieldMaxFlatSize=-1 -XX:ValueArrayElemMaxFlatSize=-1 -XX:ValueArrayElemMaxFlatOops=-1
  51  *                   compiler.valhalla.valuetypes.TestMinimalValueTypes
  52  * @run main/othervm/timeout=120 -Xbootclasspath/a:. -ea -XX:+IgnoreUnrecognizedVMOptions -XX:+UnlockDiagnosticVMOptions
  53  *                   -XX:+UnlockExperimentalVMOptions -XX:+WhiteBoxAPI -XX:-UseCompressedOops
  54  *                   -XX:-ValueTypePassFieldsAsArgs -XX:-ValueTypeReturnedAsFields -XX:+ValueArrayFlatten
  55  *                   -XX:ValueFieldMaxFlatSize=-1 -XX:ValueArrayElemMaxFlatSize=-1 -XX:ValueArrayElemMaxFlatOops=-1
  56  *                   compiler.valhalla.valuetypes.TestMinimalValueTypes
  57  * @run main/othervm/timeout=120 -Xbootclasspath/a:. -ea -XX:+IgnoreUnrecognizedVMOptions -XX:+UnlockDiagnosticVMOptions
  58  *                   -XX:+UnlockExperimentalVMOptions -XX:+WhiteBoxAPI -XX:-UseCompressedOops
  59  *                   -XX:+ValueTypePassFieldsAsArgs -XX:+ValueTypeReturnedAsFields -XX:-ValueArrayFlatten
  60  *                   -XX:ValueFieldMaxFlatSize=0 -XX:ValueArrayElemMaxFlatSize=0 -XX:ValueArrayElemMaxFlatOops=0
  61  *                   -DVerifyIR=false compiler.valhalla.valuetypes.TestMinimalValueTypes
  62  * @run main/othervm/timeout=120 -Xbootclasspath/a:. -ea -XX:+IgnoreUnrecognizedVMOptions -XX:+UnlockDiagnosticVMOptions
  63  *                   -XX:+UnlockExperimentalVMOptions -XX:+WhiteBoxAPI -XX:+AlwaysIncrementalInline
  64  *                   -XX:-ValueTypePassFieldsAsArgs -XX:-ValueTypeReturnedAsFields -XX:-ValueArrayFlatten
  65  *                   -XX:ValueFieldMaxFlatSize=0 -XX:ValueArrayElemMaxFlatSize=0 -XX:ValueArrayElemMaxFlatOops=0
  66  *                   -DVerifyIR=false compiler.valhalla.valuetypes.TestMinimalValueTypes
  67  * @run main/othervm/timeout=120 -Xbootclasspath/a:. -ea -XX:+IgnoreUnrecognizedVMOptions -XX:+UnlockDiagnosticVMOptions
  68  *                   -XX:+UnlockExperimentalVMOptions -XX:+WhiteBoxAPI
  69  *                   -XX:+ValueTypePassFieldsAsArgs -XX:-ValueTypeReturnedAsFields -XX:+ValueArrayFlatten
  70  *                   -XX:ValueFieldMaxFlatSize=0 -XX:ValueArrayElemMaxFlatSize=-1 -XX:ValueArrayElemMaxFlatOops=-1
  71  *                   -DVerifyIR=false compiler.valhalla.valuetypes.TestMinimalValueTypes
  72  */
  73 public class TestMinimalValueTypes extends ValueTypeTest {
  74 
  75     static {
  76         try {
  77             MethodHandles.Lookup lookup = MethodHandles.lookup();
  78 
  79             // Generate a MethodHandle that obtains field t of the derived value type
  80             vccUnboxLoadLongMH = MethodHandleBuilder.loadCode(lookup,
  81                     "vccUnboxLoadLong",
  82                     MethodType.methodType(long.class, ValueCapableClass1.class),
  83                     CODE -> {
  84                         CODE.
  85                         aload_0().
  86                         vunbox(ValueType.forClass(ValueCapableClass1.class).valueClass()).
  87                         getfield(ValueType.forClass(ValueCapableClass1.class).valueClass(), "t", "J").
  88                         lreturn();
  89                     }


< prev index next >