hotspot/test/compiler/6661247/Test.java
author never
Wed, 19 Mar 2008 15:14:36 -0700
changeset 243 79b67a7a584a
child 603 0e934fae2fc2
permissions -rw-r--r--
6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations Summary: copy elimination of a constant value results in incorrect execution Reviewed-by: kvn, sgoldman, rasbold
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
/*
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
     2
 * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
     3
 * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
     4
 *
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
     5
 *
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
     6
 *
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
     7
 *
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
     8
 *
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
     9
 *
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    10
 *
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    11
 *
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    12
 *
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    13
 *
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    14
 *
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    15
 *
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    16
 *
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    17
 *
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    18
 *
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    19
 *
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    20
 *
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    21
 *
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
 * @test
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    26
 * @bug 6661247
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    27
 * @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
    28
 */
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
import java.util.Random;
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    31
import java.nio.*;
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    32
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    33
// 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
    34
// 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
    35
// the issue in current builds.
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    36
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    37
public class Test {
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    38
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    39
    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
    40
        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
    41
        if (countStart > count)
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    42
            countStart = count;
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    43
        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
    44
            if (src[srcPos])
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    45
                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
    46
            else
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    47
                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
    48
        }
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    49
        count -= countStart;
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    50
        int cnt = count >>> 6;
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    51
        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
    52
            int low = (src[srcPos] ? 1 : 0)
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    53
                | (src[srcPos + 1] ? 1 << 1 : 0)
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    54
                | (src[srcPos + 2] ? 1 << 2 : 0)
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    55
                | (src[srcPos + 3] ? 1 << 3 : 0)
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    56
                | (src[srcPos + 4] ? 1 << 4 : 0)
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    57
                | (src[srcPos + 5] ? 1 << 5 : 0)
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    58
                | (src[srcPos + 6] ? 1 << 6 : 0)
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    59
                | (src[srcPos + 7] ? 1 << 7 : 0)
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    60
                | (src[srcPos + 8] ? 1 << 8 : 0)
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    61
                | (src[srcPos + 9] ? 1 << 9 : 0)
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    62
                | (src[srcPos + 10] ? 1 << 10 : 0)
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    63
                | (src[srcPos + 11] ? 1 << 11 : 0)
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    64
                | (src[srcPos + 12] ? 1 << 12 : 0)
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    65
                | (src[srcPos + 13] ? 1 << 13 : 0)
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    66
                | (src[srcPos + 14] ? 1 << 14 : 0)
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    67
                | (src[srcPos + 15] ? 1 << 15 : 0)
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    68
                | (src[srcPos + 16] ? 1 << 16 : 0)
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    69
                | (src[srcPos + 17] ? 1 << 17 : 0)
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    70
                | (src[srcPos + 18] ? 1 << 18 : 0)
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    71
                | (src[srcPos + 19] ? 1 << 19 : 0)
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    72
                | (src[srcPos + 20] ? 1 << 20 : 0)
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    73
                | (src[srcPos + 21] ? 1 << 21 : 0)
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    74
                | (src[srcPos + 22] ? 1 << 22 : 0)
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    75
                | (src[srcPos + 23] ? 1 << 23 : 0)
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    76
                | (src[srcPos + 24] ? 1 << 24 : 0)
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    77
                | (src[srcPos + 25] ? 1 << 25 : 0)
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    78
                | (src[srcPos + 26] ? 1 << 26 : 0)
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    79
                | (src[srcPos + 27] ? 1 << 27 : 0)
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    80
                | (src[srcPos + 28] ? 1 << 28 : 0)
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    81
                | (src[srcPos + 29] ? 1 << 29 : 0)
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    82
                | (src[srcPos + 30] ? 1 << 30 : 0)
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    83
                | (src[srcPos + 31] ? 1 << 31 : 0)
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    84
                ;
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    85
            srcPos += 32;
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    86
            int high = (src[srcPos] ? 1 : 0)        // PROBLEM!
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    87
                | (src[srcPos + 1] ? 1 << 1 : 0)
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    88
                | (src[srcPos + 2] ? 1 << 2 : 0)
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    89
                | (src[srcPos + 3] ? 1 << 3 : 0)
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    90
                | (src[srcPos + 4] ? 1 << 4 : 0)
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    91
                | (src[srcPos + 5] ? 1 << 5 : 0)
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    92
                | (src[srcPos + 6] ? 1 << 6 : 0)
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    93
                | (src[srcPos + 7] ? 1 << 7 : 0)
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    94
                | (src[srcPos + 8] ? 1 << 8 : 0)
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    95
                | (src[srcPos + 9] ? 1 << 9 : 0)
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    96
                | (src[srcPos + 10] ? 1 << 10 : 0)
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    97
                | (src[srcPos + 11] ? 1 << 11 : 0)
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    98
                | (src[srcPos + 12] ? 1 << 12 : 0)
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
    99
                | (src[srcPos + 13] ? 1 << 13 : 0)
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
   100
                | (src[srcPos + 14] ? 1 << 14 : 0)
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
   101
                | (src[srcPos + 15] ? 1 << 15 : 0)
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
   102
                | (src[srcPos + 16] ? 1 << 16 : 0)
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
   103
                | (src[srcPos + 17] ? 1 << 17 : 0)
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
   104
                | (src[srcPos + 18] ? 1 << 18 : 0)
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
   105
                | (src[srcPos + 19] ? 1 << 19 : 0)
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
   106
                | (src[srcPos + 20] ? 1 << 20 : 0)
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
   107
                | (src[srcPos + 21] ? 1 << 21 : 0)
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
   108
                | (src[srcPos + 22] ? 1 << 22 : 0)
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
   109
                | (src[srcPos + 23] ? 1 << 23 : 0)
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
   110
                | (src[srcPos + 24] ? 1 << 24 : 0)
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
   111
                | (src[srcPos + 25] ? 1 << 25 : 0)
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
   112
                | (src[srcPos + 26] ? 1 << 26 : 0)
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
   113
                | (src[srcPos + 27] ? 1 << 27 : 0)
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
   114
                | (src[srcPos + 28] ? 1 << 28 : 0)
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
   115
                | (src[srcPos + 29] ? 1 << 29 : 0)
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
   116
                | (src[srcPos + 30] ? 1 << 30 : 0)
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
   117
                | (src[srcPos + 31] ? 1 << 31 : 0)
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
   118
                ;
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
   119
            srcPos += 32;
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
   120
            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
   121
            destPos += 64;
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
   122
        }
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
   123
        int countFinish = count & 63;
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
   124
        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
   125
            if (src[srcPos])
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
   126
                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
   127
            else
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
   128
                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
   129
        }
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
    public static void main(String[] args) {
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
   132
        Random r = new Random();
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
   133
        int entries = 1000;
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
   134
        boolean[] src = new boolean[entries * 64];
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
   135
        long[] dest = new long[entries];
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
   136
        long[] result = new long[entries];
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
   137
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
   138
        for (int c = 0; c < 2000; c++) {
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
   139
            for (int i = 0; i < entries; i++) {
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
   140
                long l = r.nextLong();
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
   141
                for (int bit = 0; bit < 64; bit++) {
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
   142
                    src[i * 64 + bit] = (l & (1L << bit)) != 0;
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
   143
                }
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
   144
                dest[i] = 0;
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
   145
                result[i] = l;
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
   146
            }
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
   147
            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
   148
            for (int i = 0; i < entries; i++) {
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
   149
                if (dest[i] != result[i]) {
79b67a7a584a 6661247: Internal bug in 32-bit HotSpot optimizer while bit manipulations
never
parents:
diff changeset
   150
                    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
   151
                }
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
}