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 24 package runtime.valhalla.valuetypes; 25 26 import jdk.test.lib.Asserts; 27 28 /* 29 * @test VWithFieldTest 30 * @summary vwithfield bytecode test 31 * @library /test/lib 32 * @compile -XDenableValueTypes --add-modules jdk.incubator.mvt Point.java 33 * @compile -XDenableValueTypes VWithFieldTest.java 34 * @run main/othervm -Xint -XX:+EnableValhalla runtime.valhalla.valuetypes.VWithFieldTest 35 * @run main/othervm -Xcomp -XX:+EnableValhalla runtime.valhalla.valuetypes.VWithFieldTest 36 */ 37 38 public class VWithFieldTest { 39 40 static __ByValue final class Point { 41 final private int x; 42 final private int y; 43 44 __ValueFactory static Point make(int x, int y) { 45 Point p = __MakeDefault Point(); 46 Asserts.assertEquals(p.x, 0, "invalid x default value"); 47 Asserts.assertEquals(p.y, 0, "invalid y default value"); 48 p.x = x; 49 Asserts.assertEquals(p.x, x, "invalid x value"); 50 Asserts.assertEquals(p.y, 0, "invalid y value"); 51 p.y = y; 52 Asserts.assertEquals(p.x, x, "invalid x value"); 53 Asserts.assertEquals(p.y, y, "invalid y value"); 54 return p; | 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 24 package runtime.valhalla.valuetypes; 25 26 import jdk.test.lib.Asserts; 27 28 /* 29 * @test VWithFieldTest 30 * @summary vwithfield bytecode test 31 * @library /test/lib 32 * @compile -XDenableValueTypes --add-modules jdk.incubator.mvt Point.java 33 * @compile -XDenableValueTypes VWithFieldTest.java 34 * @run main/othervm -Xint -XX:+EnableValhalla runtime.valhalla.valuetypes.VWithFieldTest 35 */ 36 37 38 39 /* 40 * @run main/othervm -Xcomp -XX:+EnableValhalla runtime.valhalla.valuetypes.VWithFieldTest 41 */ 42 43 public class VWithFieldTest { 44 45 static __ByValue final class Point { 46 final private int x; 47 final private int y; 48 49 __ValueFactory static Point make(int x, int y) { 50 Point p = __MakeDefault Point(); 51 Asserts.assertEquals(p.x, 0, "invalid x default value"); 52 Asserts.assertEquals(p.y, 0, "invalid y default value"); 53 p.x = x; 54 Asserts.assertEquals(p.x, x, "invalid x value"); 55 Asserts.assertEquals(p.y, 0, "invalid y value"); 56 p.y = y; 57 Asserts.assertEquals(p.x, x, "invalid x value"); 58 Asserts.assertEquals(p.y, y, "invalid y value"); 59 return p; |