Mercurial > hg > truffle
annotate test/compiler/6892265/Test.java @ 1337:3d531bbe5917
Merge
author | acorn |
---|---|
date | Thu, 28 Jan 2010 13:59:18 -0500 |
parents | b5d78a3b8843 |
children | c18cbe5936b8 |
rev | line source |
---|---|
1334
b5d78a3b8843
6892265: System.arraycopy unable to reference elements beyond Integer.MAX_VALUE bytes
kvn
parents:
diff
changeset
|
1 /* |
b5d78a3b8843
6892265: System.arraycopy unable to reference elements beyond Integer.MAX_VALUE bytes
kvn
parents:
diff
changeset
|
2 * Copyright 2009 Sun Microsystems, Inc. All Rights Reserved. |
b5d78a3b8843
6892265: System.arraycopy unable to reference elements beyond Integer.MAX_VALUE bytes
kvn
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
b5d78a3b8843
6892265: System.arraycopy unable to reference elements beyond Integer.MAX_VALUE bytes
kvn
parents:
diff
changeset
|
4 * |
b5d78a3b8843
6892265: System.arraycopy unable to reference elements beyond Integer.MAX_VALUE bytes
kvn
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
b5d78a3b8843
6892265: System.arraycopy unable to reference elements beyond Integer.MAX_VALUE bytes
kvn
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
b5d78a3b8843
6892265: System.arraycopy unable to reference elements beyond Integer.MAX_VALUE bytes
kvn
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
b5d78a3b8843
6892265: System.arraycopy unable to reference elements beyond Integer.MAX_VALUE bytes
kvn
parents:
diff
changeset
|
8 * |
b5d78a3b8843
6892265: System.arraycopy unable to reference elements beyond Integer.MAX_VALUE bytes
kvn
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
b5d78a3b8843
6892265: System.arraycopy unable to reference elements beyond Integer.MAX_VALUE bytes
kvn
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
b5d78a3b8843
6892265: System.arraycopy unable to reference elements beyond Integer.MAX_VALUE bytes
kvn
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
b5d78a3b8843
6892265: System.arraycopy unable to reference elements beyond Integer.MAX_VALUE bytes
kvn
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
b5d78a3b8843
6892265: System.arraycopy unable to reference elements beyond Integer.MAX_VALUE bytes
kvn
parents:
diff
changeset
|
13 * accompanied this code). |
b5d78a3b8843
6892265: System.arraycopy unable to reference elements beyond Integer.MAX_VALUE bytes
kvn
parents:
diff
changeset
|
14 * |
b5d78a3b8843
6892265: System.arraycopy unable to reference elements beyond Integer.MAX_VALUE bytes
kvn
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
b5d78a3b8843
6892265: System.arraycopy unable to reference elements beyond Integer.MAX_VALUE bytes
kvn
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
b5d78a3b8843
6892265: System.arraycopy unable to reference elements beyond Integer.MAX_VALUE bytes
kvn
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
b5d78a3b8843
6892265: System.arraycopy unable to reference elements beyond Integer.MAX_VALUE bytes
kvn
parents:
diff
changeset
|
18 * |
b5d78a3b8843
6892265: System.arraycopy unable to reference elements beyond Integer.MAX_VALUE bytes
kvn
parents:
diff
changeset
|
19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, |
b5d78a3b8843
6892265: System.arraycopy unable to reference elements beyond Integer.MAX_VALUE bytes
kvn
parents:
diff
changeset
|
20 * CA 95054 USA or visit www.sun.com if you need additional information or |
b5d78a3b8843
6892265: System.arraycopy unable to reference elements beyond Integer.MAX_VALUE bytes
kvn
parents:
diff
changeset
|
21 * have any questions. |
b5d78a3b8843
6892265: System.arraycopy unable to reference elements beyond Integer.MAX_VALUE bytes
kvn
parents:
diff
changeset
|
22 * |
b5d78a3b8843
6892265: System.arraycopy unable to reference elements beyond Integer.MAX_VALUE bytes
kvn
parents:
diff
changeset
|
23 */ |
b5d78a3b8843
6892265: System.arraycopy unable to reference elements beyond Integer.MAX_VALUE bytes
kvn
parents:
diff
changeset
|
24 |
b5d78a3b8843
6892265: System.arraycopy unable to reference elements beyond Integer.MAX_VALUE bytes
kvn
parents:
diff
changeset
|
25 /** |
b5d78a3b8843
6892265: System.arraycopy unable to reference elements beyond Integer.MAX_VALUE bytes
kvn
parents:
diff
changeset
|
26 * @test |
b5d78a3b8843
6892265: System.arraycopy unable to reference elements beyond Integer.MAX_VALUE bytes
kvn
parents:
diff
changeset
|
27 * @bug 6892265 |
b5d78a3b8843
6892265: System.arraycopy unable to reference elements beyond Integer.MAX_VALUE bytes
kvn
parents:
diff
changeset
|
28 * @summary System.arraycopy unable to reference elements beyond Integer.MAX_VALUE bytes |
b5d78a3b8843
6892265: System.arraycopy unable to reference elements beyond Integer.MAX_VALUE bytes
kvn
parents:
diff
changeset
|
29 * |
b5d78a3b8843
6892265: System.arraycopy unable to reference elements beyond Integer.MAX_VALUE bytes
kvn
parents:
diff
changeset
|
30 * @run main/othervm Test |
b5d78a3b8843
6892265: System.arraycopy unable to reference elements beyond Integer.MAX_VALUE bytes
kvn
parents:
diff
changeset
|
31 */ |
b5d78a3b8843
6892265: System.arraycopy unable to reference elements beyond Integer.MAX_VALUE bytes
kvn
parents:
diff
changeset
|
32 |
b5d78a3b8843
6892265: System.arraycopy unable to reference elements beyond Integer.MAX_VALUE bytes
kvn
parents:
diff
changeset
|
33 public class Test { |
b5d78a3b8843
6892265: System.arraycopy unable to reference elements beyond Integer.MAX_VALUE bytes
kvn
parents:
diff
changeset
|
34 static final int NCOPY = 1; |
b5d78a3b8843
6892265: System.arraycopy unable to reference elements beyond Integer.MAX_VALUE bytes
kvn
parents:
diff
changeset
|
35 static final int OVERFLOW = 1; |
b5d78a3b8843
6892265: System.arraycopy unable to reference elements beyond Integer.MAX_VALUE bytes
kvn
parents:
diff
changeset
|
36 static int[] src2 = new int[NCOPY]; |
b5d78a3b8843
6892265: System.arraycopy unable to reference elements beyond Integer.MAX_VALUE bytes
kvn
parents:
diff
changeset
|
37 static int[] dst2; |
b5d78a3b8843
6892265: System.arraycopy unable to reference elements beyond Integer.MAX_VALUE bytes
kvn
parents:
diff
changeset
|
38 |
b5d78a3b8843
6892265: System.arraycopy unable to reference elements beyond Integer.MAX_VALUE bytes
kvn
parents:
diff
changeset
|
39 static void test() { |
b5d78a3b8843
6892265: System.arraycopy unable to reference elements beyond Integer.MAX_VALUE bytes
kvn
parents:
diff
changeset
|
40 int N; |
b5d78a3b8843
6892265: System.arraycopy unable to reference elements beyond Integer.MAX_VALUE bytes
kvn
parents:
diff
changeset
|
41 int SIZE; |
b5d78a3b8843
6892265: System.arraycopy unable to reference elements beyond Integer.MAX_VALUE bytes
kvn
parents:
diff
changeset
|
42 |
b5d78a3b8843
6892265: System.arraycopy unable to reference elements beyond Integer.MAX_VALUE bytes
kvn
parents:
diff
changeset
|
43 N = Integer.MAX_VALUE/4 + OVERFLOW; |
b5d78a3b8843
6892265: System.arraycopy unable to reference elements beyond Integer.MAX_VALUE bytes
kvn
parents:
diff
changeset
|
44 System.arraycopy(src2, 0, dst2, N, NCOPY); |
b5d78a3b8843
6892265: System.arraycopy unable to reference elements beyond Integer.MAX_VALUE bytes
kvn
parents:
diff
changeset
|
45 System.arraycopy(dst2, N, src2, 0, NCOPY); |
b5d78a3b8843
6892265: System.arraycopy unable to reference elements beyond Integer.MAX_VALUE bytes
kvn
parents:
diff
changeset
|
46 } |
b5d78a3b8843
6892265: System.arraycopy unable to reference elements beyond Integer.MAX_VALUE bytes
kvn
parents:
diff
changeset
|
47 |
b5d78a3b8843
6892265: System.arraycopy unable to reference elements beyond Integer.MAX_VALUE bytes
kvn
parents:
diff
changeset
|
48 public static void main(String[] args) { |
b5d78a3b8843
6892265: System.arraycopy unable to reference elements beyond Integer.MAX_VALUE bytes
kvn
parents:
diff
changeset
|
49 try { |
b5d78a3b8843
6892265: System.arraycopy unable to reference elements beyond Integer.MAX_VALUE bytes
kvn
parents:
diff
changeset
|
50 dst2 = new int[NCOPY + Integer.MAX_VALUE/4 + OVERFLOW]; |
b5d78a3b8843
6892265: System.arraycopy unable to reference elements beyond Integer.MAX_VALUE bytes
kvn
parents:
diff
changeset
|
51 } catch (OutOfMemoryError e) { |
b5d78a3b8843
6892265: System.arraycopy unable to reference elements beyond Integer.MAX_VALUE bytes
kvn
parents:
diff
changeset
|
52 System.exit(95); // Not enough memory |
b5d78a3b8843
6892265: System.arraycopy unable to reference elements beyond Integer.MAX_VALUE bytes
kvn
parents:
diff
changeset
|
53 } |
b5d78a3b8843
6892265: System.arraycopy unable to reference elements beyond Integer.MAX_VALUE bytes
kvn
parents:
diff
changeset
|
54 System.out.println("warmup"); |
b5d78a3b8843
6892265: System.arraycopy unable to reference elements beyond Integer.MAX_VALUE bytes
kvn
parents:
diff
changeset
|
55 for (int i=0; i <11000; i++) { |
b5d78a3b8843
6892265: System.arraycopy unable to reference elements beyond Integer.MAX_VALUE bytes
kvn
parents:
diff
changeset
|
56 test(); |
b5d78a3b8843
6892265: System.arraycopy unable to reference elements beyond Integer.MAX_VALUE bytes
kvn
parents:
diff
changeset
|
57 } |
b5d78a3b8843
6892265: System.arraycopy unable to reference elements beyond Integer.MAX_VALUE bytes
kvn
parents:
diff
changeset
|
58 System.out.println("start"); |
b5d78a3b8843
6892265: System.arraycopy unable to reference elements beyond Integer.MAX_VALUE bytes
kvn
parents:
diff
changeset
|
59 for (int i=0; i <1000; i++) { |
b5d78a3b8843
6892265: System.arraycopy unable to reference elements beyond Integer.MAX_VALUE bytes
kvn
parents:
diff
changeset
|
60 test(); |
b5d78a3b8843
6892265: System.arraycopy unable to reference elements beyond Integer.MAX_VALUE bytes
kvn
parents:
diff
changeset
|
61 } |
b5d78a3b8843
6892265: System.arraycopy unable to reference elements beyond Integer.MAX_VALUE bytes
kvn
parents:
diff
changeset
|
62 System.out.println("finish"); |
b5d78a3b8843
6892265: System.arraycopy unable to reference elements beyond Integer.MAX_VALUE bytes
kvn
parents:
diff
changeset
|
63 } |
b5d78a3b8843
6892265: System.arraycopy unable to reference elements beyond Integer.MAX_VALUE bytes
kvn
parents:
diff
changeset
|
64 |
b5d78a3b8843
6892265: System.arraycopy unable to reference elements beyond Integer.MAX_VALUE bytes
kvn
parents:
diff
changeset
|
65 } |