hotspot/test/compiler/codegen/Test6797305.java
author hseigel
Wed, 01 Mar 2017 08:00:02 -0500
changeset 46194 5596e6f63072
parent 40059 c2304140ed64
permissions -rw-r--r--
8172307: Remove ununsed JVM API JVM_GetModuleByPackageName() Summary: Remove get_module_by_package_name() etc., and unneeded test. Reviewed-by: sspitsyn, gtriantafill
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2150
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents:
diff changeset
     1
/*
5547
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 2150
diff changeset
     2
 * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
2150
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents:
diff changeset
     4
 *
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents:
diff changeset
     7
 * published by the Free Software Foundation.
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents:
diff changeset
     8
 *
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents:
diff changeset
    13
 * accompanied this code).
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents:
diff changeset
    14
 *
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents:
diff changeset
    18
 *
5547
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 2150
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 2150
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 2150
diff changeset
    21
 * questions.
2150
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents:
diff changeset
    22
 */
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents:
diff changeset
    23
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents:
diff changeset
    24
/**
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents:
diff changeset
    25
 * @test
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents:
diff changeset
    26
 * @bug 6797305
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents:
diff changeset
    27
 * @summary Add LoadUB and LoadUI opcode class
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents:
diff changeset
    28
 *
40059
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 27699
diff changeset
    29
 * @run main/othervm -Xcomp
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 27699
diff changeset
    30
 *      -XX:CompileCommand=compileonly,compiler.codegen.Test6797305::load*
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 27699
diff changeset
    31
 *      compiler.codegen.Test6797305
2150
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents:
diff changeset
    32
 */
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents:
diff changeset
    33
40059
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 27699
diff changeset
    34
package compiler.codegen;
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 27699
diff changeset
    35
2150
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents:
diff changeset
    36
