|
1 /* |
|
2 * Copyright (c) 2009, 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 */ |
|
23 |
|
24 /** |
|
25 * @test |
|
26 * @bug 6797305 |
|
27 * @summary Add LoadUB and LoadUI opcode class |
|
28 * |
|
29 * @run main/othervm -Xcomp -XX:CompileOnly=Test6797305.loadB,Test6797305.loadB2L,Test6797305.loadUB,Test6797305.loadUBmask,Test6797305.loadUB2L,Test6797305.loadS,Test6797305.loadS2L,Test6797305.loadUS,Test6797305.loadUSmask,Test6797305.loadUS2L,Test6797305.loadI,Test6797305.loadI2L,Test6797305.loadUI2L,Test6797305.loadL Test6797305 |
|
30 */ |
|
31 |
|
32 public class Test6797305 { |
|
33 static final byte[] ba = new byte[] { -1 }; |
|
34 static final short[] sa = new short[] { -1 }; |
|
35 static final int[] ia = new int[] { -1 }; |
|
36 static final long[] la = new long[] { -1 }; |
|
37 |
|
38 public static void main(String[] args) |
|
39 { |
|
40 long b = loadB(ba); |
|
41 if (b != -1) |
|
42 throw new InternalError("loadB failed: " + b + " != " + -1); |
|
43 |
|
44 long b2l = loadB2L(ba); |
|
45 if (b2l != -1L) |
|
46 throw new InternalError("loadB2L failed: " + b2l + " != " + -1L); |
|
47 |
|
48 int ub = loadUB(ba); |
|
49 if (ub != 0xFF) |
|
50 throw new InternalError("loadUB failed: " + ub + " != " + 0xFF); |
|
51 |
|
52 int ubmask = loadUBmask(ba); |
|
53 if (ubmask != 0xFE) |
|
54 throw new InternalError("loadUBmask failed: " + ubmask + " != " + 0xFE); |
|
55 |
|
56 long ub2l = loadUB2L(ba); |
|
57 if (ub2l != 0xFFL) |
|
58 throw new InternalError("loadUB2L failed: " + ub2l + " != " + 0xFFL); |
|
59 |
|
60 int s = loadS(sa); |
|
61 if (s != -1) |
|
62 throw new InternalError("loadS failed: " + s + " != " + -1); |
|
63 |
|
64 long s2l = loadS2L(sa); |
|
65 if (s2l != -1L) |
|
66 throw new InternalError("loadS2L failed: " + s2l + " != " + -1L); |
|
67 |
|
68 int us = loadUS(sa); |
|
69 if (us != 0xFFFF) |
|
70 throw new InternalError("loadUS failed: " + us + " != " + 0xFFFF); |
|
71 |
|
72 int usmask = loadUSmask(sa); |
|
73 if (usmask != 0xFFFE) |
|
74 throw new InternalError("loadUBmask failed: " + ubmask + " != " + 0xFFFE); |
|
75 |
|
76 long us2l = loadUS2L(sa); |
|
77 if (us2l != 0xFFFFL) |
|
78 throw new InternalError("loadUS2L failed: " + us2l + " != " + 0xFFFFL); |
|
79 |
|
80 int i = loadI(ia); |
|
81 if (i != -1) |
|
82 throw new InternalError("loadI failed: " + i + " != " + -1); |
|
83 |
|
84 long i2l = loadI2L(ia); |
|
85 if (i2l != -1L) |
|
86 throw new InternalError("loadI2L failed: " + i2l + " != " + -1L); |
|
87 |
|
88 long ui2l = loadUI2L(ia); |
|
89 if (ui2l != 0xFFFFFFFFL) |
|
90 throw new InternalError("loadUI2L failed: " + ui2l + " != " + 0xFFFFFFFFL); |
|
91 |
|
92 long l = loadL(la); |
|
93 if (l != -1L) |
|
94 throw new InternalError("loadL failed: " + l + " != " + -1L); |
|
95 } |
|
96 |
|
97 static int loadB (byte[] ba) { return ba[0]; } |
|
98 static long loadB2L (byte[] ba) { return ba[0]; } |
|
99 static int loadUB (byte[] ba) { return ba[0] & 0xFF; } |
|
100 static int loadUBmask(byte[] ba) { return ba[0] & 0xFE; } |
|
101 static long loadUB2L (byte[] ba) { return ba[0] & 0xFF; } |
|
102 |
|
103 static int loadS (short[] sa) { return sa[0]; } |
|
104 static long loadS2L (short[] sa) { return sa[0]; } |
|
105 static int loadUS (short[] sa) { return sa[0] & 0xFFFF; } |
|
106 static int loadUSmask(short[] sa) { return sa[0] & 0xFFFE; } |
|
107 static long loadUS2L (short[] sa) { return sa[0] & 0xFFFF; } |
|
108 |
|
109 static int loadI (int[] ia) { return ia[0]; } |
|
110 static long loadI2L (int[] ia) { return ia[0]; } |
|
111 static long loadUI2L (int[] ia) { return ia[0] & 0xFFFFFFFFL; } |
|
112 |
|
113 static long loadL (long[] la) { return la[0]; } |
|
114 } |