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 8058744
27 * @summary Invalid pattern-matching of address computations in raw unsafe
28 * @library /testlibrary
29 * @run main/othervm -Xbatch UnsafeRaw
30 */
31
32 import com.oracle.java.testlibrary.Utils;
33 import java.util.Random;
34
35 public class UnsafeRaw {
36 public static class Tests {
37 public static int int_index(sun.misc.Unsafe unsafe, long base, int index) throws Exception {
38 return unsafe.getInt(base + (index << 2));
39 }
40 public static int long_index(sun.misc.Unsafe unsafe, long base, long index) throws Exception {
41 return unsafe.getInt(base + (index << 2));
42 }
43 public static int int_index_back_ashift(sun.misc.Unsafe unsafe, long base, int index) throws Exception {
44 return unsafe.getInt(base + (index >> 2));
45 }
46 public static int int_index_back_lshift(sun.misc.Unsafe unsafe, long base, int index) throws Exception {
47 return unsafe.getInt(base + (index >>> 2));
48 }
|
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 8058744
27 * @summary Invalid pattern-matching of address computations in raw unsafe
28 * @library /testlibrary
29 * @build com.oracle.java.testlibrary.*
30 * @run main/othervm -Xbatch UnsafeRaw
31 */
32
33 import com.oracle.java.testlibrary.Utils;
34 import java.util.Random;
35
36 public class UnsafeRaw {
37 public static class Tests {
38 public static int int_index(sun.misc.Unsafe unsafe, long base, int index) throws Exception {
39 return unsafe.getInt(base + (index << 2));
40 }
41 public static int long_index(sun.misc.Unsafe unsafe, long base, long index) throws Exception {
42 return unsafe.getInt(base + (index << 2));
43 }
44 public static int int_index_back_ashift(sun.misc.Unsafe unsafe, long base, int index) throws Exception {
45 return unsafe.getInt(base + (index >> 2));
46 }
47 public static int int_index_back_lshift(sun.misc.Unsafe unsafe, long base, int index) throws Exception {
48 return unsafe.getInt(base + (index >>> 2));
49 }
|