28 *
29 * @run main/othervm -server -Xbatch -XX:CompileOnly=Test1.init Test1
30 */
31
32 public class Test1 {
33
34 public static void init(int src[], int [] dst, int[] ref) {
35 // initialize the arrays
36 for (int i =0; i<src.length; i++) {
37 src[i] = i;
38 dst[i] = 2; // yes, dst[i] needed(otherwise src[i] will be replaced with i)
39 ref[i] = src[i]; // src[i] depends on the store src[i]
40 }
41 }
42
43 public static void verify(int src[], int[] ref) {
44 // check whether src and ref are equal
45 for (int i = 0; i < src.length; i++) {
46 if (src[i] != ref[i]) {
47 System.out.println("Error: src and ref don't match at " + i);
48 System.exit(-1);
49 }
50 }
51 }
52
53 public static void test() {
54 int[] src = new int[34];
55 int[] dst = new int[34];
56 int[] ref = new int[34];
57
58 init(src, dst, ref);
59 verify(src, ref);
60 }
61
62 public static void main(String[] args) {
63 for (int i=0; i< 2000; i++) {
64 test();
65 }
66 }
67 }
|
28 *
29 * @run main/othervm -server -Xbatch -XX:CompileOnly=Test1.init Test1
30 */
31
32 public class Test1 {
33
34 public static void init(int src[], int [] dst, int[] ref) {
35 // initialize the arrays
36 for (int i =0; i<src.length; i++) {
37 src[i] = i;
38 dst[i] = 2; // yes, dst[i] needed(otherwise src[i] will be replaced with i)
39 ref[i] = src[i]; // src[i] depends on the store src[i]
40 }
41 }
42
43 public static void verify(int src[], int[] ref) {
44 // check whether src and ref are equal
45 for (int i = 0; i < src.length; i++) {
46 if (src[i] != ref[i]) {
47 System.out.println("Error: src and ref don't match at " + i);
48 System.exit(97);
49 }
50 }
51 }
52
53 public static void test() {
54 int[] src = new int[34];
55 int[] dst = new int[34];
56 int[] ref = new int[34];
57
58 init(src, dst, ref);
59 verify(src, ref);
60 }
61
62 public static void main(String[] args) {
63 for (int i=0; i< 2000; i++) {
64 test();
65 }
66 }
67 }
|