624N/A/*
1472N/A * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
624N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
624N/A *
624N/A * This code is free software; you can redistribute it and/or modify it
624N/A * under the terms of the GNU General Public License version 2 only, as
624N/A * published by the Free Software Foundation.
624N/A *
624N/A * This code is distributed in the hope that it will be useful, but WITHOUT
624N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
624N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
624N/A * version 2 for more details (a copy is included in the LICENSE file that
624N/A * accompanied this code).
624N/A *
624N/A * You should have received a copy of the GNU General Public License version
624N/A * 2 along with this work; if not, write to the Free Software Foundation,
624N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
624N/A *
1472N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
1472N/A * or visit www.oracle.com if you need additional information or have any
1472N/A * questions.
624N/A */
624N/A
624N/A/**
624N/A * @test
624N/A * @bug 6797305
624N/A * @summary Add LoadUB and LoadUI opcode class
624N/A *
624N/A * @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
624N/A */
624N/A
624N/Apublic class Test6797305 {
624N/A static final byte[] ba = new byte[] { -1 };
624N/A static final short[] sa = new short[] { -1 };
624N/A static final int[] ia = new int[] { -1 };
624N/A static final long[] la = new long[] { -1 };
624N/A
624N/A public static void main(String[] args)
624N/A {
624N/A long b = loadB(ba);
624N/A if (b != -1)
624N/A throw new InternalError("loadB failed: " + b + " != " + -1);
624N/A
624N/A long b2l = loadB2L(ba);
624N/A if (b2l != -1L)
624N/A throw new InternalError("loadB2L failed: " + b2l + " != " + -1L);
624N/A
624N/A int ub = loadUB(ba);
624N/A if (ub != 0xFF)
624N/A throw new InternalError("loadUB failed: " + ub + " != " + 0xFF);
624N/A
624N/A int ubmask = loadUBmask(ba);
624N/A if (ubmask != 0xFE)
624N/A throw new InternalError("loadUBmask failed: " + ubmask + " != " + 0xFE);
624N/A
624N/A long ub2l = loadUB2L(ba);
624N/A if (ub2l != 0xFFL)
624N/A throw new InternalError("loadUB2L failed: " + ub2l + " != " + 0xFFL);
624N/A
624N/A int s = loadS(sa);
624N/A if (s != -1)
624N/A throw new InternalError("loadS failed: " + s + " != " + -1);
624N/A
624N/A long s2l = loadS2L(sa);
624N/A if (s2l != -1L)
624N/A throw new InternalError("loadS2L failed: " + s2l + " != " + -1L);
624N/A
624N/A int us = loadUS(sa);
624N/A if (us != 0xFFFF)
624N/A throw new InternalError("loadUS failed: " + us + " != " + 0xFFFF);
624N/A
624N/A int usmask = loadUSmask(sa);
624N/A if (usmask != 0xFFFE)
624N/A throw new InternalError("loadUBmask failed: " + ubmask + " != " + 0xFFFE);
624N/A
624N/A long us2l = loadUS2L(sa);
624N/A if (us2l != 0xFFFFL)
624N/A throw new InternalError("loadUS2L failed: " + us2l + " != " + 0xFFFFL);
624N/A
624N/A int i = loadI(ia);
624N/A if (i != -1)
624N/A throw new InternalError("loadI failed: " + i + " != " + -1);
624N/A
624N/A long i2l = loadI2L(ia);
624N/A if (i2l != -1L)
624N/A throw new InternalError("loadI2L failed: " + i2l + " != " + -1L);
624N/A
624N/A long ui2l = loadUI2L(ia);
624N/A if (ui2l != 0xFFFFFFFFL)
624N/A throw new InternalError("loadUI2L failed: " + ui2l + " != " + 0xFFFFFFFFL);
624N/A
624N/A long l = loadL(la);
624N/A if (l != -1L)
624N/A throw new InternalError("loadL failed: " + l + " != " + -1L);
624N/A }
624N/A
624N/A static int loadB (byte[] ba) { return ba[0]; }
624N/A static long loadB2L (byte[] ba) { return ba[0]; }
624N/A static int loadUB (byte[] ba) { return ba[0] & 0xFF; }
624N/A static int loadUBmask(byte[] ba) { return ba[0] & 0xFE; }
624N/A static long loadUB2L (byte[] ba) { return ba[0] & 0xFF; }
624N/A
624N/A static int loadS (short[] sa) { return sa[0]; }
624N/A static long loadS2L (short[] sa) { return sa[0]; }
624N/A static int loadUS (short[] sa) { return sa[0] & 0xFFFF; }
624N/A static int loadUSmask(short[] sa) { return sa[0] & 0xFFFE; }
624N/A static long loadUS2L (short[] sa) { return sa[0] & 0xFFFF; }
624N/A
624N/A static int loadI (int[] ia) { return ia[0]; }
624N/A static long loadI2L (int[] ia) { return ia[0]; }
624N/A static long loadUI2L (int[] ia) { return ia[0] & 0xFFFFFFFFL; }
624N/A
624N/A static long loadL (long[] la) { return la[0]; }
624N/A}