author | prr |
Thu, 25 Apr 2013 16:49:54 -0700 | |
changeset 18254 | e4083179f1c9 |
parent 15864 | 2757a5eae916 |
child 22234 | da823d78ad65 |
permissions | -rw-r--r-- |
2574 | 1 |
/* |
5547
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
2575
diff
changeset
|
2 |
* Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved. |
2574 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
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. |
|
8 |
* |
|
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 |
* |
|
5547
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
2575
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
2575
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
2575
diff
changeset
|
21 |
* questions. |
2574 | 22 |
*/ |
23 |
||
24 |
/** |
|
25 |
* @test |
|
26 |
* @bug 6589834 |
|
2575
518dc8f6575a
6833951: Extra ":" Causes Testcase in CR 6589834 "Parse Exception: Invalid tag: summary:"
cfang
parents:
2574
diff
changeset
|
27 |
* @summary deoptimization problem with -XX:+DeoptimizeALot |
2574 | 28 |
* |
15864
2757a5eae916
7115383: TEST_BUG: some jtreg tests fail because they explicitly specify -server option
collins
parents:
5547
diff
changeset
|
29 |
* @run main Test_ia32 |
2574 | 30 |
*/ |
31 |
||
32 |
/*************************************************************************************** |
|
33 |
NOTE: The bug shows up (with several "Bug!" message) even without the |
|
34 |
flag -XX:+DeoptimizeALot. In a debug build, you may want to try |
|
35 |
the flags -XX:+VerifyStack and -XX:+DeoptimizeALot to get more information. |
|
36 |
****************************************************************************************/ |
|
37 |
import java.lang.reflect.Constructor; |
|
38 |
||
39 |
public class Test_ia32 { |
|
40 |
||
41 |
public static int NUM_THREADS = 100; |
|
42 |
||
43 |
public static int CLONE_LENGTH = 1000; |
|
44 |
||
45 |
public static void main(String[] args) throws InterruptedException, ClassNotFoundException { |
|
46 |
||
47 |
Reflector[] threads = new Reflector[NUM_THREADS]; |
|
48 |
for (int i = 0; i < threads.length; i++) { |
|
49 |
threads[i] = new Reflector(); |
|
50 |
threads[i].start(); |
|
51 |
} |
|
52 |
||
53 |
System.out.println("Give Reflector.run() some time to compile..."); |
|
54 |
Thread.sleep(5000); |
|
55 |
||
56 |
System.out.println("Load RMISecurityException causing run() deoptimization"); |
|
57 |
ClassLoader.getSystemClassLoader().loadClass("java.rmi.RMISecurityException"); |
|
58 |
||
59 |
for (Reflector thread : threads) |
|
60 |
thread.requestStop(); |
|
61 |
||
62 |
for (Reflector thread : threads) |
|
63 |
try { |
|
64 |
thread.join(); |
|
65 |
} catch (InterruptedException e) { |
|
66 |
System.out.println(e); |
|
67 |
} |
|
68 |
||
69 |
} |
|
70 |
||
71 |
} |
|
72 |
||
73 |
class Reflector extends Thread { |
|
74 |
||
75 |
volatile boolean _doSpin = true; |
|
76 |
||
77 |
Test_ia32[] _tests; |
|
78 |
||
79 |
Reflector() { |
|
80 |
_tests = new Test_ia32[Test_ia32.CLONE_LENGTH]; |
|
81 |
for (int i = 0; i < _tests.length; i++) { |
|
82 |
_tests[i] = new Test_ia32(); |
|
83 |
} |
|
84 |
} |
|
85 |
||
86 |
static int g(int i1, int i2, Test_ia32[] arr, int i3, int i4) { |
|
87 |
||
88 |
if (!(i1==1 && i2==2 && i3==3 && i4==4)) { |
|
89 |
System.out.println("Bug!"); |
|
90 |
} |
|
91 |
||
92 |
return arr.length; |
|
93 |
} |
|
94 |
||
95 |
static int f(Test_ia32[] arr) { |
|
96 |
return g(1, 2, arr.clone(), 3, 4); |
|
97 |
} |
|
98 |
||
99 |
@Override |
|
100 |
public void run() { |
|
101 |
Constructor[] ctrs = null; |
|
102 |
Class<Test_ia32> klass = Test_ia32.class; |
|
103 |
try { |
|
104 |
ctrs = klass.getConstructors(); |
|
105 |
} catch (SecurityException e) { |
|
106 |
System.out.println(e); |
|
107 |
} |
|
108 |
||
109 |
try { |
|
110 |
while (_doSpin) { |
|
111 |
if (f(_tests) < 0) |
|
112 |
System.out.println("return value usage"); |
|
113 |
} |
|
114 |
} catch (NullPointerException e) { |
|
115 |
e.printStackTrace(); |
|
116 |
} |
|
117 |
||
118 |
System.out.println(this + " - stopped."); |
|
119 |
} |
|
120 |
||
121 |
public void requestStop() { |
|
122 |
System.out.println(this + " - stop requested."); |
|
123 |
_doSpin = false; |
|
124 |
} |
|
125 |
||
126 |
} |