hotspot/test/compiler/6661247/Test.java
author ccheung
Fri, 04 Oct 2013 21:00:43 -0700
changeset 20384 49bfb2ec8f8f
parent 5547 f4b087cbb361
permissions -rw-r--r--
Merge
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
243
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
     1
/*
5547
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 670
diff changeset
     2
 * Copyright (c) 1997, 2008, Oracle and/or its affiliates. All rights reserved.
603
0e934fae2fc2 6706604: Copyright headers need to be changed to GPL.
kamg
parents: 243
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
243
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
     4
 *
603
0e934fae2fc2 6706604: Copyright headers need to be changed to GPL.
kamg
parents: 243
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
0e934fae2fc2 6706604: Copyright headers need to be changed to GPL.
kamg
parents: 243
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
0e934fae2fc2 6706604: Copyright headers need to be changed to GPL.
kamg
parents: 243
diff changeset
     7
 * published by the Free Software Foundation.
243
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
     8
 *
603
0e934fae2fc2 6706604: Copyright headers need to be changed to GPL.
kamg
parents: 243
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
0e934fae2fc2 6706604: Copyright headers need to be changed to GPL.
kamg
parents: 243
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0e934fae2fc2 6706604: Copyright headers need to be changed to GPL.
kamg
parents: 243
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
0e934fae2fc2 6706604: Copyright headers need to be changed to GPL.
kamg
parents: 243
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
0e934fae2fc2 6706604: Copyright headers need to be changed to GPL.
kamg
parents: 243
diff changeset
    13
 * accompanied this code).
243
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    14
 *
603
0e934fae2fc2 6706604: Copyright headers need to be changed to GPL.
kamg
parents: 243
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
0e934fae2fc2 6706604: Copyright headers need to be changed to GPL.
kamg
parents: 243
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
0e934fae2fc2 6706604: Copyright headers need to be changed to GPL.
kamg
parents: 243
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
243
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    18
 *
5547
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 670
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 670
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: 670
diff changeset
    21
 * questions.
243
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    22
 *
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    23
 */
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    24
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    25
/*
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    26
 * @test
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    27
 * @bug 6661247
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    28
 * @summary Internal bug in 32-bit HotSpot optimizer while bit manipulations
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    29
 */
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    30
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    31
import java.util.Random;
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    32
import java.nio.*;
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    33
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    34
// This isn't a completely reliable test for 6661247 since the results
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    35
// depend on what the local schedule looks like but it does reproduce
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    36
// the issue in current builds.
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    37
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    38
public class Test {
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    39
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    40
    public static void test(boolean[] src, int srcPos, LongBuffer dest, long destPos, int count) {
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    41
        int countStart = (destPos & 63) == 0 ? 0 : 64 - (int)(destPos & 63);
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    42
        if (countStart > count)
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    43
            countStart = count;
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    44
        for (int srcPosMax = srcPos + countStart; srcPos < srcPosMax; srcPos++, destPos++) {
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    45
            if (src[srcPos])
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    46
                dest.put((int)(destPos >>> 6), dest.get((int)(destPos >>> 6)) | 1L << (destPos & 63));
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    47
            else
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    48
                dest.put((int)(destPos >>> 6), dest.get((int)(destPos >>> 6)) & ~(1L << (destPos & 63)));
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    49
        }
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    50
        count -= countStart;
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    51
        int cnt = count >>> 6;
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    52
        for (int k = (int)(destPos >>> 6), kMax = k + cnt; k < kMax; k++) {
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    53
            int low = (src[srcPos] ? 1 : 0)
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    54
                | (src[srcPos + 1] ? 1 << 1 : 0)
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    55
                | (src[srcPos + 2] ? 1 << 2 : 0)
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    56
                | (src[srcPos + 3] ? 1 << 3 : 0)
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    57
                | (src[srcPos + 4] ? 1 << 4 : 0)
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    58
                | (src[srcPos + 5] ? 1 << 5 : 0)
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    59
                | (src[srcPos + 6] ? 1 << 6 : 0)
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    60
                | (src[srcPos + 7] ? 1 << 7 : 0)
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    61
                | (src[srcPos + 8] ? 1 << 8 : 0)
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    62
                | (src[srcPos + 9] ? 1 << 9 : 0)
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    63
                | (src[srcPos + 10] ? 1 << 10 : 0)
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    64
                | (src[srcPos + 11] ? 1 << 11 : 0)
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    65
                | (src[srcPos + 12] ? 1 << 12 : 0)
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    66
                | (src[srcPos + 13] ? 1 << 13 : 0)
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    67
                | (src[srcPos + 14] ? 1 << 14 : 0)
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    68
                | (src[srcPos + 15] ? 1 << 15 : 0)
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    69
                | (src[srcPos + 16] ? 1 << 16 : 0)
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    70
                | (src[srcPos + 17] ? 1 << 17 : 0)
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    71
                | (src[srcPos + 18] ? 1 << 18 : 0)
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    72
                | (src[srcPos + 19] ? 1 << 19 : 0)
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    73
                | (src[srcPos + 20] ? 1 << 20 : 0)
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    74
                | (src[srcPos + 21] ? 1 << 21 : 0)
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    75
                | (src[srcPos + 22] ? 1 << 22 : 0)
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    76
                | (src[srcPos + 23] ? 1 << 23 : 0)
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    77
                | (src[srcPos + 24] ? 1 << 24 : 0)
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    78
                | (src[srcPos + 25] ? 1 << 25 : 0)
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    79
                | (src[srcPos + 26] ? 1 << 26 : 0)
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    80
                | (src[srcPos + 27] ? 1 << 27 : 0)
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    81
                | (src[srcPos + 28] ? 1 << 28 : 0)
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    82
                | (src[srcPos + 29] ? 1 << 29 : 0)
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    83
                | (src[srcPos + 30] ? 1 << 30 : 0)
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    84
                | (src[srcPos + 31] ? 1 << 31 : 0)
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    85
                ;
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    86
            srcPos += 32;
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    87
            int high = (src[srcPos] ? 1 : 0)        // PROBLEM!
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    88
                | (src[srcPos + 1] ? 1 << 1 : 0)
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    89
                | (src[srcPos + 2] ? 1 << 2 : 0)
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    90
                | (src[srcPos + 3] ? 1 << 3 : 0)
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    91
                | (src[srcPos + 4] ? 1 << 4 : 0)
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    92
                | (src[srcPos + 5] ? 1 << 5 : 0)
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    93
                | (src[srcPos + 6] ? 1 << 6 : 0)
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    94
                | (src[srcPos + 7] ? 1 << 7 : 0)
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    95
                | (src[srcPos + 8] ? 1 << 8 : 0)
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    96
                | (src[srcPos + 9] ? 1 << 9 : 0)
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    97
                | (src[srcPos + 10] ? 1 << 10 : 0)
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    98
                | (src[srcPos + 11] ? 1 << 11 : 0)
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    99
                | (src[srcPos + 12] ? 1 << 12 : 0)
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
   100
                | (src[srcPos + 13] ? 1 << 13 : 0)
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
   101
                | (src[srcPos + 14] ? 1 << 14 : 0)
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
   102
                | (src[srcPos + 15] ? 1 << 15 : 0)
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
   103
                | (src[srcPos + 16] ? 1 << 16 : 0)
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
   104
                | (src[srcPos + 17] ? 1 << 17 : 0)
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
   105
                | (src[srcPos + 18] ? 1 << 18 : 0)
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
   106
                | (src[srcPos + 19] ? 1 << 19 : 0)
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
   107
                | (src[srcPos + 20] ? 1 << 20 : 0)
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
   108
                | (src[srcPos + 21] ? 1 << 21 : 0)
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
   109
                | (src[srcPos + 22] ? 1 << 22 : 0)
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
   110
                | (src[srcPos + 23] ? 1 << 23 : 0)
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
   111
                | (src[srcPos + 24] ? 1 << 24 : 0)
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
   112
                | (src[srcPos + 25] ? 1 << 25 : 0)
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
   113
                | (src[srcPos + 26] ? 1 << 26 : 0)
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
   114
                | (src[srcPos + 27] ? 1 << 27 : 0)
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
   115
                | (src[srcPos + 28] ? 1 << 28 : 0)
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
   116
                | (src[srcPos + 29] ? 1 << 29 : 0)
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
   117
                | (src[srcPos + 30] ? 1 << 30 : 0)
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
   118
                | (src[srcPos + 31] ? 1 << 31 : 0)
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
   119
                ;
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
   120
            srcPos += 32;
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
   121
            dest.put(k, ((long)low & 0xFFFFFFFFL) | (((long)high) << 32));
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
   122
            destPos += 64;
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
   123
        }
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
   124
        int countFinish = count & 63;
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
   125
        for (int srcPosMax = srcPos + countFinish; srcPos < srcPosMax; srcPos++, destPos++) {
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
   126
            if (src[srcPos])
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
   127
                dest.put((int)(destPos >>> 6), dest.get((int)(destPos >>> 6)) | 1L << (destPos & 63));
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
   128
            else
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
   129
                dest.put((int)(destPos >>> 6), dest.get((int)(destPos >>> 6)) & ~(1L << (destPos & 63)));
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
   130
        }
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
   131
    }
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
   132
    public static void main(String[] args) {
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
   133
        Random r = new Random();
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
   134
        int entries = 1000;
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
   135
        boolean[] src = new boolean[entries * 64];
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
   136
        long[] dest = new long[entries];
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
   137
        long[] result = new long[entries];
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
   138
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
   139
        for (int c = 0; c < 2000; c++) {
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
   140
            for (int i = 0; i < entries; i++) {
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
   141
                long l = r.nextLong();
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
   142
                for (int bit = 0; bit < 64; bit++) {
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
   143
                    src[i * 64 + bit] = (l & (1L << bit)) != 0;
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
   144
                }
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
   145
                dest[i] = 0;
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
   146
                result[i] = l;
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
   147
            }
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
   148
            test(src, 0, LongBuffer.wrap(dest, 0, dest.length), 0, src.length);
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
   149
            for (int i = 0; i < entries; i++) {
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
   150
                if (dest[i] != result[i]) {
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
   151
                    throw new InternalError(i + ": " + Long.toHexString(dest[i]) + " != " + Long.toHexString(result[i]));
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
   152
                }
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
   153
            }
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
   154
        }
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
   155
    }
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
   156
}