< prev index next >

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

Print this page


   1 /*
   2  * Copyright (c) 2017, 2019, 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  */


1013 
1014     @DontCompile
1015     public void test54_verifier(boolean warmup) {
1016         Class<?> result = test54(Integer.class);
1017         Asserts.assertEQ(result, Integer.class);
1018     }
1019 
1020     // Test asPrimaryType intrinsic with non-value mirror
1021     @Test()
1022     public Class<?> test55(Class<?> c) {
1023         if (c.asPrimaryType() != Integer.class) {
1024             throw new RuntimeException("Unexpected class");
1025         }
1026         return Integer.class.asPrimaryType();
1027     }
1028 
1029     @DontCompile
1030     public void test55_verifier(boolean warmup) {
1031         Class<?> result = test55(Integer.class);
1032         Asserts.assertEQ(result, Integer.class);






















1033     }
1034 }
   1 /*
   2  * Copyright (c) 2017, 2020, 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  */


1013 
1014     @DontCompile
1015     public void test54_verifier(boolean warmup) {
1016         Class<?> result = test54(Integer.class);
1017         Asserts.assertEQ(result, Integer.class);
1018     }
1019 
1020     // Test asPrimaryType intrinsic with non-value mirror
1021     @Test()
1022     public Class<?> test55(Class<?> c) {
1023         if (c.asPrimaryType() != Integer.class) {
1024             throw new RuntimeException("Unexpected class");
1025         }
1026         return Integer.class.asPrimaryType();
1027     }
1028 
1029     @DontCompile
1030     public void test55_verifier(boolean warmup) {
1031         Class<?> result = test55(Integer.class);
1032         Asserts.assertEQ(result, Integer.class);
1033     }
1034 
1035     // Same as test39 but Unsafe.putInt to buffer is not intrinsified/compiled
1036     @DontCompile
1037     public void test56_callee(MyValue1? v) { // Use ? here to make sure the argument is not scalarized (otherwise larval information is lost)
1038         U.putInt(v, X_OFFSET, rI);
1039     }
1040 
1041     @Test()
1042     @Warmup(10000) // Fill up the TLAB to trigger slow path allocation
1043     public MyValue1 test56(MyValue1 v) {
1044         v = U.makePrivateBuffer(v);
1045         test56_callee(v);
1046         v = U.finishPrivateBuffer(v);
1047         return v;
1048     }
1049 
1050     @DontCompile
1051     public void test56_verifier(boolean warmup) {
1052         MyValue1 v = MyValue1.createWithFieldsInline(rI, rL);
1053         MyValue1 res = test56(v.setX(v, 0));
1054         Asserts.assertEQ(res.hash(), v.hash());
1055     }
1056 }
< prev index next >