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
24 /*
25 * @test
26 * @bug 8058744
27 * @summary Invalid pattern-matching of address computations in raw unsafe
28 * @library /testlibrary
29 * @modules java.base/jdk.internal.misc
30 * java.management
31 * @run main/othervm -Xbatch UnsafeRaw
32 */
33
34 import jdk.test.lib.Utils;
35 import java.util.Random;
36 import jdk.internal.misc.Unsafe;
37
38 public class UnsafeRaw {
39 public static class Tests {
40 public static int int_index(Unsafe unsafe, long base, int index) throws Exception {
41 return unsafe.getInt(base + (index << 2));
42 }
43 public static int long_index(Unsafe unsafe, long base, long index) throws Exception {
44 return unsafe.getInt(base + (index << 2));
45 }
46 public static int int_index_back_ashift(Unsafe unsafe, long base, int index) throws Exception {
47 return unsafe.getInt(base + (index >> 2));
48 }
49 public static int int_index_back_lshift(Unsafe unsafe, long base, int index) throws Exception {
50 return unsafe.getInt(base + (index >>> 2));
51 }
52 public static int long_index_back_ashift(Unsafe unsafe, long base, long index) throws Exception {
53 return unsafe.getInt(base + (index >> 2));
54 }
55 public static int long_index_back_lshift(Unsafe unsafe, long base, long index) throws Exception {
56 return unsafe.getInt(base + (index >>> 2));
|
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
24 /*
25 * @test
26 * @bug 8058744
27 * @summary Invalid pattern-matching of address computations in raw unsafe
28 * @library /testlibrary
29 * @modules java.base/jdk.internal.misc
30 * java.management
31 * @run main/othervm -Xbatch compiler.unsafe.UnsafeRaw
32 */
33
34 package compiler.unsafe;
35
36 import jdk.internal.misc.Unsafe;
37 import jdk.test.lib.Utils;
38
39 import java.util.Random;
40
41 public class UnsafeRaw {
42 public static class Tests {
43 public static int int_index(Unsafe unsafe, long base, int index) throws Exception {
44 return unsafe.getInt(base + (index << 2));
45 }
46 public static int long_index(Unsafe unsafe, long base, long index) throws Exception {
47 return unsafe.getInt(base + (index << 2));
48 }
49 public static int int_index_back_ashift(Unsafe unsafe, long base, int index) throws Exception {
50 return unsafe.getInt(base + (index >> 2));
51 }
52 public static int int_index_back_lshift(Unsafe unsafe, long base, int index) throws Exception {
53 return unsafe.getInt(base + (index >>> 2));
54 }
55 public static int long_index_back_ashift(Unsafe unsafe, long base, long index) throws Exception {
56 return unsafe.getInt(base + (index >> 2));
57 }
58 public static int long_index_back_lshift(Unsafe unsafe, long base, long index) throws Exception {
59 return unsafe.getInt(base + (index >>> 2));
|