author | alanb |
Fri, 07 Apr 2017 08:05:54 +0000 | |
changeset 44545 | 83b611b88ac8 |
parent 38966 | 308f5cc7d5f6 |
permissions | -rw-r--r-- |
29383
971ae566f595
8046246: the constantPoolCacheOopDesc::adjust_method_entries() used in RedefineClasses does not scale
sspitsyn
parents:
diff
changeset
|
1 |
/* |
36237
963d1115678b
8150998: Fix module dependences in java/lang tests
shurailine
parents:
30376
diff
changeset
|
2 |
* Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. |
29383
971ae566f595
8046246: the constantPoolCacheOopDesc::adjust_method_entries() used in RedefineClasses does not scale
sspitsyn
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
971ae566f595
8046246: the constantPoolCacheOopDesc::adjust_method_entries() used in RedefineClasses does not scale
sspitsyn
parents:
diff
changeset
|
4 |
* |
971ae566f595
8046246: the constantPoolCacheOopDesc::adjust_method_entries() used in RedefineClasses does not scale
sspitsyn
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
971ae566f595
8046246: the constantPoolCacheOopDesc::adjust_method_entries() used in RedefineClasses does not scale
sspitsyn
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
971ae566f595
8046246: the constantPoolCacheOopDesc::adjust_method_entries() used in RedefineClasses does not scale
sspitsyn
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
971ae566f595
8046246: the constantPoolCacheOopDesc::adjust_method_entries() used in RedefineClasses does not scale
sspitsyn
parents:
diff
changeset
|
8 |
* |
971ae566f595
8046246: the constantPoolCacheOopDesc::adjust_method_entries() used in RedefineClasses does not scale
sspitsyn
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
971ae566f595
8046246: the constantPoolCacheOopDesc::adjust_method_entries() used in RedefineClasses does not scale
sspitsyn
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
971ae566f595
8046246: the constantPoolCacheOopDesc::adjust_method_entries() used in RedefineClasses does not scale
sspitsyn
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
971ae566f595
8046246: the constantPoolCacheOopDesc::adjust_method_entries() used in RedefineClasses does not scale
sspitsyn
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
971ae566f595
8046246: the constantPoolCacheOopDesc::adjust_method_entries() used in RedefineClasses does not scale
sspitsyn
parents:
diff
changeset
|
13 |
* accompanied this code). |
971ae566f595
8046246: the constantPoolCacheOopDesc::adjust_method_entries() used in RedefineClasses does not scale
sspitsyn
parents:
diff
changeset
|
14 |
* |
971ae566f595
8046246: the constantPoolCacheOopDesc::adjust_method_entries() used in RedefineClasses does not scale
sspitsyn
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
971ae566f595
8046246: the constantPoolCacheOopDesc::adjust_method_entries() used in RedefineClasses does not scale
sspitsyn
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
971ae566f595
8046246: the constantPoolCacheOopDesc::adjust_method_entries() used in RedefineClasses does not scale
sspitsyn
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
971ae566f595
8046246: the constantPoolCacheOopDesc::adjust_method_entries() used in RedefineClasses does not scale
sspitsyn
parents:
diff
changeset
|
18 |
* |
971ae566f595
8046246: the constantPoolCacheOopDesc::adjust_method_entries() used in RedefineClasses does not scale
sspitsyn
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
971ae566f595
8046246: the constantPoolCacheOopDesc::adjust_method_entries() used in RedefineClasses does not scale
sspitsyn
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
971ae566f595
8046246: the constantPoolCacheOopDesc::adjust_method_entries() used in RedefineClasses does not scale
sspitsyn
parents:
diff
changeset
|
21 |
* questions. |
971ae566f595
8046246: the constantPoolCacheOopDesc::adjust_method_entries() used in RedefineClasses does not scale
sspitsyn
parents:
diff
changeset
|
22 |
*/ |
971ae566f595
8046246: the constantPoolCacheOopDesc::adjust_method_entries() used in RedefineClasses does not scale
sspitsyn
parents:
diff
changeset
|
23 |
|
971ae566f595
8046246: the constantPoolCacheOopDesc::adjust_method_entries() used in RedefineClasses does not scale
sspitsyn
parents:
diff
changeset
|
24 |
/** |
971ae566f595
8046246: the constantPoolCacheOopDesc::adjust_method_entries() used in RedefineClasses does not scale
sspitsyn
parents:
diff
changeset
|
25 |
* @test |
971ae566f595
8046246: the constantPoolCacheOopDesc::adjust_method_entries() used in RedefineClasses does not scale
sspitsyn
parents:
diff
changeset
|
26 |
* @bug 8046246 |
971ae566f595
8046246: the constantPoolCacheOopDesc::adjust_method_entries() used in RedefineClasses does not scale
sspitsyn
parents:
diff
changeset
|
27 |
* @summary Tests and benchmarks the JVMTI RedefineClasses when a |
971ae566f595
8046246: the constantPoolCacheOopDesc::adjust_method_entries() used in RedefineClasses does not scale
sspitsyn
parents:
diff
changeset
|
28 |
* single class (and its parent) contains many methods. |
971ae566f595
8046246: the constantPoolCacheOopDesc::adjust_method_entries() used in RedefineClasses does not scale
sspitsyn
parents:
diff
changeset
|
29 |
* |
36237
963d1115678b
8150998: Fix module dependences in java/lang tests
shurailine
parents:
30376
diff
changeset
|
30 |
* @modules jdk.compiler |
30376
2ccf2cf7ea48
8078896: Add @modules as needed to the jdk_svc tests
ykantser
parents:
29383
diff
changeset
|
31 |
* java.instrument |
38966
308f5cc7d5f6
8158855: Fix remaining module dependences in java/lang
shurailine
parents:
36237
diff
changeset
|
32 |
* jdk.zipfs |
29383
971ae566f595
8046246: the constantPoolCacheOopDesc::adjust_method_entries() used in RedefineClasses does not scale
sspitsyn
parents:
diff
changeset
|
33 |
* @run build ManyMethodsBenchmarkApp ManyMethodsBenchmarkAgent |
971ae566f595
8046246: the constantPoolCacheOopDesc::adjust_method_entries() used in RedefineClasses does not scale
sspitsyn
parents:
diff
changeset
|
34 |
* @run shell MakeJAR3.sh ManyMethodsBenchmarkAgent 'Can-Retransform-Classes: true' |
971ae566f595
8046246: the constantPoolCacheOopDesc::adjust_method_entries() used in RedefineClasses does not scale
sspitsyn
parents:
diff
changeset
|
35 |
* @run main/othervm -javaagent:ManyMethodsBenchmarkAgent.jar ManyMethodsBenchmarkApp |
971ae566f595
8046246: the constantPoolCacheOopDesc::adjust_method_entries() used in RedefineClasses does not scale
sspitsyn
parents:
diff
changeset
|
36 |
*/ |
971ae566f595
8046246: the constantPoolCacheOopDesc::adjust_method_entries() used in RedefineClasses does not scale
sspitsyn
parents:
diff
changeset
|
37 |
import java.lang.instrument.*; |
971ae566f595
8046246: the constantPoolCacheOopDesc::adjust_method_entries() used in RedefineClasses does not scale
sspitsyn
parents:
diff
changeset
|
38 |
|
971ae566f595
8046246: the constantPoolCacheOopDesc::adjust_method_entries() used in RedefineClasses does not scale
sspitsyn
parents:
diff
changeset
|
39 |
public class ManyMethodsBenchmarkAgent |
971ae566f595
8046246: the constantPoolCacheOopDesc::adjust_method_entries() used in RedefineClasses does not scale
sspitsyn
parents:
diff
changeset
|
40 |
{ |
971ae566f595
8046246: the constantPoolCacheOopDesc::adjust_method_entries() used in RedefineClasses does not scale
sspitsyn
parents:
diff
changeset
|
41 |
public static boolean fail = false; |
971ae566f595
8046246: the constantPoolCacheOopDesc::adjust_method_entries() used in RedefineClasses does not scale
sspitsyn
parents:
diff
changeset
|
42 |
public static boolean completed = false; |
971ae566f595
8046246: the constantPoolCacheOopDesc::adjust_method_entries() used in RedefineClasses does not scale
sspitsyn
parents:
diff
changeset
|
43 |
private static Instrumentation instrumentation; |
971ae566f595
8046246: the constantPoolCacheOopDesc::adjust_method_entries() used in RedefineClasses does not scale
sspitsyn
parents:
diff
changeset
|
44 |
|
971ae566f595
8046246: the constantPoolCacheOopDesc::adjust_method_entries() used in RedefineClasses does not scale
sspitsyn
parents:
diff
changeset
|
45 |
public static void |
971ae566f595
8046246: the constantPoolCacheOopDesc::adjust_method_entries() used in RedefineClasses does not scale
sspitsyn
parents:
diff
changeset
|
46 |
premain( String agentArgs, |
971ae566f595
8046246: the constantPoolCacheOopDesc::adjust_method_entries() used in RedefineClasses does not scale
sspitsyn
parents:
diff
changeset
|
47 |
Instrumentation instrumentation) { |
971ae566f595
8046246: the constantPoolCacheOopDesc::adjust_method_entries() used in RedefineClasses does not scale
sspitsyn
parents:
diff
changeset
|
48 |
System.out.println("ManyMethodsBenchmarkAgent started"); |
971ae566f595
8046246: the constantPoolCacheOopDesc::adjust_method_entries() used in RedefineClasses does not scale
sspitsyn
parents:
diff
changeset
|
49 |
ManyMethodsBenchmarkAgent.instrumentation = instrumentation; |
971ae566f595
8046246: the constantPoolCacheOopDesc::adjust_method_entries() used in RedefineClasses does not scale
sspitsyn
parents:
diff
changeset
|
50 |
System.out.println("ManyMethodsBenchmarkAgent finished"); |
971ae566f595
8046246: the constantPoolCacheOopDesc::adjust_method_entries() used in RedefineClasses does not scale
sspitsyn
parents:
diff
changeset
|
51 |
} |
971ae566f595
8046246: the constantPoolCacheOopDesc::adjust_method_entries() used in RedefineClasses does not scale
sspitsyn
parents:
diff
changeset
|
52 |
|
971ae566f595
8046246: the constantPoolCacheOopDesc::adjust_method_entries() used in RedefineClasses does not scale
sspitsyn
parents:
diff
changeset
|
53 |
static void instr() { |
971ae566f595
8046246: the constantPoolCacheOopDesc::adjust_method_entries() used in RedefineClasses does not scale
sspitsyn
parents:
diff
changeset
|
54 |
System.out.println("ManyMethodsBenchmarkAgent.instr started"); |
971ae566f595
8046246: the constantPoolCacheOopDesc::adjust_method_entries() used in RedefineClasses does not scale
sspitsyn
parents:
diff
changeset
|
55 |
|
971ae566f595
8046246: the constantPoolCacheOopDesc::adjust_method_entries() used in RedefineClasses does not scale
sspitsyn
parents:
diff
changeset
|
56 |
Class[] allClasses = instrumentation.getAllLoadedClasses(); |
971ae566f595
8046246: the constantPoolCacheOopDesc::adjust_method_entries() used in RedefineClasses does not scale
sspitsyn
parents:
diff
changeset
|
57 |
|
971ae566f595
8046246: the constantPoolCacheOopDesc::adjust_method_entries() used in RedefineClasses does not scale
sspitsyn
parents:
diff
changeset
|
58 |
for (int i = 0; i < allClasses.length; i++) { |
971ae566f595
8046246: the constantPoolCacheOopDesc::adjust_method_entries() used in RedefineClasses does not scale
sspitsyn
parents:
diff
changeset
|
59 |
Class klass = allClasses[i]; |
971ae566f595
8046246: the constantPoolCacheOopDesc::adjust_method_entries() used in RedefineClasses does not scale
sspitsyn
parents:
diff
changeset
|
60 |
String name = klass.getName(); |
971ae566f595
8046246: the constantPoolCacheOopDesc::adjust_method_entries() used in RedefineClasses does not scale
sspitsyn
parents:
diff
changeset
|
61 |
if (!name.equals("Base")) { |
971ae566f595
8046246: the constantPoolCacheOopDesc::adjust_method_entries() used in RedefineClasses does not scale
sspitsyn
parents:
diff
changeset
|
62 |
continue; |
971ae566f595
8046246: the constantPoolCacheOopDesc::adjust_method_entries() used in RedefineClasses does not scale
sspitsyn
parents:
diff
changeset
|
63 |
} |
971ae566f595
8046246: the constantPoolCacheOopDesc::adjust_method_entries() used in RedefineClasses does not scale
sspitsyn
parents:
diff
changeset
|
64 |
System.err.println("Instrumenting the class: " + klass); |
971ae566f595
8046246: the constantPoolCacheOopDesc::adjust_method_entries() used in RedefineClasses does not scale
sspitsyn
parents:
diff
changeset
|
65 |
|
971ae566f595
8046246: the constantPoolCacheOopDesc::adjust_method_entries() used in RedefineClasses does not scale
sspitsyn
parents:
diff
changeset
|
66 |
try { |
971ae566f595
8046246: the constantPoolCacheOopDesc::adjust_method_entries() used in RedefineClasses does not scale
sspitsyn
parents:
diff
changeset
|
67 |
instrumentation.retransformClasses(klass); |
971ae566f595
8046246: the constantPoolCacheOopDesc::adjust_method_entries() used in RedefineClasses does not scale
sspitsyn
parents:
diff
changeset
|
68 |
} catch (Throwable e) { |
971ae566f595
8046246: the constantPoolCacheOopDesc::adjust_method_entries() used in RedefineClasses does not scale
sspitsyn
parents:
diff
changeset
|
69 |
System.err.println("Error: bad return from retransform: " + klass); |
971ae566f595
8046246: the constantPoolCacheOopDesc::adjust_method_entries() used in RedefineClasses does not scale
sspitsyn
parents:
diff
changeset
|
70 |
System.err.println(" ERROR: " + e); |
971ae566f595
8046246: the constantPoolCacheOopDesc::adjust_method_entries() used in RedefineClasses does not scale
sspitsyn
parents:
diff
changeset
|
71 |
fail = true; |
971ae566f595
8046246: the constantPoolCacheOopDesc::adjust_method_entries() used in RedefineClasses does not scale
sspitsyn
parents:
diff
changeset
|
72 |
} |
971ae566f595
8046246: the constantPoolCacheOopDesc::adjust_method_entries() used in RedefineClasses does not scale
sspitsyn
parents:
diff
changeset
|
73 |
} |
971ae566f595
8046246: the constantPoolCacheOopDesc::adjust_method_entries() used in RedefineClasses does not scale
sspitsyn
parents:
diff
changeset
|
74 |
completed = true; |
971ae566f595
8046246: the constantPoolCacheOopDesc::adjust_method_entries() used in RedefineClasses does not scale
sspitsyn
parents:
diff
changeset
|
75 |
System.out.println("ManyMethodsBenchmarkAgent.instr finished"); |
971ae566f595
8046246: the constantPoolCacheOopDesc::adjust_method_entries() used in RedefineClasses does not scale
sspitsyn
parents:
diff
changeset
|
76 |
} |
971ae566f595
8046246: the constantPoolCacheOopDesc::adjust_method_entries() used in RedefineClasses does not scale
sspitsyn
parents:
diff
changeset
|
77 |
|
971ae566f595
8046246: the constantPoolCacheOopDesc::adjust_method_entries() used in RedefineClasses does not scale
sspitsyn
parents:
diff
changeset
|
78 |
} |