test/compiler/6797305/Test6797305.java

Wed, 22 Jan 2014 12:37:28 -0800

author
katleman
date
Wed, 22 Jan 2014 12:37:28 -0800
changeset 6575
2bac854670c0
parent 1907
c18cbe5936b8
child 6876
710a3c8b516e
permissions
-rw-r--r--

Added tag jdk8u5-b05 for changeset b90de55aca30

twisti@1059 1 /*
trims@1907 2 * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
twisti@1059 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
twisti@1059 4 *
twisti@1059 5 * This code is free software; you can redistribute it and/or modify it
twisti@1059 6 * under the terms of the GNU General Public License version 2 only, as
twisti@1059 7 * published by the Free Software Foundation.
twisti@1059 8 *
twisti@1059 9 * This code is distributed in the hope that it will be useful, but WITHOUT
twisti@1059 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
twisti@1059 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
twisti@1059 12 * version 2 for more details (a copy is included in the LICENSE file that
twisti@1059 13 * accompanied this code).
twisti@1059 14 *
twisti@1059 15 * You should have received a copy of the GNU General Public License version
twisti@1059 16 * 2 along with this work; if not, write to the Free Software Foundation,
twisti@1059 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
twisti@1059 18 *
trims@1907 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
trims@1907 20 * or visit www.oracle.com if you need additional information or have any
trims@1907 21 * questions.
twisti@1059 22 */
twisti@1059 23
twisti@1059 24 /**
twisti@1059 25 * @test
twisti@1059 26 * @bug 6797305
twisti@1059 27 * @summary Add LoadUB and LoadUI opcode class
twisti@1059 28 *
twisti@1059 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
twisti@1059 30 */
twisti@1059 31
twisti@1059 32 public class Test6797305 {
twisti@1059 33 static final byte[] ba = new byte[] { -1 };
twisti@1059 34 static final short[] sa = new short[] { -1 };
twisti@1059 35 static final int[] ia = new int[] { -1 };
twisti@1059 36 static final long[] la = new long[] { -1 };
twisti@1059 37
twisti@1059 38 public static void main(String[] args)
twisti@1059 39 {
twisti@1059 40 long b = loadB(ba);
twisti@1059 41 if (b != -1)
twisti@1059 42 throw new InternalError("loadB failed: " + b + " != " + -1);
twisti@1059 43
twisti@1059 44 long b2l = loadB2L(ba);
twisti@1059 45 if (b2l != -1L)
twisti@1059 46 throw new InternalError("loadB2L failed: " + b2l + " != " + -1L);
twisti@1059 47
twisti@1059 48 int ub = loadUB(ba);
twisti@1059 49 if (ub != 0xFF)
twisti@1059 50 throw new InternalError("loadUB failed: " + ub + " != " + 0xFF);
twisti@1059 51
twisti@1059 52 int ubmask = loadUBmask(ba);
twisti@1059 53 if (ubmask != 0xFE)
twisti@1059 54 throw new InternalError("loadUBmask failed: " + ubmask + " != " + 0xFE);
twisti@1059 55
twisti@1059 56 long ub2l = loadUB2L(ba);
twisti@1059 57 if (ub2l != 0xFFL)
twisti@1059 58 throw new InternalError("loadUB2L failed: " + ub2l + " != " + 0xFFL);
twisti@1059 59
twisti@1059 60 int s = loadS(sa);
twisti@1059 61 if (s != -1)
twisti@1059 62 throw new InternalError("loadS failed: " + s + " != " + -1);
twisti@1059 63
twisti@1059 64 long s2l = loadS2L(sa);
twisti@1059 65 if (s2l != -1L)
twisti@1059 66 throw new InternalError("loadS2L failed: " + s2l + " != " + -1L);
twisti@1059 67
twisti@1059 68 int us = loadUS(sa);
twisti@1059 69 if (us != 0xFFFF)
twisti@1059 70 throw new InternalError("loadUS failed: " + us + " != " + 0xFFFF);
twisti@1059 71
twisti@1059 72 int usmask = loadUSmask(sa);
twisti@1059 73 if (usmask != 0xFFFE)
twisti@1059 74 throw new InternalError("loadUBmask failed: " + ubmask + " != " + 0xFFFE);
twisti@1059 75
twisti@1059 76 long us2l = loadUS2L(sa);
twisti@1059 77 if (us2l != 0xFFFFL)
twisti@1059 78 throw new InternalError("loadUS2L failed: " + us2l + " != " + 0xFFFFL);
twisti@1059 79
twisti@1059 80 int i = loadI(ia);
twisti@1059 81 if (i != -1)
twisti@1059 82 throw new InternalError("loadI failed: " + i + " != " + -1);
twisti@1059 83
twisti@1059 84 long i2l = loadI2L(ia);
twisti@1059 85 if (i2l != -1L)
twisti@1059 86 throw new InternalError("loadI2L failed: " + i2l + " != " + -1L);
twisti@1059 87
twisti@1059 88 long ui2l = loadUI2L(ia);
twisti@1059 89 if (ui2l != 0xFFFFFFFFL)
twisti@1059 90 throw new InternalError("loadUI2L failed: " + ui2l + " != " + 0xFFFFFFFFL);
twisti@1059 91
twisti@1059 92 long l = loadL(la);
twisti@1059 93 if (l != -1L)
twisti@1059 94 throw new InternalError("loadL failed: " + l + " != " + -1L);
twisti@1059 95 }
twisti@1059 96
twisti@1059 97 static int loadB (byte[] ba) { return ba[0]; }
twisti@1059 98 static long loadB2L (byte[] ba) { return ba[0]; }
twisti@1059 99 static int loadUB (byte[] ba) { return ba[0] & 0xFF; }
twisti@1059 100 static int loadUBmask(byte[] ba) { return ba[0] & 0xFE; }
twisti@1059 101 static long loadUB2L (byte[] ba) { return ba[0] & 0xFF; }
twisti@1059 102
twisti@1059 103 static int loadS (short[] sa) { return sa[0]; }
twisti@1059 104 static long loadS2L (short[] sa) { return sa[0]; }
twisti@1059 105 static int loadUS (short[] sa) { return sa[0] & 0xFFFF; }
twisti@1059 106 static int loadUSmask(short[] sa) { return sa[0] & 0xFFFE; }
twisti@1059 107 static long loadUS2L (short[] sa) { return sa[0] & 0xFFFF; }
twisti@1059 108
twisti@1059 109 static int loadI (int[] ia) { return ia[0]; }
twisti@1059 110 static long loadI2L (int[] ia) { return ia[0]; }
twisti@1059 111 static long loadUI2L (int[] ia) { return ia[0] & 0xFFFFFFFFL; }
twisti@1059 112
twisti@1059 113 static long loadL (long[] la) { return la[0]; }
twisti@1059 114 }

mercurial