Path: blob/master/test/hotspot/jtreg/compiler/codegen/Test6797305.java
41149 views
/*1* Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*/2223/**24* @test25* @bug 679730526* @summary Add LoadUB and LoadUI opcode class27*28* @run main/othervm -Xcomp29* -XX:CompileCommand=compileonly,compiler.codegen.Test6797305::load*30* compiler.codegen.Test679730531*/3233package compiler.codegen;3435public class Test6797305 {36static final byte[] ba = new byte[] { -1 };37static final short[] sa = new short[] { -1 };38static final int[] ia = new int[] { -1 };39static final long[] la = new long[] { -1 };4041public static void main(String[] args)42{43long b = loadB(ba);44if (b != -1)45throw new InternalError("loadB failed: " + b + " != " + -1);4647long b2l = loadB2L(ba);48if (b2l != -1L)49throw new InternalError("loadB2L failed: " + b2l + " != " + -1L);5051int ub = loadUB(ba);52if (ub != 0xFF)53throw new InternalError("loadUB failed: " + ub + " != " + 0xFF);5455int ubmask = loadUBmask(ba);56if (ubmask != 0xFE)57throw new InternalError("loadUBmask failed: " + ubmask + " != " + 0xFE);5859long ub2l = loadUB2L(ba);60if (ub2l != 0xFFL)61throw new InternalError("loadUB2L failed: " + ub2l + " != " + 0xFFL);6263int s = loadS(sa);64if (s != -1)65throw new InternalError("loadS failed: " + s + " != " + -1);6667long s2l = loadS2L(sa);68if (s2l != -1L)69throw new InternalError("loadS2L failed: " + s2l + " != " + -1L);7071int us = loadUS(sa);72if (us != 0xFFFF)73throw new InternalError("loadUS failed: " + us + " != " + 0xFFFF);7475int usmask = loadUSmask(sa);76if (usmask != 0xFFFE)77throw new InternalError("loadUBmask failed: " + ubmask + " != " + 0xFFFE);7879long us2l = loadUS2L(sa);80if (us2l != 0xFFFFL)81throw new InternalError("loadUS2L failed: " + us2l + " != " + 0xFFFFL);8283int i = loadI(ia);84if (i != -1)85throw new InternalError("loadI failed: " + i + " != " + -1);8687long i2l = loadI2L(ia);88if (i2l != -1L)89throw new InternalError("loadI2L failed: " + i2l + " != " + -1L);9091long ui2l = loadUI2L(ia);92if (ui2l != 0xFFFFFFFFL)93throw new InternalError("loadUI2L failed: " + ui2l + " != " + 0xFFFFFFFFL);9495long l = loadL(la);96if (l != -1L)97throw new InternalError("loadL failed: " + l + " != " + -1L);98}99100static int loadB (byte[] ba) { return ba[0]; }101static long loadB2L (byte[] ba) { return ba[0]; }102static int loadUB (byte[] ba) { return ba[0] & 0xFF; }103static int loadUBmask(byte[] ba) { return ba[0] & 0xFE; }104static long loadUB2L (byte[] ba) { return ba[0] & 0xFF; }105106static int loadS (short[] sa) { return sa[0]; }107static long loadS2L (short[] sa) { return sa[0]; }108static int loadUS (short[] sa) { return sa[0] & 0xFFFF; }109static int loadUSmask(short[] sa) { return sa[0] & 0xFFFE; }110static long loadUS2L (short[] sa) { return sa[0] & 0xFFFF; }111112static int loadI (int[] ia) { return ia[0]; }113static long loadI2L (int[] ia) { return ia[0]; }114static long loadUI2L (int[] ia) { return ia[0] & 0xFFFFFFFFL; }115116static long loadL (long[] la) { return la[0]; }117}118119120