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.utilities.SystemDictionaryHelper;
|
||||
import sun.jvm.hotspot.oops.InstanceKlass;
|
||||
import sun.jvm.hotspot.debugger.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -44,15 +45,19 @@ import java.util.*;
|
|||
* @test
|
||||
* @library /test/lib
|
||||
* @modules java.base/jdk.internal.misc
|
||||
* @modules jdk.hotspot.agent
|
||||
* @modules jdk.hotspot.agent/sun.jvm.hotspot
|
||||
* @modules jdk.hotspot.agent/sun.jvm.hotspot.utilities
|
||||
* @modules jdk.hotspot.agent/sun.jvm.hotspot.oops
|
||||
* @compile -XDignore.symbol.file=true -Xmodule:jdk.hotspot.agent
|
||||
* -XaddExports:java.base/jdk.internal.misc=jdk.hotspot.agent
|
||||
* -XaddExports:java.management/java.lang.management=jdk.hotspot.agent
|
||||
* @compile -XDignore.symbol.file=true
|
||||
* --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.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 {
|
||||
|
@ -112,11 +117,11 @@ public class TestInstanceKlassSize {
|
|||
" java.lang.Byte",
|
||||
};
|
||||
String[] toolArgs = {
|
||||
"-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",
|
||||
"TestInstanceKlassSize",
|
||||
Long.toString(app.getPid())
|
||||
};
|
||||
|
@ -136,6 +141,8 @@ public class TestInstanceKlassSize {
|
|||
String jcmdInstanceKlassSize = getJcmdInstanceKlassSize(
|
||||
jcmdOutput,
|
||||
instanceKlassName);
|
||||
Asserts.assertNotNull(jcmdInstanceKlassSize,
|
||||
"Could not get the instance klass size from the jcmd output");
|
||||
for (String s : output.asLines()) {
|
||||
if (s.contains(instanceKlassName)) {
|
||||
Asserts.assertTrue(
|
||||
|
@ -165,10 +172,12 @@ public class TestInstanceKlassSize {
|
|||
}
|
||||
|
||||
for (String SAInstanceKlassName : SAInstanceKlassNames) {
|
||||
Long size = SystemDictionaryHelper.findInstanceKlass(
|
||||
SAInstanceKlassName).getSize();
|
||||
InstanceKlass ik = SystemDictionaryHelper.findInstanceKlass(
|
||||
SAInstanceKlassName);
|
||||
Asserts.assertNotNull(ik,
|
||||
String.format("Unable to find instance klass for %s", ik));
|
||||
System.out.println("SA: The size of " + SAInstanceKlassName +
|
||||
" is " + size);
|
||||
" is " + ik.getSize());
|
||||
}
|
||||
agent.detach();
|
||||
}
|
||||
|
|
|
@ -38,15 +38,20 @@ import jdk.test.lib.Asserts;
|
|||
* @test
|
||||
* @library /test/lib
|
||||
* @modules java.base/jdk.internal.misc
|
||||
* @modules jdk.hotspot.agent
|
||||
* @modules jdk.hotspot.agent/sun.jvm.hotspot
|
||||
* @modules jdk.hotspot.agent/sun.jvm.hotspot.utilities
|
||||
* @modules jdk.hotspot.agent/sun.jvm.hotspot.oops
|
||||
* @compile -XDignore.symbol.file=true -Xmodule:jdk.hotspot.agent
|
||||
* -XaddExports:java.base/jdk.internal.misc=jdk.hotspot.agent
|
||||
* -XaddExports:java.management/java.lang.management=jdk.hotspot.agent
|
||||
* @compile -XDignore.symbol.file=true
|
||||
* --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.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 {
|
||||
|
@ -80,6 +85,8 @@ public class TestInstanceKlassSizeForInterface {
|
|||
for (String instanceKlassName : instanceKlassNames) {
|
||||
InstanceKlass iKlass = SystemDictionaryHelper.findInstanceKlass(
|
||||
instanceKlassName);
|
||||
Asserts.assertNotNull(iKlass,
|
||||
String.format("Unable to find instance klass for %s", instanceKlassName));
|
||||
System.out.println("SA: The size of " + instanceKlassName +
|
||||
" is " + iKlass.getSize());
|
||||
}
|
||||
|
@ -106,11 +113,11 @@ public class TestInstanceKlassSizeForInterface {
|
|||
|
||||
// Grab the pid from the current java process and pass it
|
||||
String[] toolArgs = {
|
||||
"-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",
|
||||
Long.toString(ProcessTools.getProcessId())
|
||||
};
|
||||
|
@ -138,6 +145,8 @@ public class TestInstanceKlassSizeForInterface {
|
|||
String jcmdInstanceKlassSize = getJcmdInstanceKlassSize(
|
||||
jcmdOutput,
|
||||
instanceKlassName);
|
||||
Asserts.assertNotNull(jcmdInstanceKlassSize,
|
||||
"Could not get the instance klass size from the jcmd output");
|
||||
for (String s : SAOutput.asLines()) {
|
||||
if (s.contains(instanceKlassName)) {
|
||||
Asserts.assertTrue(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue