Mercurial > hg > truffle
annotate test/compiler/6851282/Test.java @ 10988:cd54c7e92908
8015660: Test8009761.java "Failed: init recursive calls: 24. After deopt 25"
Summary: Windows reserves and only partially commits thread stack. For detecting more thread stack space for execution, Windows installs one-shot page as guard page just before the current commited edge. It will trigger STACK_OVERFLOW_EXCEPTION when lands on last 4 pages of thread stack space. StackYellowPages default value is 2 on Windows (plus 1 page of StackRedPages, 3 pages guarded by hotspot) so the exception happens one page before Yellow pages. Same route executed second time will have one more page brought in, this leads same execution with different stack depth(interpreter mode). We need match Windows settings so the stack overflow exception will not happen before Yellow pages.
Reviewed-by: dholmes
Contributed-by: andreas.schoesser@sap.com
author | minqi |
---|---|
date | Tue, 18 Jun 2013 09:08:35 -0700 |
parents | c18cbe5936b8 |
children |
rev | line source |
---|---|
853
64219d2a6493
6851282: JIT miscompilation results in null entry in array when using CompressedOops
kvn
parents:
diff
changeset
|
1 /* |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
901
diff
changeset
|
2 * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved. |
853
64219d2a6493
6851282: JIT miscompilation results in null entry in array when using CompressedOops
kvn
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
64219d2a6493
6851282: JIT miscompilation results in null entry in array when using CompressedOops
kvn
parents:
diff
changeset
|
4 * |
64219d2a6493
6851282: JIT miscompilation results in null entry in array when using CompressedOops
kvn
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
64219d2a6493
6851282: JIT miscompilation results in null entry in array when using CompressedOops
kvn
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
64219d2a6493
6851282: JIT miscompilation results in null entry in array when using CompressedOops
kvn
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
64219d2a6493
6851282: JIT miscompilation results in null entry in array when using CompressedOops
kvn
parents:
diff
changeset
|
8 * |
64219d2a6493
6851282: JIT miscompilation results in null entry in array when using CompressedOops
kvn
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
64219d2a6493
6851282: JIT miscompilation results in null entry in array when using CompressedOops
kvn
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
64219d2a6493
6851282: JIT miscompilation results in null entry in array when using CompressedOops
kvn
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
64219d2a6493
6851282: JIT miscompilation results in null entry in array when using CompressedOops
kvn
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
64219d2a6493
6851282: JIT miscompilation results in null entry in array when using CompressedOops
kvn
parents:
diff
changeset
|
13 * accompanied this code). |
64219d2a6493
6851282: JIT miscompilation results in null entry in array when using CompressedOops
kvn
parents:
diff
changeset
|
14 * |
64219d2a6493
6851282: JIT miscompilation results in null entry in array when using CompressedOops
kvn
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
64219d2a6493
6851282: JIT miscompilation results in null entry in array when using CompressedOops
kvn
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
64219d2a6493
6851282: JIT miscompilation results in null entry in array when using CompressedOops
kvn
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
64219d2a6493
6851282: JIT miscompilation results in null entry in array when using CompressedOops
kvn
parents:
diff
changeset
|
18 * |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
901
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
901
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
901
diff
changeset
|
21 * questions. |
853
64219d2a6493
6851282: JIT miscompilation results in null entry in array when using CompressedOops
kvn
parents:
diff
changeset
|
22 * |
64219d2a6493
6851282: JIT miscompilation results in null entry in array when using CompressedOops
kvn
parents:
diff
changeset
|
23 */ |
64219d2a6493
6851282: JIT miscompilation results in null entry in array when using CompressedOops
kvn
parents:
diff
changeset
|
24 |
64219d2a6493
6851282: JIT miscompilation results in null entry in array when using CompressedOops
kvn
parents:
diff
changeset
|
25 /** |
64219d2a6493
6851282: JIT miscompilation results in null entry in array when using CompressedOops
kvn
parents:
diff
changeset
|
26 * @test |
64219d2a6493
6851282: JIT miscompilation results in null entry in array when using CompressedOops
kvn
parents:
diff
changeset
|
27 * @bug 6851282 |
64219d2a6493
6851282: JIT miscompilation results in null entry in array when using CompressedOops
kvn
parents:
diff
changeset
|
28 * @summary JIT miscompilation results in null entry in array when using CompressedOops |
64219d2a6493
6851282: JIT miscompilation results in null entry in array when using CompressedOops
kvn
parents:
diff
changeset
|
29 * |
901 | 30 * @run main/othervm/timeout=600 -Xmx256m -XX:+IgnoreUnrecognizedVMOptions -XX:+UseCompressedOops Test |
853
64219d2a6493
6851282: JIT miscompilation results in null entry in array when using CompressedOops
kvn
parents:
diff
changeset
|
31 */ |
64219d2a6493
6851282: JIT miscompilation results in null entry in array when using CompressedOops
kvn
parents:
diff
changeset
|
32 |
64219d2a6493
6851282: JIT miscompilation results in null entry in array when using CompressedOops
kvn
parents:
diff
changeset
|
33 import java.util.ArrayList; |
64219d2a6493
6851282: JIT miscompilation results in null entry in array when using CompressedOops
kvn
parents:
diff
changeset
|
34 import java.util.List; |
64219d2a6493
6851282: JIT miscompilation results in null entry in array when using CompressedOops
kvn
parents:
diff
changeset
|
35 |
64219d2a6493
6851282: JIT miscompilation results in null entry in array when using CompressedOops
kvn
parents:
diff
changeset
|
36 public class Test { |
64219d2a6493
6851282: JIT miscompilation results in null entry in array when using CompressedOops
kvn
parents:
diff
changeset
|
37 void foo(A a, A[] as) { |
64219d2a6493
6851282: JIT miscompilation results in null entry in array when using CompressedOops
kvn
parents:
diff
changeset
|
38 for (A a1 : as) { |
64219d2a6493
6851282: JIT miscompilation results in null entry in array when using CompressedOops
kvn
parents:
diff
changeset
|
39 B[] filtered = a.c(a1); |
64219d2a6493
6851282: JIT miscompilation results in null entry in array when using CompressedOops
kvn
parents:
diff
changeset
|
40 for (B b : filtered) { |
64219d2a6493
6851282: JIT miscompilation results in null entry in array when using CompressedOops
kvn
parents:
diff
changeset
|
41 if (b == null) { |
64219d2a6493
6851282: JIT miscompilation results in null entry in array when using CompressedOops
kvn
parents:
diff
changeset
|
42 System.out.println("bug: b == null"); |
64219d2a6493
6851282: JIT miscompilation results in null entry in array when using CompressedOops
kvn
parents:
diff
changeset
|
43 System.exit(97); |
64219d2a6493
6851282: JIT miscompilation results in null entry in array when using CompressedOops
kvn
parents:
diff
changeset
|
44 } |
64219d2a6493
6851282: JIT miscompilation results in null entry in array when using CompressedOops
kvn
parents:
diff
changeset
|
45 } |
64219d2a6493
6851282: JIT miscompilation results in null entry in array when using CompressedOops
kvn
parents:
diff
changeset
|
46 } |
64219d2a6493
6851282: JIT miscompilation results in null entry in array when using CompressedOops
kvn
parents:
diff
changeset
|
47 } |
64219d2a6493
6851282: JIT miscompilation results in null entry in array when using CompressedOops
kvn
parents:
diff
changeset
|
48 |
64219d2a6493
6851282: JIT miscompilation results in null entry in array when using CompressedOops
kvn
parents:
diff
changeset
|
49 public static void main(String[] args) { |
64219d2a6493
6851282: JIT miscompilation results in null entry in array when using CompressedOops
kvn
parents:
diff
changeset
|
50 List<A> as = new ArrayList<A>(); |
64219d2a6493
6851282: JIT miscompilation results in null entry in array when using CompressedOops
kvn
parents:
diff
changeset
|
51 for (int i = 0; i < 5000; i++) { |
64219d2a6493
6851282: JIT miscompilation results in null entry in array when using CompressedOops
kvn
parents:
diff
changeset
|
52 List<B> bs = new ArrayList<B>(); |
64219d2a6493
6851282: JIT miscompilation results in null entry in array when using CompressedOops
kvn
parents:
diff
changeset
|
53 for (int j = i; j < i + 1000; j++) |
64219d2a6493
6851282: JIT miscompilation results in null entry in array when using CompressedOops
kvn
parents:
diff
changeset
|
54 bs.add(new B(j)); |
64219d2a6493
6851282: JIT miscompilation results in null entry in array when using CompressedOops
kvn
parents:
diff
changeset
|
55 as.add(new A(bs.toArray(new B[0]))); |
64219d2a6493
6851282: JIT miscompilation results in null entry in array when using CompressedOops
kvn
parents:
diff
changeset
|
56 } |
64219d2a6493
6851282: JIT miscompilation results in null entry in array when using CompressedOops
kvn
parents:
diff
changeset
|
57 new Test().foo(as.get(0), as.subList(1, as.size()).toArray(new A[0])); |
64219d2a6493
6851282: JIT miscompilation results in null entry in array when using CompressedOops
kvn
parents:
diff
changeset
|
58 } |
64219d2a6493
6851282: JIT miscompilation results in null entry in array when using CompressedOops
kvn
parents:
diff
changeset
|
59 } |
64219d2a6493
6851282: JIT miscompilation results in null entry in array when using CompressedOops
kvn
parents:
diff
changeset
|
60 |
64219d2a6493
6851282: JIT miscompilation results in null entry in array when using CompressedOops
kvn
parents:
diff
changeset
|
61 class A { |
64219d2a6493
6851282: JIT miscompilation results in null entry in array when using CompressedOops
kvn
parents:
diff
changeset
|
62 final B[] bs; |
64219d2a6493
6851282: JIT miscompilation results in null entry in array when using CompressedOops
kvn
parents:
diff
changeset
|
63 |
64219d2a6493
6851282: JIT miscompilation results in null entry in array when using CompressedOops
kvn
parents:
diff
changeset
|
64 public A(B[] bs) { |
64219d2a6493
6851282: JIT miscompilation results in null entry in array when using CompressedOops
kvn
parents:
diff
changeset
|
65 this.bs = bs; |
64219d2a6493
6851282: JIT miscompilation results in null entry in array when using CompressedOops
kvn
parents:
diff
changeset
|
66 } |
64219d2a6493
6851282: JIT miscompilation results in null entry in array when using CompressedOops
kvn
parents:
diff
changeset
|
67 |
64219d2a6493
6851282: JIT miscompilation results in null entry in array when using CompressedOops
kvn
parents:
diff
changeset
|
68 final B[] c(final A a) { |
64219d2a6493
6851282: JIT miscompilation results in null entry in array when using CompressedOops
kvn
parents:
diff
changeset
|
69 return new BoxedArray<B>(bs).filter(new Function<B, Boolean>() { |
64219d2a6493
6851282: JIT miscompilation results in null entry in array when using CompressedOops
kvn
parents:
diff
changeset
|
70 public Boolean apply(B arg) { |
64219d2a6493
6851282: JIT miscompilation results in null entry in array when using CompressedOops
kvn
parents:
diff
changeset
|
71 for (B b : a.bs) { |
64219d2a6493
6851282: JIT miscompilation results in null entry in array when using CompressedOops
kvn
parents:
diff
changeset
|
72 if (b.d == arg.d) |
64219d2a6493
6851282: JIT miscompilation results in null entry in array when using CompressedOops
kvn
parents:
diff
changeset
|
73 return true; |
64219d2a6493
6851282: JIT miscompilation results in null entry in array when using CompressedOops
kvn
parents:
diff
changeset
|
74 } |
64219d2a6493
6851282: JIT miscompilation results in null entry in array when using CompressedOops
kvn
parents:
diff
changeset
|
75 return false; |
64219d2a6493
6851282: JIT miscompilation results in null entry in array when using CompressedOops
kvn
parents:
diff
changeset
|
76 } |
64219d2a6493
6851282: JIT miscompilation results in null entry in array when using CompressedOops
kvn
parents:
diff
changeset
|
77 }); |
64219d2a6493
6851282: JIT miscompilation results in null entry in array when using CompressedOops
kvn
parents:
diff
changeset
|
78 } |
64219d2a6493
6851282: JIT miscompilation results in null entry in array when using CompressedOops
kvn
parents:
diff
changeset
|
79 } |
64219d2a6493
6851282: JIT miscompilation results in null entry in array when using CompressedOops
kvn
parents:
diff
changeset
|
80 |
64219d2a6493
6851282: JIT miscompilation results in null entry in array when using CompressedOops
kvn
parents:
diff
changeset
|
81 class BoxedArray<T> { |
64219d2a6493
6851282: JIT miscompilation results in null entry in array when using CompressedOops
kvn
parents:
diff
changeset
|
82 |
64219d2a6493
6851282: JIT miscompilation results in null entry in array when using CompressedOops
kvn
parents:
diff
changeset
|
83 private final T[] array; |
64219d2a6493
6851282: JIT miscompilation results in null entry in array when using CompressedOops
kvn
parents:
diff
changeset
|
84 |
64219d2a6493
6851282: JIT miscompilation results in null entry in array when using CompressedOops
kvn
parents:
diff
changeset
|
85 BoxedArray(T[] array) { |
64219d2a6493
6851282: JIT miscompilation results in null entry in array when using CompressedOops
kvn
parents:
diff
changeset
|
86 this.array = array; |
64219d2a6493
6851282: JIT miscompilation results in null entry in array when using CompressedOops
kvn
parents:
diff
changeset
|
87 } |
64219d2a6493
6851282: JIT miscompilation results in null entry in array when using CompressedOops
kvn
parents:
diff
changeset
|
88 |
64219d2a6493
6851282: JIT miscompilation results in null entry in array when using CompressedOops
kvn
parents:
diff
changeset
|
89 public T[] filter(Function<T, Boolean> function) { |
64219d2a6493
6851282: JIT miscompilation results in null entry in array when using CompressedOops
kvn
parents:
diff
changeset
|
90 boolean[] include = new boolean[array.length]; |
64219d2a6493
6851282: JIT miscompilation results in null entry in array when using CompressedOops
kvn
parents:
diff
changeset
|
91 int len = 0; |
64219d2a6493
6851282: JIT miscompilation results in null entry in array when using CompressedOops
kvn
parents:
diff
changeset
|
92 int i = 0; |
64219d2a6493
6851282: JIT miscompilation results in null entry in array when using CompressedOops
kvn
parents:
diff
changeset
|
93 while (i < array.length) { |
64219d2a6493
6851282: JIT miscompilation results in null entry in array when using CompressedOops
kvn
parents:
diff
changeset
|
94 if (function.apply(array[i])) { |
64219d2a6493
6851282: JIT miscompilation results in null entry in array when using CompressedOops
kvn
parents:
diff
changeset
|
95 include[i] = true; |
64219d2a6493
6851282: JIT miscompilation results in null entry in array when using CompressedOops
kvn
parents:
diff
changeset
|
96 len += 1; |
64219d2a6493
6851282: JIT miscompilation results in null entry in array when using CompressedOops
kvn
parents:
diff
changeset
|
97 } |
64219d2a6493
6851282: JIT miscompilation results in null entry in array when using CompressedOops
kvn
parents:
diff
changeset
|
98 i += 1; |
64219d2a6493
6851282: JIT miscompilation results in null entry in array when using CompressedOops
kvn
parents:
diff
changeset
|
99 } |
64219d2a6493
6851282: JIT miscompilation results in null entry in array when using CompressedOops
kvn
parents:
diff
changeset
|
100 T[] result = (T[]) java.lang.reflect.Array.newInstance(array.getClass().getComponentType(), len); |
64219d2a6493
6851282: JIT miscompilation results in null entry in array when using CompressedOops
kvn
parents:
diff
changeset
|
101 len = 0; |
64219d2a6493
6851282: JIT miscompilation results in null entry in array when using CompressedOops
kvn
parents:
diff
changeset
|
102 i = 0; |
64219d2a6493
6851282: JIT miscompilation results in null entry in array when using CompressedOops
kvn
parents:
diff
changeset
|
103 while (len < result.length) { |
64219d2a6493
6851282: JIT miscompilation results in null entry in array when using CompressedOops
kvn
parents:
diff
changeset
|
104 if (include[i]) { |
64219d2a6493
6851282: JIT miscompilation results in null entry in array when using CompressedOops
kvn
parents:
diff
changeset
|
105 result[len] = array[i]; |
64219d2a6493
6851282: JIT miscompilation results in null entry in array when using CompressedOops
kvn
parents:
diff
changeset
|
106 len += 1; |
64219d2a6493
6851282: JIT miscompilation results in null entry in array when using CompressedOops
kvn
parents:
diff
changeset
|
107 } |
64219d2a6493
6851282: JIT miscompilation results in null entry in array when using CompressedOops
kvn
parents:
diff
changeset
|
108 i += 1; |
64219d2a6493
6851282: JIT miscompilation results in null entry in array when using CompressedOops
kvn
parents:
diff
changeset
|
109 } |
64219d2a6493
6851282: JIT miscompilation results in null entry in array when using CompressedOops
kvn
parents:
diff
changeset
|
110 return result; |
64219d2a6493
6851282: JIT miscompilation results in null entry in array when using CompressedOops
kvn
parents:
diff
changeset
|
111 } |
64219d2a6493
6851282: JIT miscompilation results in null entry in array when using CompressedOops
kvn
parents:
diff
changeset
|
112 } |
64219d2a6493
6851282: JIT miscompilation results in null entry in array when using CompressedOops
kvn
parents:
diff
changeset
|
113 |
64219d2a6493
6851282: JIT miscompilation results in null entry in array when using CompressedOops
kvn
parents:
diff
changeset
|
114 interface Function<T, R> { |
64219d2a6493
6851282: JIT miscompilation results in null entry in array when using CompressedOops
kvn
parents:
diff
changeset
|
115 R apply(T arg); |
64219d2a6493
6851282: JIT miscompilation results in null entry in array when using CompressedOops
kvn
parents:
diff
changeset
|
116 } |
64219d2a6493
6851282: JIT miscompilation results in null entry in array when using CompressedOops
kvn
parents:
diff
changeset
|
117 |
64219d2a6493
6851282: JIT miscompilation results in null entry in array when using CompressedOops
kvn
parents:
diff
changeset
|
118 class B { |
64219d2a6493
6851282: JIT miscompilation results in null entry in array when using CompressedOops
kvn
parents:
diff
changeset
|
119 final int d; |
64219d2a6493
6851282: JIT miscompilation results in null entry in array when using CompressedOops
kvn
parents:
diff
changeset
|
120 public B(int d) { |
64219d2a6493
6851282: JIT miscompilation results in null entry in array when using CompressedOops
kvn
parents:
diff
changeset
|
121 this.d = d; |
64219d2a6493
6851282: JIT miscompilation results in null entry in array when using CompressedOops
kvn
parents:
diff
changeset
|
122 } |
64219d2a6493
6851282: JIT miscompilation results in null entry in array when using CompressedOops
kvn
parents:
diff
changeset
|
123 } |
64219d2a6493
6851282: JIT miscompilation results in null entry in array when using CompressedOops
kvn
parents:
diff
changeset
|
124 |