2
* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5
* This code is free software; you can redistribute it and/or modify it
6
* under the terms of the GNU General Public License version 2 only, as
7
* published by the Free Software Foundation.
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).
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.
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
27
* @summary SIGBUS in jbyte_fill
29
* @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+OptimizeFill -Xbatch
30
* compiler.intrinsics.Test6982370
33
package compiler.intrinsics;
35
import java.util.Arrays;
38
* Exercise the fill routine for various short alignments and sizes
41
public class Test6982370 {
42
public static void main(String[] args) {
50
public static void test_int() {
51
int[] a = new int[16];
52
for (int i = 0; i < 200000; i++) {
54
int end = start + ((i >> 4) & 7);
56
if ((i & 1) == 1) value = -value;
57
Arrays.fill(a, start, end, value);
58
boolean error = false;
59
for (int j = start; j < end; j++) {
61
System.err.println("a[" + j + "] = " + a[j] + " != " + value + " for " + a.length);
65
if (error) throw new InternalError();
69
public static void test_float() {
70
float[] a = new float[16];
71
for (int i = 0; i < 200000; i++) {
73
int end = start + ((i >> 4) & 7);
74
float value = (float)i;
75
if ((i & 1) == 1) value = -value;
76
Arrays.fill(a, start, end, value);
77
boolean error = false;
78
for (int j = start; j < end; j++) {
80
System.err.println("a[" + j + "] = " + a[j] + " != " + value + " for " + a.length);
84
if (error) throw new InternalError();
87
public static void test_char() {
88
char[] a = new char[16];
89
for (int i = 0; i < 200000; i++) {
91
int end = start + ((i >> 4) & 7);
93
Arrays.fill(a, start, end, value);
94
boolean error = false;
95
for (int j = start; j < end; j++) {
97
System.err.println("a[" + j + "] = " + a[j] + " != " + value + " for " + a.length);
101
if (error) throw new InternalError();
104
public static void test_short() {
105
short[] a = new short[16];
106
for (int i = 0; i < 200000; i++) {
108
int end = start + ((i >> 4) & 7);
109
short value = (short)i;
110
if ((i & 1) == 1) value = (short)-value;
111
Arrays.fill(a, start, end, value);
112
boolean error = false;
113
for (int j = start; j < end; j++) {
115
System.err.println("a[" + j + "] = " + a[j] + " != " + value + " for " + a.length);
119
if (error) throw new InternalError();
123
public static void test_byte() {
124
for (int i = 0; i < 200000; i++) {
125
byte[] a = new byte[16];
127
int end = start + ((i >> 4) & 7);
128
byte value = (byte)i;
129
if ((i & 1) == 1) value = (byte)-value;
130
Arrays.fill(a, start, end, value);
131
boolean error = false;
132
for (int j = start; j < end; j++) {
134
System.err.println("a[" + j + "] = " + a[j] + " != " + value + " for " + a.length);
138
if (error) throw new InternalError();