author | dsamersoff |
Sun, 01 May 2016 12:47:00 +0300 | |
changeset 38152 | 80e5da81fb2c |
parent 36209 | 8db2a78cbc29 |
child 40631 | ed82623d7831 |
permissions | -rw-r--r-- |
31353
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
1 |
/* |
36209
8db2a78cbc29
8151156: [TESTBUG] Integrate trivial Hotspot test changes from Jake before Jigsaw M3
ctornqvi
parents:
31353
diff
changeset
|
2 |
* Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved. |
31353
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
4 |
* |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
8 |
* |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
13 |
* accompanied this code). |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
14 |
* |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
18 |
* |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
21 |
* questions. |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
22 |
*/ |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
23 |
|
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
24 |
/* |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
25 |
* @test |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
26 |
* @bug 8076110 |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
27 |
* @summary Redefine running methods that have cached resolution errors |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
28 |
* @library /testlibrary |
38152
80e5da81fb2c
8154258: [TESTBUG] Various serviceability tests fail compilation
dsamersoff
parents:
36209
diff
changeset
|
29 |
* @modules java.base/jdk.internal.misc |
36209
8db2a78cbc29
8151156: [TESTBUG] Integrate trivial Hotspot test changes from Jake before Jigsaw M3
ctornqvi
parents:
31353
diff
changeset
|
30 |
* @modules java.base/jdk.internal.org.objectweb.asm |
8db2a78cbc29
8151156: [TESTBUG] Integrate trivial Hotspot test changes from Jake before Jigsaw M3
ctornqvi
parents:
31353
diff
changeset
|
31 |
* java.instrument |
8db2a78cbc29
8151156: [TESTBUG] Integrate trivial Hotspot test changes from Jake before Jigsaw M3
ctornqvi
parents:
31353
diff
changeset
|
32 |
* jdk.jartool/sun.tools.jar |
31353
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
33 |
* @build RedefineClassHelper |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
34 |
* @run main RedefineClassHelper |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
35 |
* @run main/othervm -javaagent:redefineagent.jar -XX:TraceRedefineClasses=0x600 RedefineRunningMethodsWithResolutionErrors |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
36 |
*/ |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
37 |
|
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
38 |
import jdk.internal.org.objectweb.asm.ClassWriter; |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
39 |
import jdk.internal.org.objectweb.asm.Label; |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
40 |
import jdk.internal.org.objectweb.asm.MethodVisitor; |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
41 |
import jdk.internal.org.objectweb.asm.Opcodes; |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
42 |
|
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
43 |
import java.lang.reflect.InvocationTargetException; |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
44 |
|
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
45 |
public class RedefineRunningMethodsWithResolutionErrors extends ClassLoader implements Opcodes { |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
46 |
|
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
47 |
@Override |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
48 |
protected Class<?> findClass(String name) throws ClassNotFoundException { |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
49 |
if (name.equals("C")) { |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
50 |
byte[] b = loadC(false); |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
51 |
return defineClass(name, b, 0, b.length); |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
52 |
} else { |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
53 |
return super.findClass(name); |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
54 |
} |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
55 |
} |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
56 |
|
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
57 |
private static byte[] loadC(boolean redefine) { |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
58 |
ClassWriter cw = new ClassWriter(0); |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
59 |
|
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
60 |
cw.visit(52, ACC_SUPER | ACC_PUBLIC, "C", null, "java/lang/Object", null); |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
61 |
{ |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
62 |
MethodVisitor mv; |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
63 |
|
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
64 |
mv = cw.visitMethod(ACC_PUBLIC | ACC_STATIC, "m", "()V", null, null); |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
65 |
mv.visitCode(); |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
66 |
|
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
67 |
// First time we run we will: |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
68 |
// 1) Cache resolution errors |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
69 |
// 2) Redefine the class / method |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
70 |
// 3) Try to read the resolution errors that were cached |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
71 |
// |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
72 |
// The redefined method will never run, throw error to be sure |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
73 |
if (redefine) { |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
74 |
createThrowRuntimeExceptionCode(mv, "The redefined method was called"); |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
75 |
} else { |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
76 |
createMethodBody(mv); |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
77 |
} |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
78 |
mv.visitMaxs(3, 0); |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
79 |
mv.visitEnd(); |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
80 |
} |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
81 |
cw.visitEnd(); |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
82 |
return cw.toByteArray(); |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
83 |
} |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
84 |
|
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
85 |
private static void createMethodBody(MethodVisitor mv) { |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
86 |
Label classExists = new Label(); |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
87 |
|
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
88 |
// Cache resolution errors |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
89 |
createLoadNonExistentClassCode(mv, classExists); |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
90 |
|
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
91 |
// Redefine our own class and method |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
92 |
mv.visitMethodInsn(INVOKESTATIC, "RedefineRunningMethodsWithResolutionErrors", "redefine", "()V"); |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
93 |
|
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
94 |
// Provoke the same error again to make sure the resolution error cache works |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
95 |
createLoadNonExistentClassCode(mv, classExists); |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
96 |
|
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
97 |
// Test passed |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
98 |
mv.visitInsn(RETURN); |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
99 |
|
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
100 |
mv.visitFrame(F_SAME, 0, new Object[0], 0, new Object[0]); |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
101 |
mv.visitLabel(classExists); |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
102 |
|
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
103 |
createThrowRuntimeExceptionCode(mv, "Loaded class that shouldn't exist (\"NonExistentClass\")"); |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
104 |
} |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
105 |
|
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
106 |
private static void createLoadNonExistentClassCode(MethodVisitor mv, Label classExists) { |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
107 |
Label tryLoadBegin = new Label(); |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
108 |
Label tryLoadEnd = new Label(); |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
109 |
Label catchLoadBlock = new Label(); |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
110 |
mv.visitTryCatchBlock(tryLoadBegin, tryLoadEnd, catchLoadBlock, "java/lang/NoClassDefFoundError"); |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
111 |
|
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
112 |
// Try to load a class that does not exist to provoke resolution errors |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
113 |
mv.visitLabel(tryLoadBegin); |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
114 |
mv.visitMethodInsn(INVOKESTATIC, "NonExistentClass", "nonExistentMethod", "()V"); |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
115 |
mv.visitLabel(tryLoadEnd); |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
116 |
|
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
117 |
// No NoClassDefFoundError means NonExistentClass existed, which shouldn't happen |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
118 |
mv.visitJumpInsn(GOTO, classExists); |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
119 |
|
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
120 |
mv.visitFrame(F_SAME1, 0, new Object[0], 1, new Object[] { "java/lang/NoClassDefFoundError" }); |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
121 |
mv.visitLabel(catchLoadBlock); |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
122 |
|
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
123 |
// Ignore the expected NoClassDefFoundError |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
124 |
mv.visitInsn(POP); |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
125 |
} |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
126 |
|
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
127 |
private static void createThrowRuntimeExceptionCode(MethodVisitor mv, String msg) { |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
128 |
mv.visitTypeInsn(NEW, "java/lang/RuntimeException"); |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
129 |
mv.visitInsn(DUP); |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
130 |
mv.visitLdcInsn(msg); |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
131 |
mv.visitMethodInsn(INVOKESPECIAL, "java/lang/RuntimeException", "<init>", "(Ljava/lang/String;)V"); |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
132 |
mv.visitInsn(ATHROW); |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
133 |
} |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
134 |
|
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
135 |
private static Class<?> c; |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
136 |
|
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
137 |
public static void redefine() throws Exception { |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
138 |
RedefineClassHelper.redefineClass(c, loadC(true)); |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
139 |
} |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
140 |
|
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
141 |
public static void main(String[] args) throws ClassNotFoundException, NoSuchMethodException, IllegalAccessException, InvocationTargetException { |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
142 |
c = Class.forName("C", true, new RedefineRunningMethodsWithResolutionErrors()); |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
143 |
c.getMethod("m").invoke(null); |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
144 |
} |
cd33628db166
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
145 |
} |