mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-20 02:54:35 +02:00
Merge
This commit is contained in:
commit
69e076a5bb
2 changed files with 40 additions and 22 deletions
|
@ -23,6 +23,7 @@
|
||||||
|
|
||||||
import sun.jvm.hotspot.HotSpotAgent;
|
import sun.jvm.hotspot.HotSpotAgent;
|
||||||
import sun.jvm.hotspot.utilities.SystemDictionaryHelper;
|
import sun.jvm.hotspot.utilities.SystemDictionaryHelper;
|
||||||
|
import sun.jvm.hotspot.oops.InstanceKlass;
|
||||||
import sun.jvm.hotspot.debugger.*;
|
import sun.jvm.hotspot.debugger.*;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -44,15 +45,19 @@ import java.util.*;
|
||||||
* @test
|
* @test
|
||||||
* @library /test/lib
|
* @library /test/lib
|
||||||
* @modules java.base/jdk.internal.misc
|
* @modules java.base/jdk.internal.misc
|
||||||
* @modules jdk.hotspot.agent
|
* @compile -XDignore.symbol.file=true
|
||||||
* @modules jdk.hotspot.agent/sun.jvm.hotspot
|
* --add-exports=jdk.hotspot.agent/sun.jvm.hotspot=ALL-UNNAMED
|
||||||
* @modules jdk.hotspot.agent/sun.jvm.hotspot.utilities
|
* --add-exports=jdk.hotspot.agent/sun.jvm.hotspot.utilities=ALL-UNNAMED
|
||||||
* @modules jdk.hotspot.agent/sun.jvm.hotspot.oops
|
* --add-exports=jdk.hotspot.agent/sun.jvm.hotspot.oops=ALL-UNNAMED
|
||||||
* @compile -XDignore.symbol.file=true -Xmodule:jdk.hotspot.agent
|
* --add-exports=jdk.hotspot.agent/sun.jvm.hotspot.debugger=ALL-UNNAMED
|
||||||
* -XaddExports:java.base/jdk.internal.misc=jdk.hotspot.agent
|
|
||||||
* -XaddExports:java.management/java.lang.management=jdk.hotspot.agent
|
|
||||||
* TestInstanceKlassSize.java
|
* TestInstanceKlassSize.java
|
||||||
* @run main/othervm TestInstanceKlassSize
|
* @run main/othervm
|
||||||
|
* --add-modules=jdk.hotspot.agent
|
||||||
|
* --add-exports=jdk.hotspot.agent/sun.jvm.hotspot=ALL-UNNAMED
|
||||||
|
* --add-exports=jdk.hotspot.agent/sun.jvm.hotspot.utilities=ALL-UNNAMED
|
||||||
|
* --add-exports=jdk.hotspot.agent/sun.jvm.hotspot.oops=ALL-UNNAMED
|
||||||
|
* --add-exports=jdk.hotspot.agent/sun.jvm.hotspot.debugger=ALL-UNNAMED
|
||||||
|
* TestInstanceKlassSize
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class TestInstanceKlassSize {
|
public class TestInstanceKlassSize {
|
||||||
|
@ -112,11 +117,11 @@ public class TestInstanceKlassSize {
|
||||||
" java.lang.Byte",
|
" java.lang.Byte",
|
||||||
};
|
};
|
||||||
String[] toolArgs = {
|
String[] toolArgs = {
|
||||||
"-XX:+UnlockDiagnosticVMOptions",
|
|
||||||
"--add-modules=jdk.hotspot.agent",
|
"--add-modules=jdk.hotspot.agent",
|
||||||
"--add-exports=jdk.hotspot.agent/sun.jvm.hotspot=ALL-UNNAMED",
|
"--add-exports=jdk.hotspot.agent/sun.jvm.hotspot=ALL-UNNAMED",
|
||||||
"--add-exports=jdk.hotspot.agent/sun.jvm.hotspot.utilities=ALL-UNNAMED",
|
"--add-exports=jdk.hotspot.agent/sun.jvm.hotspot.utilities=ALL-UNNAMED",
|
||||||
"--add-exports=jdk.hotspot.agent/sun.jvm.hotspot.oops=ALL-UNNAMED",
|
"--add-exports=jdk.hotspot.agent/sun.jvm.hotspot.oops=ALL-UNNAMED",
|
||||||
|
"--add-exports=jdk.hotspot.agent/sun.jvm.hotspot.debugger=ALL-UNNAMED",
|
||||||
"TestInstanceKlassSize",
|
"TestInstanceKlassSize",
|
||||||
Long.toString(app.getPid())
|
Long.toString(app.getPid())
|
||||||
};
|
};
|
||||||
|
@ -136,6 +141,8 @@ public class TestInstanceKlassSize {
|
||||||
String jcmdInstanceKlassSize = getJcmdInstanceKlassSize(
|
String jcmdInstanceKlassSize = getJcmdInstanceKlassSize(
|
||||||
jcmdOutput,
|
jcmdOutput,
|
||||||
instanceKlassName);
|
instanceKlassName);
|
||||||
|
Asserts.assertNotNull(jcmdInstanceKlassSize,
|
||||||
|
"Could not get the instance klass size from the jcmd output");
|
||||||
for (String s : output.asLines()) {
|
for (String s : output.asLines()) {
|
||||||
if (s.contains(instanceKlassName)) {
|
if (s.contains(instanceKlassName)) {
|
||||||
Asserts.assertTrue(
|
Asserts.assertTrue(
|
||||||
|
@ -165,10 +172,12 @@ public class TestInstanceKlassSize {
|
||||||
}
|
}
|
||||||
|
|
||||||
for (String SAInstanceKlassName : SAInstanceKlassNames) {
|
for (String SAInstanceKlassName : SAInstanceKlassNames) {
|
||||||
Long size = SystemDictionaryHelper.findInstanceKlass(
|
InstanceKlass ik = SystemDictionaryHelper.findInstanceKlass(
|
||||||
SAInstanceKlassName).getSize();
|
SAInstanceKlassName);
|
||||||
|
Asserts.assertNotNull(ik,
|
||||||
|
String.format("Unable to find instance klass for %s", ik));
|
||||||
System.out.println("SA: The size of " + SAInstanceKlassName +
|
System.out.println("SA: The size of " + SAInstanceKlassName +
|
||||||
" is " + size);
|
" is " + ik.getSize());
|
||||||
}
|
}
|
||||||
agent.detach();
|
agent.detach();
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,15 +38,20 @@ import jdk.test.lib.Asserts;
|
||||||
* @test
|
* @test
|
||||||
* @library /test/lib
|
* @library /test/lib
|
||||||
* @modules java.base/jdk.internal.misc
|
* @modules java.base/jdk.internal.misc
|
||||||
* @modules jdk.hotspot.agent
|
* @compile -XDignore.symbol.file=true
|
||||||
* @modules jdk.hotspot.agent/sun.jvm.hotspot
|
* --add-exports=jdk.hotspot.agent/sun.jvm.hotspot=ALL-UNNAMED
|
||||||
* @modules jdk.hotspot.agent/sun.jvm.hotspot.utilities
|
* --add-exports=jdk.hotspot.agent/sun.jvm.hotspot.utilities=ALL-UNNAMED
|
||||||
* @modules jdk.hotspot.agent/sun.jvm.hotspot.oops
|
* --add-exports=jdk.hotspot.agent/sun.jvm.hotspot.oops=ALL-UNNAMED
|
||||||
* @compile -XDignore.symbol.file=true -Xmodule:jdk.hotspot.agent
|
* --add-exports=jdk.hotspot.agent/sun.jvm.hotspot.debugger=ALL-UNNAMED
|
||||||
* -XaddExports:java.base/jdk.internal.misc=jdk.hotspot.agent
|
|
||||||
* -XaddExports:java.management/java.lang.management=jdk.hotspot.agent
|
|
||||||
* TestInstanceKlassSizeForInterface.java
|
* TestInstanceKlassSizeForInterface.java
|
||||||
* @run main/othervm TestInstanceKlassSizeForInterface
|
* @run main/othervm
|
||||||
|
* -XX:+UnlockDiagnosticVMOptions
|
||||||
|
* --add-modules=jdk.hotspot.agent
|
||||||
|
* --add-exports=jdk.hotspot.agent/sun.jvm.hotspot=ALL-UNNAMED
|
||||||
|
* --add-exports=jdk.hotspot.agent/sun.jvm.hotspot.utilities=ALL-UNNAMED
|
||||||
|
* --add-exports=jdk.hotspot.agent/sun.jvm.hotspot.oops=ALL-UNNAMED
|
||||||
|
* --add-exports=jdk.hotspot.agent/sun.jvm.hotspot.debugger=ALL-UNNAMED
|
||||||
|
* TestInstanceKlassSizeForInterface
|
||||||
*/
|
*/
|
||||||
|
|
||||||
interface Language {
|
interface Language {
|
||||||
|
@ -80,6 +85,8 @@ public class TestInstanceKlassSizeForInterface {
|
||||||
for (String instanceKlassName : instanceKlassNames) {
|
for (String instanceKlassName : instanceKlassNames) {
|
||||||
InstanceKlass iKlass = SystemDictionaryHelper.findInstanceKlass(
|
InstanceKlass iKlass = SystemDictionaryHelper.findInstanceKlass(
|
||||||
instanceKlassName);
|
instanceKlassName);
|
||||||
|
Asserts.assertNotNull(iKlass,
|
||||||
|
String.format("Unable to find instance klass for %s", instanceKlassName));
|
||||||
System.out.println("SA: The size of " + instanceKlassName +
|
System.out.println("SA: The size of " + instanceKlassName +
|
||||||
" is " + iKlass.getSize());
|
" is " + iKlass.getSize());
|
||||||
}
|
}
|
||||||
|
@ -106,11 +113,11 @@ public class TestInstanceKlassSizeForInterface {
|
||||||
|
|
||||||
// Grab the pid from the current java process and pass it
|
// Grab the pid from the current java process and pass it
|
||||||
String[] toolArgs = {
|
String[] toolArgs = {
|
||||||
"-XX:+UnlockDiagnosticVMOptions",
|
|
||||||
"--add-modules=jdk.hotspot.agent",
|
"--add-modules=jdk.hotspot.agent",
|
||||||
"--add-exports=jdk.hotspot.agent/sun.jvm.hotspot=ALL-UNNAMED",
|
"--add-exports=jdk.hotspot.agent/sun.jvm.hotspot=ALL-UNNAMED",
|
||||||
"--add-exports=jdk.hotspot.agent/sun.jvm.hotspot.utilities=ALL-UNNAMED",
|
"--add-exports=jdk.hotspot.agent/sun.jvm.hotspot.utilities=ALL-UNNAMED",
|
||||||
"--add-exports=jdk.hotspot.agent/sun.jvm.hotspot.oops=ALL-UNNAMED",
|
"--add-exports=jdk.hotspot.agent/sun.jvm.hotspot.oops=ALL-UNNAMED",
|
||||||
|
"--add-exports=jdk.hotspot.agent/sun.jvm.hotspot.debugger=ALL-UNNAMED",
|
||||||
"TestInstanceKlassSizeForInterface",
|
"TestInstanceKlassSizeForInterface",
|
||||||
Long.toString(ProcessTools.getProcessId())
|
Long.toString(ProcessTools.getProcessId())
|
||||||
};
|
};
|
||||||
|
@ -138,6 +145,8 @@ public class TestInstanceKlassSizeForInterface {
|
||||||
String jcmdInstanceKlassSize = getJcmdInstanceKlassSize(
|
String jcmdInstanceKlassSize = getJcmdInstanceKlassSize(
|
||||||
jcmdOutput,
|
jcmdOutput,
|
||||||
instanceKlassName);
|
instanceKlassName);
|
||||||
|
Asserts.assertNotNull(jcmdInstanceKlassSize,
|
||||||
|
"Could not get the instance klass size from the jcmd output");
|
||||||
for (String s : SAOutput.asLines()) {
|
for (String s : SAOutput.asLines()) {
|
||||||
if (s.contains(instanceKlassName)) {
|
if (s.contains(instanceKlassName)) {
|
||||||
Asserts.assertTrue(
|
Asserts.assertTrue(
|
||||||
|
@ -162,7 +171,7 @@ public class TestInstanceKlassSizeForInterface {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( args == null || args.length == 0 ) {
|
if (args == null || args.length == 0) {
|
||||||
ParselTongue lang = new ParselTongue();
|
ParselTongue lang = new ParselTongue();
|
||||||
|
|
||||||
Language ventro = new Language() {
|
Language ventro = new Language() {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue