9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 /*
26 * @test
27 * @bug 6661247
28 * @summary Internal bug in 32-bit HotSpot optimizer while bit manipulations
29 */
30
31 import java.util.Random;
32 import java.nio.*;
33
34 // This isn't a completely reliable test for 6661247 since the results
35 // depend on what the local schedule looks like but it does reproduce
36 // the issue in current builds.
37
38 public class Test {
39
40 public static void test(boolean[] src, int srcPos, LongBuffer dest, long destPos, int count) {
41 int countStart = (destPos & 63) == 0 ? 0 : 64 - (int)(destPos & 63);
42 if (countStart > count)
43 countStart = count;
44 for (int srcPosMax = srcPos + countStart; srcPos < srcPosMax; srcPos++, destPos++) {
45 if (src[srcPos])
46 dest.put((int)(destPos >>> 6), dest.get((int)(destPos >>> 6)) | 1L << (destPos & 63));
47 else
48 dest.put((int)(destPos >>> 6), dest.get((int)(destPos >>> 6)) & ~(1L << (destPos & 63)));
49 }
50 count -= countStart;
51 int cnt = count >>> 6;
52 for (int k = (int)(destPos >>> 6), kMax = k + cnt; k < kMax; k++) {
53 int low = (src[srcPos] ? 1 : 0)
54 | (src[srcPos + 1] ? 1 << 1 : 0)
55 | (src[srcPos + 2] ? 1 << 2 : 0)
56 | (src[srcPos + 3] ? 1 << 3 : 0)
57 | (src[srcPos + 4] ? 1 << 4 : 0)
58 | (src[srcPos + 5] ? 1 << 5 : 0)
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 /*
26 * @test
27 * @bug 6661247
28 * @summary Internal bug in 32-bit HotSpot optimizer while bit manipulations
29 *
30 * @run main compiler.c2.Test6661247
31 */
32
33 package compiler.c2;
34
35 import java.nio.LongBuffer;
36 import java.util.Random;
37
38 // This isn't a completely reliable test for 6661247 since the results
39 // depend on what the local schedule looks like but it does reproduce
40 // the issue in current builds.
41
42 public class Test6661247 {
43
44 public static void test(boolean[] src, int srcPos, LongBuffer dest, long destPos, int count) {
45 int countStart = (destPos & 63) == 0 ? 0 : 64 - (int)(destPos & 63);
46 if (countStart > count)
47 countStart = count;
48 for (int srcPosMax = srcPos + countStart; srcPos < srcPosMax; srcPos++, destPos++) {
49 if (src[srcPos])
50 dest.put((int)(destPos >>> 6), dest.get((int)(destPos >>> 6)) | 1L << (destPos & 63));
51 else
52 dest.put((int)(destPos >>> 6), dest.get((int)(destPos >>> 6)) & ~(1L << (destPos & 63)));
53 }
54 count -= countStart;
55 int cnt = count >>> 6;
56 for (int k = (int)(destPos >>> 6), kMax = k + cnt; k < kMax; k++) {
57 int low = (src[srcPos] ? 1 : 0)
58 | (src[srcPos + 1] ? 1 << 1 : 0)
59 | (src[srcPos + 2] ? 1 << 2 : 0)
60 | (src[srcPos + 3] ? 1 << 3 : 0)
61 | (src[srcPos + 4] ? 1 << 4 : 0)
62 | (src[srcPos + 5] ? 1 << 5 : 0)
|