Path: blob/aarch64-shenandoah-jdk8u272-b10/hotspot/test/compiler/6797305/Test6797305.java
32285 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 -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 Test679730529*/3031public class Test6797305 {32static final byte[] ba = new byte[] { -1 };33static final short[] sa = new short[] { -1 };34static final int[] ia = new int[] { -1 };35static final long[] la = new long[] { -1 };3637public static void main(String[] args)38{39long b = loadB(ba);40if (b != -1)41throw new InternalError("loadB failed: " + b + " != " + -1);4243long b2l = loadB2L(ba);44if (b2l != -1L)45throw new InternalError("loadB2L failed: " + b2l + " != " + -1L);4647int ub = loadUB(ba);48if (ub != 0xFF)49throw new InternalError("loadUB failed: " + ub + " != " + 0xFF);5051int ubmask = loadUBmask(ba);52if (ubmask != 0xFE)53throw new InternalError("loadUBmask failed: " + ubmask + " != " + 0xFE);5455long ub2l = loadUB2L(ba);56if (ub2l != 0xFFL)57throw new InternalError("loadUB2L failed: " + ub2l + " != " + 0xFFL);5859int s = loadS(sa);60if (s != -1)61throw new InternalError("loadS failed: " + s + " != " + -1);6263long s2l = loadS2L(sa);64if (s2l != -1L)65throw new InternalError("loadS2L failed: " + s2l + " != " + -1L);6667int us = loadUS(sa);68if (us != 0xFFFF)69throw new InternalError("loadUS failed: " + us + " != " + 0xFFFF);7071int usmask = loadUSmask(sa);72if (usmask != 0xFFFE)73throw new InternalError("loadUBmask failed: " + ubmask + " != " + 0xFFFE);7475long us2l = loadUS2L(sa);76if (us2l != 0xFFFFL)77throw new InternalError("loadUS2L failed: " + us2l + " != " + 0xFFFFL);7879int i = loadI(ia);80if (i != -1)81throw new InternalError("loadI failed: " + i + " != " + -1);8283long i2l = loadI2L(ia);84if (i2l != -1L)85throw new InternalError("loadI2L failed: " + i2l + " != " + -1L);8687long ui2l = loadUI2L(ia);88if (ui2l != 0xFFFFFFFFL)89throw new InternalError("loadUI2L failed: " + ui2l + " != " + 0xFFFFFFFFL);9091long l = loadL(la);92if (l != -1L)93throw new InternalError("loadL failed: " + l + " != " + -1L);94}9596static int loadB (byte[] ba) { return ba[0]; }97static long loadB2L (byte[] ba) { return ba[0]; }98static int loadUB (byte[] ba) { return ba[0] & 0xFF; }99static int loadUBmask(byte[] ba) { return ba[0] & 0xFE; }100static long loadUB2L (byte[] ba) { return ba[0] & 0xFF; }101102static int loadS (short[] sa) { return sa[0]; }103static long loadS2L (short[] sa) { return sa[0]; }104static int loadUS (short[] sa) { return sa[0] & 0xFFFF; }105static int loadUSmask(short[] sa) { return sa[0] & 0xFFFE; }106static long loadUS2L (short[] sa) { return sa[0] & 0xFFFF; }107108static int loadI (int[] ia) { return ia[0]; }109static long loadI2L (int[] ia) { return ia[0]; }110static long loadUI2L (int[] ia) { return ia[0] & 0xFFFFFFFFL; }111112static long loadL (long[] la) { return la[0]; }113}114115116