Mercurial > hg > graal-jvmci-8
annotate test/runtime/RedefineTests/RedefineRunningMethodsWithResolutionErrors.java @ 23916:6257eccb1b98
Added tag jdk8u91-b15 for changeset e1ea97ad19af
author | asaha |
---|---|
date | Fri, 20 May 2016 11:26:05 -0700 |
parents | 4b32ab003945 |
children |
rev | line source |
---|---|
23175
b3217f8fd2a1
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
1 /* |
b3217f8fd2a1
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
2 * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. |
b3217f8fd2a1
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. |
b3217f8fd2a1
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
4 * |
b3217f8fd2a1
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 |
b3217f8fd2a1
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 |
b3217f8fd2a1
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
b3217f8fd2a1
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
8 * |
b3217f8fd2a1
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 |
b3217f8fd2a1
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 |
b3217f8fd2a1
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 |
b3217f8fd2a1
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 |
b3217f8fd2a1
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
13 * accompanied this code). |
b3217f8fd2a1
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
14 * |
b3217f8fd2a1
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 |
b3217f8fd2a1
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, |
b3217f8fd2a1
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. |
b3217f8fd2a1
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
18 * |
b3217f8fd2a1
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 |
b3217f8fd2a1
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 |
b3217f8fd2a1
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
21 * questions. |
b3217f8fd2a1
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
22 */ |
b3217f8fd2a1
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
23 |
b3217f8fd2a1
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
24 /* |
b3217f8fd2a1
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
25 * @test |
b3217f8fd2a1
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
26 * @bug 8076110 |
b3217f8fd2a1
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
27 * @summary Redefine running methods that have cached resolution errors |
b3217f8fd2a1
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
28 * @library /testlibrary |
b3217f8fd2a1
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
29 * @modules java.instrument |
b3217f8fd2a1
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
30 * java.base/jdk.internal.org.objectweb.asm |
b3217f8fd2a1
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
31 * @build RedefineClassHelper |
b3217f8fd2a1
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
32 * @run main RedefineClassHelper |
23185
4b32ab003945
8131333: [TESTBUG] RedefineRunningMethodsWithResolutionErrors.java Improperly specified VM option 'TraceRedefineClasses=0x600'
aeriksso
parents:
23175
diff
changeset
|
33 * @run main/othervm -javaagent:redefineagent.jar RedefineRunningMethodsWithResolutionErrors |
23175
b3217f8fd2a1
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
34 */ |
b3217f8fd2a1
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
35 |
b3217f8fd2a1
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
36 import jdk.internal.org.objectweb.asm.ClassWriter; |
b3217f8fd2a1
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
37 import jdk.internal.org.objectweb.asm.Label; |
b3217f8fd2a1
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
38 import jdk.internal.org.objectweb.asm.MethodVisitor; |
b3217f8fd2a1
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
39 import jdk.internal.org.objectweb.asm.Opcodes; |
b3217f8fd2a1
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
40 |
b3217f8fd2a1
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
41 import java.lang.reflect.InvocationTargetException; |
b3217f8fd2a1
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
42 |
b3217f8fd2a1
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
43 public class RedefineRunningMethodsWithResolutionErrors extends ClassLoader implements Opcodes { |
b3217f8fd2a1
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
44 |
b3217f8fd2a1
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
45 @Override |
b3217f8fd2a1
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
46 protected Class<?> findClass(String name) throws ClassNotFoundException { |
b3217f8fd2a1
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
47 if (name.equals("C")) { |
b3217f8fd2a1
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
48 byte[] b = loadC(false); |
b3217f8fd2a1
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
49 return defineClass(name, b, 0, b.length); |
b3217f8fd2a1
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
50 } else { |
b3217f8fd2a1
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
51 return super.findClass(name); |
b3217f8fd2a1
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
52 } |
b3217f8fd2a1
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
53 } |
b3217f8fd2a1
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
54 |
b3217f8fd2a1
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
55 private static byte[] loadC(boolean redefine) { |
b3217f8fd2a1
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
56 ClassWriter cw = new ClassWriter(0); |
b3217f8fd2a1
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
57 |
b3217f8fd2a1
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
58 cw.visit(52, ACC_SUPER | ACC_PUBLIC, "C", null, "java/lang/Object", null); |
b3217f8fd2a1
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
59 { |
b3217f8fd2a1
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
60 MethodVisitor mv; |
b3217f8fd2a1
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
61 |
b3217f8fd2a1
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
62 mv = cw.visitMethod(ACC_PUBLIC | ACC_STATIC, "m", "()V", null, null); |
b3217f8fd2a1
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
63 mv.visitCode(); |
b3217f8fd2a1
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
64 |
b3217f8fd2a1
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
65 // First time we run we will: |
b3217f8fd2a1
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
66 // 1) Cache resolution errors |
b3217f8fd2a1
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
67 // 2) Redefine the class / method |
b3217f8fd2a1
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
68 // 3) Try to read the resolution errors that were cached |
b3217f8fd2a1
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
69 // |
b3217f8fd2a1
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
70 // The redefined method will never run, throw error to be sure |
b3217f8fd2a1
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
71 if (redefine) { |
b3217f8fd2a1
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
72 createThrowRuntimeExceptionCode(mv, "The redefined method was called"); |
b3217f8fd2a1
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
73 } else { |
b3217f8fd2a1
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
74 createMethodBody(mv); |
b3217f8fd2a1
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
75 } |
b3217f8fd2a1
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
76 mv.visitMaxs(3, 0); |
b3217f8fd2a1
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
77 mv.visitEnd(); |
b3217f8fd2a1
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
78 } |
b3217f8fd2a1
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
79 cw.visitEnd(); |
b3217f8fd2a1
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
80 return cw.toByteArray(); |
b3217f8fd2a1
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
81 } |
b3217f8fd2a1
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
82 |
b3217f8fd2a1
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
83 private static void createMethodBody(MethodVisitor mv) { |
b3217f8fd2a1
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
84 Label classExists = new Label(); |
b3217f8fd2a1
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
85 |
b3217f8fd2a1
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
86 // Cache resolution errors |
b3217f8fd2a1
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
87 createLoadNonExistentClassCode(mv, classExists); |
b3217f8fd2a1
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
88 |
b3217f8fd2a1
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
89 // Redefine our own class and method |
b3217f8fd2a1
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
90 mv.visitMethodInsn(INVOKESTATIC, "RedefineRunningMethodsWithResolutionErrors", "redefine", "()V"); |
b3217f8fd2a1
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
91 |
b3217f8fd2a1
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
92 // Provoke the same error again to make sure the resolution error cache works |
b3217f8fd2a1
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
93 createLoadNonExistentClassCode(mv, classExists); |
b3217f8fd2a1
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
94 |
b3217f8fd2a1
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
95 // Test passed |
b3217f8fd2a1
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
96 mv.visitInsn(RETURN); |
b3217f8fd2a1
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
97 |
b3217f8fd2a1
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
98 mv.visitFrame(F_SAME, 0, new Object[0], 0, new Object[0]); |
b3217f8fd2a1
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
99 mv.visitLabel(classExists); |
b3217f8fd2a1
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
100 |
b3217f8fd2a1
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
101 createThrowRuntimeExceptionCode(mv, "Loaded class that shouldn't exist (\"NonExistentClass\")"); |
b3217f8fd2a1
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
102 } |
b3217f8fd2a1
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
103 |
b3217f8fd2a1
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
104 private static void createLoadNonExistentClassCode(MethodVisitor mv, Label classExists) { |
b3217f8fd2a1
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
105 Label tryLoadBegin = new Label(); |
b3217f8fd2a1
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
106 Label tryLoadEnd = new Label(); |
b3217f8fd2a1
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
107 Label catchLoadBlock = new Label(); |
b3217f8fd2a1
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
108 mv.visitTryCatchBlock(tryLoadBegin, tryLoadEnd, catchLoadBlock, "java/lang/NoClassDefFoundError"); |
b3217f8fd2a1
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
109 |
b3217f8fd2a1
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
110 // Try to load a class that does not exist to provoke resolution errors |
b3217f8fd2a1
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
111 mv.visitLabel(tryLoadBegin); |
b3217f8fd2a1
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
112 mv.visitMethodInsn(INVOKESTATIC, "NonExistentClass", "nonExistentMethod", "()V"); |
b3217f8fd2a1
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
113 mv.visitLabel(tryLoadEnd); |
b3217f8fd2a1
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
114 |
b3217f8fd2a1
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
115 // No NoClassDefFoundError means NonExistentClass existed, which shouldn't happen |
b3217f8fd2a1
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
116 mv.visitJumpInsn(GOTO, classExists); |
b3217f8fd2a1
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
117 |
b3217f8fd2a1
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
118 mv.visitFrame(F_SAME1, 0, new Object[0], 1, new Object[] { "java/lang/NoClassDefFoundError" }); |
b3217f8fd2a1
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
119 mv.visitLabel(catchLoadBlock); |
b3217f8fd2a1
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
120 |
b3217f8fd2a1
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
121 // Ignore the expected NoClassDefFoundError |
b3217f8fd2a1
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
122 mv.visitInsn(POP); |
b3217f8fd2a1
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
123 } |
b3217f8fd2a1
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
124 |
b3217f8fd2a1
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
125 private static void createThrowRuntimeExceptionCode(MethodVisitor mv, String msg) { |
b3217f8fd2a1
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
126 mv.visitTypeInsn(NEW, "java/lang/RuntimeException"); |
b3217f8fd2a1
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
127 mv.visitInsn(DUP); |
b3217f8fd2a1
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
128 mv.visitLdcInsn(msg); |
b3217f8fd2a1
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
129 mv.visitMethodInsn(INVOKESPECIAL, "java/lang/RuntimeException", "<init>", "(Ljava/lang/String;)V"); |
b3217f8fd2a1
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
130 mv.visitInsn(ATHROW); |
b3217f8fd2a1
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
131 } |
b3217f8fd2a1
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
132 |
b3217f8fd2a1
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
133 private static Class<?> c; |
b3217f8fd2a1
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
134 |
b3217f8fd2a1
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
135 public static void redefine() throws Exception { |
b3217f8fd2a1
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
136 RedefineClassHelper.redefineClass(c, loadC(true)); |
b3217f8fd2a1
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
137 } |
b3217f8fd2a1
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
138 |
b3217f8fd2a1
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
139 public static void main(String[] args) throws ClassNotFoundException, NoSuchMethodException, IllegalAccessException, InvocationTargetException { |
b3217f8fd2a1
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
140 c = Class.forName("C", true, new RedefineRunningMethodsWithResolutionErrors()); |
b3217f8fd2a1
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
141 c.getMethod("m").invoke(null); |
b3217f8fd2a1
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
142 } |
b3217f8fd2a1
8076110: VM crash when class is redefined with Instrumentation.redefineClasses
aeriksso
parents:
diff
changeset
|
143 } |