author | jprovino |
Wed, 11 Nov 2015 23:47:42 +0000 | |
changeset 33911 | af2cff5bd523 |
parent 31985 | f63ab3cbd931 |
child 38152 | 80e5da81fb2c |
permissions | -rw-r--r-- |
31985
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
1 |
/* |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
2 |
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
4 |
* |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
8 |
* |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
13 |
* accompanied this code). |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
14 |
* |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
18 |
* |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
21 |
* questions. |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
22 |
*/ |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
23 |
|
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
24 |
/* |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
25 |
* @test |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
26 |
* @bug 8087315 |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
27 |
* @summary Get old method's stack trace elements after GC |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
28 |
* @library /testlibrary |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
29 |
* @modules java.compiler |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
30 |
* java.instrument |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
31 |
* jdk.jartool/sun.tools.jar |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
32 |
* @build RedefineClassHelper |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
33 |
* @run main RedefineClassHelper |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
34 |
* @run main/othervm -javaagent:redefineagent.jar RedefineRunningMethodsWithBacktrace |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
35 |
*/ |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
36 |
|
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
37 |
import static jdk.test.lib.Asserts.*; |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
38 |
|
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
39 |
public class RedefineRunningMethodsWithBacktrace { |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
40 |
|
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
41 |
public static String newB = |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
42 |
"class RedefineRunningMethodsWithBacktrace$B {" + |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
43 |
" static int count1 = 0;" + |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
44 |
" static int count2 = 0;" + |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
45 |
" public static volatile boolean stop = false;" + |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
46 |
" static void localSleep() { " + |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
47 |
" try{ " + |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
48 |
" Thread.currentThread().sleep(10);" + |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
49 |
" } catch(InterruptedException ie) { " + |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
50 |
" } " + |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
51 |
" } " + |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
52 |
" public static void infinite() { " + |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
53 |
" System.out.println(\"infinite called\");" + |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
54 |
" }" + |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
55 |
" public static void throwable() { " + |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
56 |
" throw new RuntimeException(\"throwable called\");" + |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
57 |
" }" + |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
58 |
"}"; |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
59 |
|
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
60 |
public static String evenNewerB = |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
61 |
"class RedefineRunningMethodsWithBacktrace$B {" + |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
62 |
" static int count1 = 0;" + |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
63 |
" static int count2 = 0;" + |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
64 |
" public static volatile boolean stop = false;" + |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
65 |
" static void localSleep() { " + |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
66 |
" try{ " + |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
67 |
" Thread.currentThread().sleep(1);" + |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
68 |
" } catch(InterruptedException ie) { " + |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
69 |
" } " + |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
70 |
" } " + |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
71 |
" public static void infinite() { }" + |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
72 |
" public static void throwable() { " + |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
73 |
" throw new RuntimeException(\"throwable called\");" + |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
74 |
" }" + |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
75 |
"}"; |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
76 |
|
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
77 |
static class B { |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
78 |
static int count1 = 0; |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
79 |
static int count2 = 0; |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
80 |
public static volatile boolean stop = false; |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
81 |
static void localSleep() { |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
82 |
try { |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
83 |
Thread.currentThread().sleep(10);//sleep for 10 ms |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
84 |
} catch(InterruptedException ie) { |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
85 |
} |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
86 |
} |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
87 |
|
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
88 |
public static void infinite() { |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
89 |
while (!stop) { count1++; localSleep(); } |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
90 |
} |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
91 |
public static void throwable() { |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
92 |
// add some stuff to the original constant pool |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
93 |
String s1 = new String ("string1"); |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
94 |
String s2 = new String ("string2"); |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
95 |
String s3 = new String ("string3"); |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
96 |
String s4 = new String ("string4"); |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
97 |
String s5 = new String ("string5"); |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
98 |
String s6 = new String ("string6"); |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
99 |
String s7 = new String ("string7"); |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
100 |
String s8 = new String ("string8"); |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
101 |
String s9 = new String ("string9"); |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
102 |
String s10 = new String ("string10"); |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
103 |
String s11 = new String ("string11"); |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
104 |
String s12 = new String ("string12"); |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
105 |
String s13 = new String ("string13"); |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
106 |
String s14 = new String ("string14"); |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
107 |
String s15 = new String ("string15"); |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
108 |
String s16 = new String ("string16"); |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
109 |
String s17 = new String ("string17"); |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
110 |
String s18 = new String ("string18"); |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
111 |
String s19 = new String ("string19"); |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
112 |
throw new RuntimeException("throwable called"); |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
113 |
} |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
114 |
} |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
115 |
|
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
116 |
private static void touchRedefinedMethodInBacktrace(Throwable throwable) { |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
117 |
System.out.println("touchRedefinedMethodInBacktrace: "); |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
118 |
throwable.printStackTrace(); // this actually crashes with the bug in |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
119 |
// java_lang_StackTraceElement::create() |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
120 |
|
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
121 |
// Make sure that we can convert the backtrace, which is referring to |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
122 |
// the redefined method, to a StrackTraceElement[] without crashing. |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
123 |
StackTraceElement[] stackTrace = throwable.getStackTrace(); |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
124 |
for (int i = 0; i < stackTrace.length; i++) { |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
125 |
StackTraceElement frame = stackTrace[i]; |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
126 |
assertNotNull(frame.getClassName(), |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
127 |
"\nTest failed: trace[" + i + "].getClassName() returned null"); |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
128 |
assertNotNull(frame.getMethodName(), |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
129 |
"\nTest failed: trace[" + i + "].getMethodName() returned null"); |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
130 |
} |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
131 |
} |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
132 |
|
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
133 |
private static Throwable getThrowableInB() { |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
134 |
Throwable t = null; |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
135 |
try { |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
136 |
B.throwable(); |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
137 |
} catch (Exception e) { |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
138 |
t = e; |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
139 |
// Don't print here because Throwable will cache the constructed stacktrace |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
140 |
// e.printStackTrace(); |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
141 |
} |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
142 |
return t; |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
143 |
} |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
144 |
|
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
145 |
|
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
146 |
public static void main(String[] args) throws Exception { |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
147 |
|
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
148 |
new Thread() { |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
149 |
public void run() { |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
150 |
B.infinite(); |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
151 |
} |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
152 |
}.start(); |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
153 |
|
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
154 |
Throwable t1 = getThrowableInB(); |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
155 |
|
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
156 |
RedefineClassHelper.redefineClass(B.class, newB); |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
157 |
|
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
158 |
System.gc(); |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
159 |
|
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
160 |
Throwable t2 = getThrowableInB(); |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
161 |
|
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
162 |
B.infinite(); |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
163 |
|
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
164 |
for (int i = 0; i < 20 ; i++) { |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
165 |
String s = new String("some garbage"); |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
166 |
System.gc(); |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
167 |
} |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
168 |
|
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
169 |
RedefineClassHelper.redefineClass(B.class, evenNewerB); |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
170 |
System.gc(); |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
171 |
|
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
172 |
Throwable t3 = getThrowableInB(); |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
173 |
|
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
174 |
for (int i = 0; i < 20 ; i++) { |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
175 |
B.infinite(); |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
176 |
String s = new String("some garbage"); |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
177 |
System.gc(); |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
178 |
} |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
179 |
|
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
180 |
touchRedefinedMethodInBacktrace(t1); |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
181 |
touchRedefinedMethodInBacktrace(t2); |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
182 |
touchRedefinedMethodInBacktrace(t3); |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
183 |
|
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
184 |
// purge should clean everything up. |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
185 |
B.stop = true; |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
186 |
|
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
187 |
for (int i = 0; i < 20 ; i++) { |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
188 |
B.infinite(); |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
189 |
String s = new String("some garbage"); |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
190 |
System.gc(); |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
191 |
} |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
192 |
} |
f63ab3cbd931
8087315: SIGBUS error in nsk/jvmti/RedefineClasses/StressRedefine
coleenp
parents:
diff
changeset
|
193 |
} |