public class Test6797305 {
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents:
diff changeset
    37
    static final byte[]  ba = new byte[]  { -1 };
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents:
diff changeset
    38
    static final short[] sa = new short[] { -1 };
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents:
diff changeset
    39
    static final int[]   ia = new int[]   { -1 };
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents:
diff changeset
    40
    static final long[]  la = new long[]  { -1 };
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents:
diff changeset
    41
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents:
diff changeset
    42
    public static void main(String[] args)
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents:
diff changeset
    43
    {
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents:
diff changeset
    44
        long b = loadB(ba);
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents:
diff changeset
    45
        if (b != -1)
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents:
diff changeset
    46
            throw new InternalError("loadB failed: " + b + " != " + -1);
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents:
diff changeset
    47
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents:
diff changeset
    48
        long b2l = loadB2L(ba);
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents:
diff changeset
    49
        if (b2l != -1L)
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents:
diff changeset
    50
            throw new InternalError("loadB2L failed: " + b2l + " != " + -1L);
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents:
diff changeset
    51
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents:
diff changeset
    52
        int ub = loadUB(ba);
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents:
diff changeset
    53
        if (ub != 0xFF)
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents:
diff changeset
    54
            throw new InternalError("loadUB failed: " + ub + " != " + 0xFF);
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents:
diff changeset
    55
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents:
diff changeset
    56
        int ubmask = loadUBmask(ba);
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents:
diff changeset
    57
        if (ubmask != 0xFE)
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents:
diff changeset
    58
            throw new InternalError("loadUBmask failed: " + ubmask + " != " + 0xFE);
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents:
diff changeset
    59
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents:
diff changeset
    60
        long ub2l = loadUB2L(ba);
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents:
diff changeset
    61
        if (ub2l != 0xFFL)
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents:
diff changeset
    62
            throw new InternalError("loadUB2L failed: " + ub2l + " != " + 0xFFL);
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents:
diff changeset
    63
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents:
diff changeset
    64
        int s = loadS(sa);
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents:
diff changeset
    65
        if (s != -1)
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents:
diff changeset
    66
            throw new InternalError("loadS failed: " + s + " != " + -1);
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents:
diff changeset
    67
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents:
diff changeset
    68
        long s2l = loadS2L(sa);
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents:
diff changeset
    69
        if (s2l != -1L)
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents:
diff changeset
    70
            throw new InternalError("loadS2L failed: " + s2l + " != " + -1L);
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents:
diff changeset
    71
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents:
diff changeset
    72
        int us = loadUS(sa);
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents:
diff changeset
    73
        if (us != 0xFFFF)
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents:
diff changeset
    74
            throw new InternalError("loadUS failed: " + us + " != " + 0xFFFF);
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents:
diff changeset
    75
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents:
diff changeset
    76
        int usmask = loadUSmask(sa);
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents:
diff changeset
    77
        if (usmask != 0xFFFE)
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents:
diff changeset
    78
            throw new InternalError("loadUBmask failed: " + ubmask + " != " + 0xFFFE);
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents:
diff changeset
    79
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents:
diff changeset
    80
        long us2l = loadUS2L(sa);
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents:
diff changeset
    81
        if (us2l != 0xFFFFL)
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents:
diff changeset
    82
            throw new InternalError("loadUS2L failed: " + us2l + " != " + 0xFFFFL);
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents:
diff changeset
    83
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents:
diff changeset
    84
        int i = loadI(ia);
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents:
diff changeset
    85
        if (i != -1)
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents:
diff changeset
    86
            throw new InternalError("loadI failed: " + i + " != " + -1);
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents:
diff changeset
    87
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents:
diff changeset
    88
        long i2l = loadI2L(ia);
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents:
diff changeset
    89
        if (i2l != -1L)
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents:
diff changeset
    90
            throw new InternalError("loadI2L failed: " + i2l + " != " + -1L);
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents:
diff changeset
    91
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents:
diff changeset
    92
        long ui2l = loadUI2L(ia);
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents:
diff changeset
    93
        if (ui2l != 0xFFFFFFFFL)
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents:
diff changeset
    94
            throw new InternalError("loadUI2L failed: " + ui2l + " != " + 0xFFFFFFFFL);
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents:
diff changeset
    95
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents:
diff changeset
    96
        long l = loadL(la);
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents:
diff changeset
    97
        if (l != -1L)
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents:
diff changeset
    98
            throw new InternalError("loadL failed: " + l + " != " + -1L);
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents:
diff changeset
    99
    }
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents:
diff changeset
   100
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents:
diff changeset
   101
    static int  loadB     (byte[] ba)  { return ba[0];               }
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents:
diff changeset
   102
    static long loadB2L   (byte[] ba)  { return ba[0];               }
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents:
diff changeset
   103
    static int  loadUB    (byte[] ba)  { return ba[0] & 0xFF;        }
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents:
diff changeset
   104
    static int  loadUBmask(byte[] ba)  { return ba[0] & 0xFE;        }
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents:
diff changeset
   105
    static long loadUB2L  (byte[] ba)  { return ba[0] & 0xFF;        }
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents:
diff changeset
   106
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents:
diff changeset
   107
    static int  loadS     (short[] sa) { return sa[0];               }
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents:
diff changeset
   108
    static long loadS2L   (short[] sa) { return sa[0];               }
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents:
diff changeset
   109
    static int  loadUS    (short[] sa) { return sa[0] & 0xFFFF;      }
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents:
diff changeset
   110
    static int  loadUSmask(short[] sa) { return sa[0] & 0xFFFE;      }
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents:
diff changeset
   111
    static long loadUS2L  (short[] sa) { return sa[0] & 0xFFFF;      }
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents:
diff changeset
   112
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents:
diff changeset
   113
    static int  loadI     (int[] ia)   { return ia[0];               }
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents:
diff changeset
   114
    static long loadI2L   (int[] ia)   { return ia[0];               }
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents:
diff changeset
   115
    static long loadUI2L  (int[] ia)   { return ia[0] & 0xFFFFFFFFL; }
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents:
diff changeset
   116
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents:
diff changeset
   117
    static long loadL     (long[] la)  { return la[0];               }
0d91d17158cc 6797305: Add LoadUB and LoadUI opcode class
twisti
parents:
diff changeset
   118
}