8275662: remove test/lib/sun/hotspot

Reviewed-by: mseledtsov, sspitsyn, lmesnik
This commit is contained in:
Coleen Phillimore 2022-07-11 13:07:03 +00:00
parent 46251bc6e2
commit 0c37008917
99 changed files with 117 additions and 1484 deletions

View File

@ -63,7 +63,7 @@ public class AbstractRootMethod {
run(AbstractInterface.class);
// Implementation limitation: CHA is not performed by C1 during inlining through MH linkers.
if (!sun.hotspot.code.Compiler.isC1Enabled()) {
if (!jdk.test.whitebox.code.Compiler.isC1Enabled()) {
run(AbstractClass.TestMH.class, AbstractClass.class);
run(AbstractInterface.TestMH.class, AbstractInterface.class);
}

View File

@ -63,7 +63,7 @@ public class DefaultRootMethod {
run(InheritedDefault.class);
// Implementation limitation: CHA is not performed by C1 during inlining through MH linkers.
if (!sun.hotspot.code.Compiler.isC1Enabled()) {
if (!jdk.test.whitebox.code.Compiler.isC1Enabled()) {
run(DefaultRoot.TestMH.class, DefaultRoot.class);
run(InheritedDefault.TestMH.class, InheritedDefault.class);
}

View File

@ -27,7 +27,7 @@ import jdk.internal.org.objectweb.asm.ClassWriter;
import jdk.internal.org.objectweb.asm.MethodVisitor;
import jdk.internal.vm.annotation.DontInline;
import jdk.test.whitebox.WhiteBox;
import sun.hotspot.code.NMethod;
import jdk.test.whitebox.code.NMethod;
import java.io.IOException;
import java.lang.annotation.Retention;

View File

@ -48,8 +48,8 @@ package compiler.codecache;
import jdk.test.lib.Asserts;
import jdk.test.whitebox.WhiteBox;
import sun.hotspot.code.BlobType;
import sun.hotspot.code.CodeBlob;
import jdk.test.whitebox.code.BlobType;
import jdk.test.whitebox.code.CodeBlob;
import java.lang.management.MemoryPoolMXBean;
import java.lang.reflect.Method;

View File

@ -40,7 +40,7 @@ import compiler.codecache.cli.common.CodeCacheOptions;
import jdk.test.lib.process.ExitCode;
import jdk.test.lib.Platform;
import jdk.test.lib.cli.CommandLineOptionTest;
import sun.hotspot.code.BlobType;
import jdk.test.whitebox.code.BlobType;
public class TestSegmentedCodeCacheOption {
private static final String INT_MODE = "-Xint";

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -28,7 +28,7 @@ import compiler.codecache.cli.common.CodeCacheOptions;
import jdk.test.lib.process.ExitCode;
import jdk.test.lib.Platform;
import jdk.test.lib.cli.CommandLineOptionTest;
import sun.hotspot.code.BlobType;
import jdk.test.whitebox.code.BlobType;
/**
* Test case runner aimed to verify that NonNMethodCodeHeapSize smaller than

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -26,7 +26,7 @@ package compiler.codecache.cli.codeheapsize;
import compiler.codecache.cli.common.CodeCacheCLITestCase;
import compiler.codecache.cli.common.CodeCacheOptions;
import jdk.test.lib.cli.CommandLineOptionTest;
import sun.hotspot.code.BlobType;
import jdk.test.whitebox.code.BlobType;
/**
* Test case runner aimed to verify that all four options related to code cache

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -28,7 +28,7 @@ import compiler.codecache.cli.common.CodeCacheOptions;
import jdk.test.lib.process.ExitCode;
import jdk.test.lib.Utils;
import jdk.test.lib.cli.CommandLineOptionTest;
import sun.hotspot.code.BlobType;
import jdk.test.whitebox.code.BlobType;
import java.util.Random;

View File

@ -40,7 +40,7 @@ package compiler.codecache.cli.codeheapsize;
import compiler.codecache.cli.common.CodeCacheCLITestBase;
import compiler.codecache.cli.common.CodeCacheCLITestCase;
import jdk.test.lib.Platform;
import sun.hotspot.code.BlobType;
import jdk.test.whitebox.code.BlobType;
import java.util.EnumSet;

View File

@ -24,7 +24,7 @@ package compiler.codecache.cli.common;
import jdk.test.lib.Platform;
import jdk.test.lib.cli.CommandLineOptionTest;
import sun.hotspot.code.BlobType;
import jdk.test.whitebox.code.BlobType;
import java.util.Collections;
import java.util.EnumSet;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -22,7 +22,7 @@
*/
package compiler.codecache.cli.common;
import sun.hotspot.code.BlobType;
import jdk.test.whitebox.code.BlobType;
import java.util.Arrays;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -23,7 +23,7 @@
package compiler.codecache.cli.common;
import jdk.test.lib.cli.CommandLineOptionTest;
import sun.hotspot.code.BlobType;
import jdk.test.whitebox.code.BlobType;
import java.util.ArrayList;
import java.util.Collections;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -28,7 +28,7 @@ import compiler.codecache.cli.common.CodeCacheInfoFormatter;
import compiler.codecache.cli.common.CodeCacheOptions;
import jdk.test.lib.process.ExitCode;
import jdk.test.lib.cli.CommandLineOptionTest;
import sun.hotspot.code.BlobType;
import jdk.test.whitebox.code.BlobType;
import java.util.EnumSet;
import java.util.stream.Collectors;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -38,7 +38,7 @@ package compiler.codecache.cli.printcodecache;
import compiler.codecache.cli.common.CodeCacheCLITestBase;
import compiler.codecache.cli.common.CodeCacheCLITestCase;
import sun.hotspot.code.BlobType;
import jdk.test.whitebox.code.BlobType;
import java.util.EnumSet;

View File

@ -43,7 +43,7 @@
package compiler.codecache.jmx;
import jdk.test.lib.Asserts;
import sun.hotspot.code.BlobType;
import jdk.test.whitebox.code.BlobType;
import java.lang.management.MemoryType;

View File

@ -26,8 +26,8 @@ package compiler.codecache.jmx;
import jdk.test.lib.Asserts;
import jdk.test.lib.Utils;
import jdk.test.whitebox.WhiteBox;
import sun.hotspot.code.BlobType;
import sun.hotspot.code.CodeBlob;
import jdk.test.whitebox.code.BlobType;
import jdk.test.whitebox.code.CodeBlob;
import javax.management.Notification;
import java.lang.management.MemoryPoolMXBean;

View File

@ -43,7 +43,7 @@
package compiler.codecache.jmx;
import jdk.test.lib.Asserts;
import sun.hotspot.code.BlobType;
import jdk.test.whitebox.code.BlobType;
import java.util.EnumSet;

View File

@ -45,7 +45,7 @@
package compiler.codecache.jmx;
import jdk.test.lib.Asserts;
import sun.hotspot.code.BlobType;
import jdk.test.whitebox.code.BlobType;
import java.lang.management.MemoryPoolMXBean;
import java.util.HashMap;

View File

@ -45,7 +45,7 @@
package compiler.codecache.jmx;
import jdk.test.lib.Asserts;
import sun.hotspot.code.BlobType;
import jdk.test.whitebox.code.BlobType;
import java.lang.management.MemoryPoolMXBean;
import java.util.ArrayList;

View File

@ -43,7 +43,7 @@
package compiler.codecache.jmx;
import jdk.test.lib.Asserts;
import sun.hotspot.code.BlobType;
import jdk.test.whitebox.code.BlobType;
import java.lang.management.MemoryPoolMXBean;

View File

@ -43,7 +43,7 @@
package compiler.codecache.jmx;
import jdk.test.lib.Asserts;
import sun.hotspot.code.BlobType;
import jdk.test.whitebox.code.BlobType;
import java.lang.management.ManagementFactory;
import java.lang.management.MemoryManagerMXBean;

View File

@ -43,7 +43,7 @@
package compiler.codecache.jmx;
import sun.hotspot.code.BlobType;
import jdk.test.whitebox.code.BlobType;
import java.lang.management.MemoryPoolMXBean;

View File

@ -44,7 +44,7 @@ package compiler.codecache.jmx;
import jdk.test.lib.Asserts;
import jdk.test.lib.Utils;
import sun.hotspot.code.BlobType;
import jdk.test.whitebox.code.BlobType;
import javax.management.ListenerNotFoundException;
import javax.management.Notification;

View File

@ -44,7 +44,7 @@ package compiler.codecache.jmx;
import jdk.test.lib.Asserts;
import jdk.test.lib.Utils;
import sun.hotspot.code.BlobType;
import jdk.test.whitebox.code.BlobType;
import javax.management.ListenerNotFoundException;
import javax.management.Notification;

View File

@ -45,7 +45,7 @@
package compiler.codecache.jmx;
import sun.hotspot.code.BlobType;
import jdk.test.whitebox.code.BlobType;
import java.lang.management.MemoryPoolMXBean;

View File

@ -44,7 +44,7 @@
package compiler.codecache.jmx;
import sun.hotspot.code.BlobType;
import jdk.test.whitebox.code.BlobType;
import java.lang.management.MemoryPoolMXBean;

View File

@ -45,7 +45,7 @@
package compiler.codecache.jmx;
import sun.hotspot.code.BlobType;
import jdk.test.whitebox.code.BlobType;
import java.lang.management.MemoryPoolMXBean;

View File

@ -45,7 +45,7 @@
package compiler.codecache.stress;
import sun.hotspot.code.BlobType;
import jdk.test.whitebox.code.BlobType;
import java.util.ArrayList;
import java.util.Random;

View File

@ -43,7 +43,7 @@
package compiler.codecache.stress;
import sun.hotspot.code.BlobType;
import jdk.test.whitebox.code.BlobType;
import java.util.ArrayList;

View File

@ -148,7 +148,7 @@
package compiler.codegen.aes;
import compiler.whitebox.CompilerWhiteBoxTest;
import sun.hotspot.code.Compiler;
import jdk.test.whitebox.code.Compiler;
import jtreg.SkippedException;
public class TestAESMain {

View File

@ -47,7 +47,7 @@ import javax.crypto.SecretKeyFactory;
import javax.crypto.spec.PBEKeySpec;
import compiler.whitebox.CompilerWhiteBoxTest;
import sun.hotspot.code.Compiler;
import jdk.test.whitebox.code.Compiler;
import jdk.test.lib.Utils;
import jtreg.SkippedException;

View File

@ -51,7 +51,7 @@ import java.util.Random;
import java.util.Arrays;
import compiler.whitebox.CompilerWhiteBoxTest;
import sun.hotspot.code.Compiler;
import jdk.test.whitebox.code.Compiler;
import jtreg.SkippedException;
import jdk.test.lib.Utils;

View File

@ -38,7 +38,7 @@
package compiler.intrinsics.bmi;
import sun.hotspot.cpuinfo.CPUInfo;
import jdk.test.whitebox.cpuinfo.CPUInfo;
public class TestAndnI {

View File

@ -40,7 +40,7 @@
package compiler.intrinsics.bmi;
import sun.hotspot.cpuinfo.CPUInfo;
import jdk.test.whitebox.cpuinfo.CPUInfo;
public class TestAndnL {

View File

@ -40,7 +40,7 @@
package compiler.intrinsics.bmi;
import sun.hotspot.cpuinfo.CPUInfo;
import jdk.test.whitebox.cpuinfo.CPUInfo;
public class TestBlsiI {

View File

@ -40,7 +40,7 @@
package compiler.intrinsics.bmi;
import sun.hotspot.cpuinfo.CPUInfo;
import jdk.test.whitebox.cpuinfo.CPUInfo;
public class TestBlsiL {

View File

@ -40,7 +40,7 @@
package compiler.intrinsics.bmi;
import sun.hotspot.cpuinfo.CPUInfo;
import jdk.test.whitebox.cpuinfo.CPUInfo;
public class TestBlsmskI {

View File

@ -40,7 +40,7 @@
package compiler.intrinsics.bmi;
import sun.hotspot.cpuinfo.CPUInfo;
import jdk.test.whitebox.cpuinfo.CPUInfo;
public class TestBlsmskL {

View File

@ -40,7 +40,7 @@
package compiler.intrinsics.bmi;
import sun.hotspot.cpuinfo.CPUInfo;
import jdk.test.whitebox.cpuinfo.CPUInfo;
public class TestBlsrI {

View File

@ -40,7 +40,7 @@
package compiler.intrinsics.bmi;
import sun.hotspot.cpuinfo.CPUInfo;
import jdk.test.whitebox.cpuinfo.CPUInfo;
public class TestBlsrL {

View File

@ -38,7 +38,7 @@
package compiler.intrinsics.bmi;
import jdk.test.lib.Platform;
import sun.hotspot.cpuinfo.CPUInfo;
import jdk.test.whitebox.cpuinfo.CPUInfo;
public class TestBzhiI2L {

View File

@ -40,7 +40,7 @@
package compiler.intrinsics.bmi;
import sun.hotspot.cpuinfo.CPUInfo;
import jdk.test.whitebox.cpuinfo.CPUInfo;
public class TestLzcntI {

View File

@ -40,7 +40,7 @@
package compiler.intrinsics.bmi;
import sun.hotspot.cpuinfo.CPUInfo;
import jdk.test.whitebox.cpuinfo.CPUInfo;
public class TestLzcntL {

View File

@ -40,7 +40,7 @@
package compiler.intrinsics.bmi;
import sun.hotspot.cpuinfo.CPUInfo;
import jdk.test.whitebox.cpuinfo.CPUInfo;
public class TestTzcntI {

View File

@ -40,7 +40,7 @@
package compiler.intrinsics.bmi;
import sun.hotspot.cpuinfo.CPUInfo;
import jdk.test.whitebox.cpuinfo.CPUInfo;
public class TestTzcntL {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -27,8 +27,8 @@ import compiler.whitebox.CompilerWhiteBoxTest;
import jdk.test.lib.Asserts;
import jdk.test.lib.Platform;
import jdk.test.lib.Utils;
import sun.hotspot.code.NMethod;
import sun.hotspot.cpuinfo.CPUInfo;
import jdk.test.whitebox.code.NMethod;
import jdk.test.whitebox.cpuinfo.CPUInfo;
import java.lang.invoke.MethodHandle;
import java.lang.invoke.MethodType;

View File

@ -49,7 +49,7 @@ import jdk.test.lib.Platform;
import jdk.test.lib.jfr.EventNames;
import jdk.test.lib.jfr.Events;
import jdk.test.whitebox.WhiteBox;
import sun.hotspot.code.NMethod;
import jdk.test.whitebox.code.NMethod;
import java.io.IOException;
import java.lang.invoke.MethodHandle;

View File

@ -55,7 +55,7 @@ import jdk.test.lib.util.Pair;
import jdk.test.lib.Utils;
import jdk.vm.ci.hotspot.CompilerToVMHelper;
import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod;
import sun.hotspot.code.NMethod;
import jdk.test.whitebox.code.NMethod;
import java.lang.reflect.Executable;
import java.lang.reflect.Method;

View File

@ -32,7 +32,7 @@ import jdk.vm.ci.meta.MetaAccessProvider;
import jdk.vm.ci.meta.ResolvedJavaMethod;
import jdk.vm.ci.runtime.JVMCI;
import jdk.test.whitebox.WhiteBox;
import sun.hotspot.code.NMethod;
import jdk.test.whitebox.code.NMethod;
import java.lang.reflect.Constructor;
import java.lang.reflect.Executable;

View File

@ -52,7 +52,7 @@ import jdk.test.lib.Asserts;
import jdk.test.lib.Utils;
import jdk.vm.ci.code.InstalledCode;
import jdk.vm.ci.hotspot.CompilerToVMHelper;
import sun.hotspot.code.NMethod;
import jdk.test.whitebox.code.NMethod;
import java.util.List;

View File

@ -50,7 +50,7 @@ import jdk.test.lib.Utils;
import jdk.vm.ci.code.InstalledCode;
import jdk.vm.ci.code.InvalidInstalledCodeException;
import jdk.vm.ci.hotspot.CompilerToVMHelper;
import sun.hotspot.code.NMethod;
import jdk.test.whitebox.code.NMethod;
import java.lang.reflect.Constructor;
import java.lang.reflect.Modifier;

View File

@ -53,7 +53,7 @@ import jdk.test.lib.Asserts;
import jdk.test.lib.Utils;
import jdk.vm.ci.hotspot.CompilerToVMHelper;
import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod;
import sun.hotspot.code.NMethod;
import jdk.test.whitebox.code.NMethod;
import java.lang.reflect.Executable;
import java.util.ArrayList;

View File

@ -58,7 +58,7 @@ import jdk.vm.ci.hotspot.CompilerToVMHelper;
import jdk.vm.ci.hotspot.HotSpotCompilationRequest;
import jdk.vm.ci.hotspot.HotSpotJVMCIRuntime;
import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod;
import sun.hotspot.code.NMethod;
import jdk.test.whitebox.code.NMethod;
import java.util.List;

View File

@ -42,7 +42,7 @@ import java.util.Iterator;
import java.util.List;
import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.process.ProcessTools;
import sun.hotspot.cpuinfo.CPUInfo;
import jdk.test.whitebox.cpuinfo.CPUInfo;
public class TestOnSpinWaitAArch64DefaultFlags {
private static boolean isCPUModelNeoverseN1(String cpuModel) {

View File

@ -52,7 +52,7 @@ import static jdk.internal.misc.Unsafe.*;
import static jdk.test.lib.Asserts.assertEQ;
import static jdk.test.lib.Asserts.assertNE;
import sun.hotspot.code.Compiler;
import jdk.test.whitebox.code.Compiler;
public class UnsafeGetStableArrayElement {
@Stable static final boolean[] STABLE_BOOLEAN_ARRAY = new boolean[16];

View File

@ -45,7 +45,7 @@ package compiler.whitebox;
import jdk.test.lib.Asserts;
import jdk.test.lib.InfiniteLoop;
import jdk.test.whitebox.WhiteBox;
import sun.hotspot.code.BlobType;
import jdk.test.whitebox.code.BlobType;
import java.lang.management.MemoryPoolMXBean;
import java.util.ArrayList;

View File

@ -25,7 +25,7 @@ package compiler.whitebox;
import jdk.test.lib.Platform;
import jdk.test.whitebox.WhiteBox;
import sun.hotspot.code.NMethod;
import jdk.test.whitebox.code.NMethod;
import java.lang.reflect.Executable;
import java.util.Objects;

View File

@ -49,7 +49,7 @@
package compiler.whitebox;
import jdk.test.lib.Asserts;
import sun.hotspot.code.NMethod;
import jdk.test.whitebox.code.NMethod;
import java.lang.reflect.Executable;
import java.util.concurrent.Callable;

View File

@ -44,7 +44,7 @@
package compiler.whitebox;
import jdk.test.lib.Asserts;
import sun.hotspot.code.BlobType;
import jdk.test.whitebox.code.BlobType;
import java.util.EnumSet;

View File

@ -42,8 +42,8 @@ package compiler.whitebox;
import jdk.test.lib.Asserts;
import jdk.test.whitebox.WhiteBox;
import sun.hotspot.code.BlobType;
import sun.hotspot.code.CodeBlob;
import jdk.test.whitebox.code.BlobType;
import jdk.test.whitebox.code.CodeBlob;
import java.util.Arrays;
import java.util.EnumSet;

View File

@ -42,8 +42,8 @@
package compiler.whitebox;
import jdk.test.lib.Asserts;
import sun.hotspot.code.BlobType;
import sun.hotspot.code.NMethod;
import jdk.test.whitebox.code.BlobType;
import jdk.test.whitebox.code.NMethod;
public class GetNMethodTest extends CompilerWhiteBoxTest {
public static void main(String[] args) throws Exception {

View File

@ -36,7 +36,7 @@ package gc;
*/
import jdk.test.whitebox.WhiteBox;
import sun.hotspot.gc.GC;
import jdk.test.whitebox.gc.GC;
public class TestConcurrentGCBreakpoints {

View File

@ -43,7 +43,7 @@ package gc.TestJNIWeak;
* gc.TestJNIWeak.TestJNIWeak
*/
import sun.hotspot.gc.GC;
import jdk.test.whitebox.gc.GC;
import jdk.test.whitebox.WhiteBox;
import jtreg.SkippedException;
import java.lang.ref.Reference;

View File

@ -63,7 +63,7 @@ import jdk.test.lib.process.ProcessTools;
import jtreg.SkippedException;
import jdk.test.whitebox.WhiteBox;
import sun.hotspot.gc.GC;
import jdk.test.whitebox.gc.GC;
public class TestSmallHeap {

View File

@ -41,7 +41,7 @@ import java.util.List;
import jdk.test.lib.Asserts;
import jdk.test.lib.process.OutputAnalyzer;
import jtreg.SkippedException;
import sun.hotspot.gc.GC;
import jdk.test.whitebox.gc.GC;
public class TestParallelGCThreads {

View File

@ -39,7 +39,7 @@ import java.util.ArrayList;
import jdk.test.lib.process.OutputAnalyzer;
import jtreg.SkippedException;
import sun.hotspot.gc.GC;
import jdk.test.whitebox.gc.GC;
public class TestParallelRefProc {

View File

@ -37,7 +37,7 @@ package gc.ergonomics;
import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.process.ProcessTools;
import jtreg.SkippedException;
import sun.hotspot.gc.GC;
import jdk.test.whitebox.gc.GC;
public class TestDynamicNumberOfGCThreads {
public static void main(String[] args) throws Exception {

View File

@ -37,7 +37,7 @@ package gc.ergonomics;
import jdk.test.lib.process.ProcessTools;
import jdk.test.lib.process.OutputAnalyzer;
import jtreg.SkippedException;
import sun.hotspot.gc.GC;
import jdk.test.whitebox.gc.GC;
public class TestInitialGCThreadLogging {
public static void main(String[] args) throws Exception {

View File

@ -41,7 +41,7 @@ package gc.g1;
import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.Platform;
import jdk.test.lib.process.ProcessTools;
import sun.hotspot.code.Compiler;
import jdk.test.whitebox.code.Compiler;
public class TestGCLogMessages {

View File

@ -28,8 +28,8 @@ package gc.g1;
* @requires vm.gc.G1
* @summary Basic testing of various GC pause verification during the G1 concurrent cycle.
* @library /test/lib
* @build sun.hotspot.WhiteBox
* @run driver jdk.test.lib.helpers.ClassFileInstaller sun.hotspot.WhiteBox
* @build jdk.test.whitebox.WhiteBox
* @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox
* @run main/othervm
* -Xbootclasspath/a:.
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
@ -40,8 +40,8 @@ package gc.g1;
* gc.g1.TestVerificationInConcurrentCycle
*/
import sun.hotspot.WhiteBox;
import sun.hotspot.gc.GC;
import jdk.test.whitebox.WhiteBox;
import jdk.test.whitebox.gc.GC;
public class TestVerificationInConcurrentCycle {

View File

@ -38,7 +38,7 @@ package gc.logging;
import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.process.ProcessTools;
import jtreg.SkippedException;
import sun.hotspot.gc.GC;
import jdk.test.whitebox.gc.GC;
public class TestGCId {
public static void main(String[] args) throws Exception {

View File

@ -38,9 +38,9 @@ import java.util.Collections;
import jdk.test.lib.Platform;
import jdk.test.lib.process.ProcessTools;
import jdk.test.lib.process.OutputAnalyzer;
import sun.hotspot.gc.GC;
import jdk.test.whitebox.gc.GC;
import sun.hotspot.code.Compiler;
import jdk.test.whitebox.code.Compiler;
public class UseCompressedOops {

View File

@ -43,8 +43,8 @@ import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.process.ProcessTools;
import jdk.test.lib.Utils;
import jdk.test.whitebox.WhiteBox;
import sun.hotspot.code.Compiler;
import sun.hotspot.gc.GC;
import jdk.test.whitebox.code.Compiler;
import jdk.test.whitebox.gc.GC;
import jdk.test.lib.classloader.ClassWithManyMethodsClassLoader;
public class MemberNameLeak {

View File

@ -45,7 +45,7 @@ import jdk.test.lib.Platform;
import jdk.test.lib.process.ProcessTools;
import jdk.test.lib.process.OutputAnalyzer;
import sun.hotspot.code.Compiler;
import jdk.test.whitebox.code.Compiler;
import jdk.test.whitebox.WhiteBox;
public class CommandLineFlagCombo {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -131,19 +131,15 @@ public class JarBuilder {
}
// Add commonly used inner classes that are often omitted by mistake. Currently
// we support only jdk/test/whitebox/WhiteBox$WhiteBoxPermission and
// sun/hotspot/WhiteBox$WhiteBoxPermission. See JDK-8199290
// we support only jdk/test/whitebox/WhiteBox$WhiteBoxPermission.
// See JDK-8199290
private static String[] addInnerClasses(String[] classes, int startIdx) {
boolean seenNewWb = false;
boolean seenNewWbInner = false;
boolean seenOldWb = false;
boolean seenOldWbInner = false;
// This method is different than ClassFileInstaller.addInnerClasses which
// uses "." as the package delimiter :-(
final String newWb = "jdk/test/whitebox/WhiteBox";
final String newWbInner = newWb + "$WhiteBoxPermission";
final String oldWb = "sun/hotspot/WhiteBox";
final String oldWbInner = oldWb + "$WhiteBoxPermission";
ArrayList<String> list = new ArrayList<>();
@ -153,17 +149,11 @@ public class JarBuilder {
switch (cls) {
case newWb: seenNewWb = true; break;
case newWbInner: seenNewWbInner = true; break;
case oldWb: seenOldWb = true; break;
case oldWbInner: seenOldWbInner = true; break;
}
}
if (seenNewWb && !seenNewWbInner) {
list.add(newWbInner);
}
if (seenOldWb && !seenOldWbInner) {
list.add(oldWbInner);
}
String[] array = new String[list.size()];
list.toArray(array);
return array;

View File

@ -38,7 +38,7 @@
import org.testng.annotations.Test;
import java.io.File;
import jtreg.SkippedException;
import sun.hotspot.gc.GC;
import jdk.test.whitebox.gc.GC;
@Test
public class CDSStreamTestDriver extends DynamicArchiveTestBase {

View File

@ -43,7 +43,7 @@ import jdk.test.lib.Platform;
import jdk.test.lib.cds.CDSTestUtils;
import jtreg.SkippedException;
import sun.hotspot.code.Compiler;
import jdk.test.whitebox.code.Compiler;
public class MainModuleOnly extends DynamicArchiveTestBase {

View File

@ -44,7 +44,7 @@ import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.Platform;
import jtreg.SkippedException;
import sun.hotspot.code.Compiler;
import jdk.test.whitebox.code.Compiler;
public class MainModuleOnly {

View File

@ -71,8 +71,8 @@ import jdk.test.lib.Asserts;
import jdk.test.lib.Platform;
import jdk.test.lib.process.OutputAnalyzer;
import sun.hotspot.code.Compiler;
import sun.hotspot.gc.GC;
import jdk.test.whitebox.code.Compiler;
import jdk.test.whitebox.gc.GC;
public class IncompatibleOptions {
static final String COOPS_DUMP_WARNING =

View File

@ -50,7 +50,7 @@ import java.util.regex.Matcher;
import java.util.regex.Pattern;
import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.process.ProcessTools;
import sun.hotspot.gc.GC;
import jdk.test.whitebox.gc.GC;
public class StringTableCleaningTest {
public static void main(String[] args) throws Exception {

View File

@ -21,7 +21,7 @@
* questions.
*/
import sun.hotspot.code.Compiler;
import jdk.test.whitebox.code.Compiler;
import java.util.ArrayList;
import java.util.List;
@ -29,7 +29,7 @@ import java.util.Map;
import java.util.HashMap;
import jdk.test.lib.apps.LingeredApp;
import jtreg.SkippedException;
import sun.hotspot.gc.GC;
import jdk.test.whitebox.gc.GC;
/**
* @test

View File

@ -61,9 +61,9 @@
* TestDriver
*/
import sun.hotspot.code.Compiler;
import jdk.test.whitebox.code.Compiler;
import jdk.test.whitebox.WhiteBox;
import sun.hotspot.gc.GC;
import jdk.test.whitebox.gc.GC;
public class TestDriver {
public static void main(String[] args) throws Exception {

View File

@ -123,7 +123,7 @@ import java.util.function.Function;
import jdk.test.lib.Asserts;
import jdk.test.whitebox.WhiteBox;
import sun.hotspot.gc.GC;
import jdk.test.whitebox.gc.GC;
//

View File

@ -48,7 +48,7 @@ import java.lang.management.*;
import static java.lang.management.MemoryNotificationInfo.*;;
import static java.lang.management.ManagementFactory.*;
import sun.hotspot.code.Compiler;
import jdk.test.whitebox.code.Compiler;
public class CollectionUsageThreshold {
private static final MemoryMXBean mm = getMemoryMXBean();

View File

@ -49,7 +49,7 @@ import jdk.test.lib.JDKToolFinder;
import jdk.test.lib.process.ProcessTools;
import jdk.test.lib.Utils;
import sun.hotspot.code.Compiler;
import jdk.test.whitebox.code.Compiler;
public class LowMemoryTest {
private static final MemoryMXBean mm = ManagementFactory.getMemoryMXBean();

View File

@ -47,7 +47,7 @@ import java.lang.management.*;
import java.lang.ref.WeakReference;
import java.util.*;
import sun.hotspot.code.Compiler;
import jdk.test.whitebox.code.Compiler;
public class ResetPeakMemoryUsage {
private static MemoryMXBean mbean = ManagementFactory.getMemoryMXBean();

View File

@ -31,7 +31,7 @@ import jdk.test.lib.Asserts;
import jdk.test.lib.jfr.EventNames;
import jdk.test.lib.jfr.Events;
import jdk.test.whitebox.WhiteBox;
import sun.hotspot.code.BlobType;
import jdk.test.whitebox.code.BlobType;
/**
* @test TestCodeCacheFull

View File

@ -35,8 +35,8 @@ import jdk.test.lib.Asserts;
import jdk.test.lib.jfr.EventNames;
import jdk.test.lib.jfr.Events;
import jdk.test.whitebox.WhiteBox;
import sun.hotspot.code.BlobType;
import sun.hotspot.code.CodeBlob;
import jdk.test.whitebox.code.BlobType;
import jdk.test.whitebox.code.CodeBlob;
/**
* Test for events: vm/code_sweeper/sweep vm/code_cache/full vm/compiler/failure

View File

@ -51,7 +51,7 @@ import java.util.stream.IntStream;
import jdk.jfr.internal.JVM;
import jdk.test.lib.Platform;
import jdk.test.whitebox.WhiteBox;
import sun.hotspot.code.NMethod;
import jdk.test.whitebox.code.NMethod;
public class TestJFRIntrinsic {
private static final WhiteBox WHITE_BOX = WhiteBox.getWhiteBox();

View File

@ -1,52 +0,0 @@
/*
* Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test id=without-inner-class
* @summary verify that sun.hotspot.WhiteBox class still can be used
* @library /test/lib
* @build sun.hotspot.WhiteBox
* @run driver jdk.test.lib.helpers.ClassFileInstaller sun.hotspot.WhiteBox
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI OldWhiteBox
*/
/*
* @test id=with-inner-class
* @summary verify that sun.hotspot.WhiteBox class still can be used
* @library /test/lib
* @build sun.hotspot.WhiteBox
* @run driver jdk.test.lib.helpers.ClassFileInstaller sun.hotspot.WhiteBox sun.hotspot.WhiteBox$WhiteBoxPermission
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI OldWhiteBox
*/
import sun.hotspot.WhiteBox;
public class OldWhiteBox {
public static void main(String[] args) {
@SuppressWarnings("deprecation")
WhiteBox wb = WhiteBox.getWhiteBox();
if (wb.getHeapOopSize() < 0) {
throw new Error("wb.getHeapOopSize() < 0");
}
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -24,7 +24,7 @@
package jdk.test.lib.cli.predicate;
import jdk.test.lib.Platform;
import sun.hotspot.cpuinfo.CPUInfo;
import jdk.test.whitebox.cpuinfo.CPUInfo;
import java.util.function.BooleanSupplier;

View File

@ -100,17 +100,13 @@ public class ClassFileInstaller {
}
// Add commonly used inner classes that are often omitted by mistake. Currently
// we support only jdk.test.whitebox.WhiteBox$WhiteBoxPermission and
// jdk/test/whitebox/WhiteBox$WhiteBoxPermission. See JDK-8199290
// we support only jdk.test.whitebox.WhiteBox$WhiteBoxPermission.
// See JDK-8199290
private static String[] addInnerClasses(String[] classes, int startIdx) {
boolean seenNewWb = false;
boolean seenNewWbInner = false;
boolean seenOldWb = false;
boolean seenOldWbInner = false;
final String newWb = "jdk.test.whitebox.WhiteBox";
final String newWbInner = newWb + "$WhiteBoxPermission";
final String oldWb = "sun.hotspot.WhiteBox";
final String oldWbInner = oldWb + "$WhiteBoxPermission";
ArrayList<String> list = new ArrayList<>();
@ -120,17 +116,11 @@ public class ClassFileInstaller {
switch (cls) {
case newWb: seenNewWb = true; break;
case newWbInner: seenNewWbInner = true; break;
case oldWb: seenOldWb = true; break;
case oldWbInner: seenOldWbInner = true; break;
}
}
if (seenNewWb && !seenNewWbInner) {
list.add(newWbInner);
}
if (seenOldWb && !seenOldWbInner) {
list.add(oldWbInner);
}
String[] array = new String[list.size()];
list.toArray(array);
return array;

View File

@ -1,698 +0,0 @@
/*
* Copyright (c) 2012, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package sun.hotspot;
import java.lang.management.MemoryUsage;
import java.lang.reflect.Executable;
import java.util.Arrays;
import java.util.List;
import java.util.function.BiFunction;
import java.util.function.Function;
import java.security.BasicPermission;
import java.util.Objects;
import jdk.test.whitebox.parser.DiagnosticCommand;
@Deprecated
public class WhiteBox {
@SuppressWarnings("serial")
public static class WhiteBoxPermission extends BasicPermission {
public WhiteBoxPermission(String s) {
super(s);
}
}
private WhiteBox() {}
private static final WhiteBox instance = new WhiteBox();
private static native void registerNatives();
/**
* Returns the singleton WhiteBox instance.
*
* The returned WhiteBox object should be carefully guarded
* by the caller, since it can be used to read and write data
* at arbitrary memory addresses. It must never be passed to
* untrusted code.
*/
public synchronized static WhiteBox getWhiteBox() {
@SuppressWarnings("removal")
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
throw new SecurityException("can't use old whitebox with SecurityManager, please switch to jdk.test.whitebox.WhiteBox");
}
return instance;
}
static {
registerNatives();
}
// Get the maximum heap size supporting COOPs
public native long getCompressedOopsMaxHeapSize();
// Arguments
public native void printHeapSizes();
// Memory
private native long getObjectAddress0(Object o);
public long getObjectAddress(Object o) {
Objects.requireNonNull(o);
return getObjectAddress0(o);
}
public native int getHeapOopSize();
public native int getVMPageSize();
public native long getVMAllocationGranularity();
public native long getVMLargePageSize();
public native long getHeapSpaceAlignment();
public native long getHeapAlignment();
private native boolean isObjectInOldGen0(Object o);
public boolean isObjectInOldGen(Object o) {
Objects.requireNonNull(o);
return isObjectInOldGen0(o);
}
private native long getObjectSize0(Object o);
public long getObjectSize(Object o) {
Objects.requireNonNull(o);
return getObjectSize0(o);
}
// Runtime
// Make sure class name is in the correct format
public int countAliveClasses(String name) {
return countAliveClasses0(name.replace('.', '/'));
}
private native int countAliveClasses0(String name);
public boolean isClassAlive(String name) {
return countAliveClasses(name) != 0;
}
public native int getSymbolRefcount(String name);
public native boolean deflateIdleMonitors();
private native boolean isMonitorInflated0(Object obj);
public boolean isMonitorInflated(Object obj) {
Objects.requireNonNull(obj);
return isMonitorInflated0(obj);
}
public native void forceSafepoint();
private native long getConstantPool0(Class<?> aClass);
public long getConstantPool(Class<?> aClass) {
Objects.requireNonNull(aClass);
return getConstantPool0(aClass);
}
private native int getConstantPoolCacheIndexTag0();
public int getConstantPoolCacheIndexTag() {
return getConstantPoolCacheIndexTag0();
}
private native int getConstantPoolCacheLength0(Class<?> aClass);
public int getConstantPoolCacheLength(Class<?> aClass) {
Objects.requireNonNull(aClass);
return getConstantPoolCacheLength0(aClass);
}
private native int remapInstructionOperandFromCPCache0(Class<?> aClass, int index);
public int remapInstructionOperandFromCPCache(Class<?> aClass, int index) {
Objects.requireNonNull(aClass);
return remapInstructionOperandFromCPCache0(aClass, index);
}
private native int encodeConstantPoolIndyIndex0(int index);
public int encodeConstantPoolIndyIndex(int index) {
return encodeConstantPoolIndyIndex0(index);
}
// JVMTI
private native void addToBootstrapClassLoaderSearch0(String segment);
public void addToBootstrapClassLoaderSearch(String segment){
Objects.requireNonNull(segment);
addToBootstrapClassLoaderSearch0(segment);
}
private native void addToSystemClassLoaderSearch0(String segment);
public void addToSystemClassLoaderSearch(String segment) {
Objects.requireNonNull(segment);
addToSystemClassLoaderSearch0(segment);
}
// G1
public native boolean g1InConcurrentMark();
public native boolean g1HasRegionsToUncommit();
private native boolean g1IsHumongous0(Object o);
public boolean g1IsHumongous(Object o) {
Objects.requireNonNull(o);
return g1IsHumongous0(o);
}
private native boolean g1BelongsToHumongousRegion0(long adr);
public boolean g1BelongsToHumongousRegion(long adr) {
if (adr == 0) {
throw new IllegalArgumentException("adr argument should not be null");
}
return g1BelongsToHumongousRegion0(adr);
}
private native boolean g1BelongsToFreeRegion0(long adr);
public boolean g1BelongsToFreeRegion(long adr) {
if (adr == 0) {
throw new IllegalArgumentException("adr argument should not be null");
}
return g1BelongsToFreeRegion0(adr);
}
public native long g1NumMaxRegions();
public native long g1NumFreeRegions();
public native int g1RegionSize();
public native MemoryUsage g1AuxiliaryMemoryUsage();
private native Object[] parseCommandLine0(String commandline, char delim, DiagnosticCommand[] args);
public Object[] parseCommandLine(String commandline, char delim, DiagnosticCommand[] args) {
Objects.requireNonNull(args);
return parseCommandLine0(commandline, delim, args);
}
public native int g1ActiveMemoryNodeCount();
public native int[] g1MemoryNodeIds();
// Parallel GC
public native long psVirtualSpaceAlignment();
public native long psHeapGenerationAlignment();
/**
* Enumerates old regions with liveness less than specified and produces some statistics
* @param liveness percent of region's liveness (live_objects / total_region_size * 100).
* @return long[3] array where long[0] - total count of old regions
* long[1] - total memory of old regions
* long[2] - lowest estimation of total memory of old regions to be freed (non-full
* regions are not included)
*/
public native long[] g1GetMixedGCInfo(int liveness);
// NMT
public native long NMTMalloc(long size);
public native void NMTFree(long mem);
public native long NMTReserveMemory(long size);
public native long NMTAttemptReserveMemoryAt(long addr, long size);
public native void NMTCommitMemory(long addr, long size);
public native void NMTUncommitMemory(long addr, long size);
public native void NMTReleaseMemory(long addr, long size);
public native long NMTMallocWithPseudoStack(long size, int index);
public native long NMTMallocWithPseudoStackAndType(long size, int index, int type);
public native int NMTGetHashSize();
public native long NMTNewArena(long initSize);
public native void NMTFreeArena(long arena);
public native void NMTArenaMalloc(long arena, long size);
// Compiler
public native boolean isC2OrJVMCIIncluded();
public native boolean isJVMCISupportedByGC();
public native int matchesMethod(Executable method, String pattern);
public native int matchesInline(Executable method, String pattern);
public native boolean shouldPrintAssembly(Executable method, int comp_level);
public native int deoptimizeFrames(boolean makeNotEntrant);
public native boolean isFrameDeoptimized(int depth);
public native void deoptimizeAll();
public boolean isMethodCompiled(Executable method) {
return isMethodCompiled(method, false /*not osr*/);
}
private native boolean isMethodCompiled0(Executable method, boolean isOsr);
public boolean isMethodCompiled(Executable method, boolean isOsr){
Objects.requireNonNull(method);
return isMethodCompiled0(method, isOsr);
}
public boolean isMethodCompilable(Executable method) {
return isMethodCompilable(method, -1 /*any*/);
}
public boolean isMethodCompilable(Executable method, int compLevel) {
return isMethodCompilable(method, compLevel, false /*not osr*/);
}
private native boolean isMethodCompilable0(Executable method, int compLevel, boolean isOsr);
public boolean isMethodCompilable(Executable method, int compLevel, boolean isOsr) {
Objects.requireNonNull(method);
return isMethodCompilable0(method, compLevel, isOsr);
}
private native boolean isMethodQueuedForCompilation0(Executable method);
public boolean isMethodQueuedForCompilation(Executable method) {
Objects.requireNonNull(method);
return isMethodQueuedForCompilation0(method);
}
// Determine if the compiler corresponding to the compilation level 'compLevel'
// and to the compilation context 'compilation_context' provides an intrinsic
// for the method 'method'. An intrinsic is available for method 'method' if:
// - the intrinsic is enabled (by using the appropriate command-line flag) and
// - the platform on which the VM is running provides the instructions necessary
// for the compiler to generate the intrinsic code.
//
// The compilation context is related to using the DisableIntrinsic flag on a
// per-method level, see hotspot/src/share/vm/compiler/abstractCompiler.hpp
// for more details.
public boolean isIntrinsicAvailable(Executable method,
Executable compilationContext,
int compLevel) {
Objects.requireNonNull(method);
return isIntrinsicAvailable0(method, compilationContext, compLevel);
}
// If usage of the DisableIntrinsic flag is not expected (or the usage can be ignored),
// use the below method that does not require the compilation context as argument.
public boolean isIntrinsicAvailable(Executable method, int compLevel) {
return isIntrinsicAvailable(method, null, compLevel);
}
private native boolean isIntrinsicAvailable0(Executable method,
Executable compilationContext,
int compLevel);
public int deoptimizeMethod(Executable method) {
return deoptimizeMethod(method, false /*not osr*/);
}
private native int deoptimizeMethod0(Executable method, boolean isOsr);
public int deoptimizeMethod(Executable method, boolean isOsr) {
Objects.requireNonNull(method);
return deoptimizeMethod0(method, isOsr);
}
public void makeMethodNotCompilable(Executable method) {
makeMethodNotCompilable(method, -1 /*any*/);
}
public void makeMethodNotCompilable(Executable method, int compLevel) {
makeMethodNotCompilable(method, compLevel, false /*not osr*/);
}
private native void makeMethodNotCompilable0(Executable method, int compLevel, boolean isOsr);
public void makeMethodNotCompilable(Executable method, int compLevel, boolean isOsr) {
Objects.requireNonNull(method);
makeMethodNotCompilable0(method, compLevel, isOsr);
}
public int getMethodCompilationLevel(Executable method) {
return getMethodCompilationLevel(method, false /*not osr*/);
}
private native int getMethodCompilationLevel0(Executable method, boolean isOsr);
public int getMethodCompilationLevel(Executable method, boolean isOsr) {
Objects.requireNonNull(method);
return getMethodCompilationLevel0(method, isOsr);
}
public int getMethodDecompileCount(Executable method) {
Objects.requireNonNull(method);
return getMethodDecompileCount0(method);
}
private native int getMethodDecompileCount0(Executable method);
// Get the total trap count of a method. If the trap count for a specific reason
// did overflow, this includes the overflow trap count of the method.
public int getMethodTrapCount(Executable method) {
Objects.requireNonNull(method);
return getMethodTrapCount0(method, null);
}
// Get the trap count of a method for a specific reason. If the trap count for
// that reason did overflow, this includes the overflow trap count of the method.
public int getMethodTrapCount(Executable method, String reason) {
Objects.requireNonNull(method);
return getMethodTrapCount0(method, reason);
}
private native int getMethodTrapCount0(Executable method, String reason);
// Get the total deopt count.
public int getDeoptCount() {
return getDeoptCount0(null, null);
}
// Get the deopt count for a specific reason and a specific action. If either
// one of 'reason' or 'action' is null, the method returns the sum of all
// deoptimizations with the specific 'action' or 'reason' respectively.
// If both arguments are null, the method returns the total deopt count.
public int getDeoptCount(String reason, String action) {
return getDeoptCount0(reason, action);
}
private native int getDeoptCount0(String reason, String action);
private native boolean testSetDontInlineMethod0(Executable method, boolean value);
public boolean testSetDontInlineMethod(Executable method, boolean value) {
Objects.requireNonNull(method);
return testSetDontInlineMethod0(method, value);
}
public int getCompileQueuesSize() {
return getCompileQueueSize(-1 /*any*/);
}
public native int getCompileQueueSize(int compLevel);
private native boolean testSetForceInlineMethod0(Executable method, boolean value);
public boolean testSetForceInlineMethod(Executable method, boolean value) {
Objects.requireNonNull(method);
return testSetForceInlineMethod0(method, value);
}
public boolean enqueueMethodForCompilation(Executable method, int compLevel) {
return enqueueMethodForCompilation(method, compLevel, -1 /*InvocationEntryBci*/);
}
private native boolean enqueueMethodForCompilation0(Executable method, int compLevel, int entry_bci);
public boolean enqueueMethodForCompilation(Executable method, int compLevel, int entry_bci) {
Objects.requireNonNull(method);
return enqueueMethodForCompilation0(method, compLevel, entry_bci);
}
private native boolean enqueueInitializerForCompilation0(Class<?> aClass, int compLevel);
public boolean enqueueInitializerForCompilation(Class<?> aClass, int compLevel) {
Objects.requireNonNull(aClass);
return enqueueInitializerForCompilation0(aClass, compLevel);
}
private native void clearMethodState0(Executable method);
public native void markMethodProfiled(Executable method);
public void clearMethodState(Executable method) {
Objects.requireNonNull(method);
clearMethodState0(method);
}
public native void lockCompilation();
public native void unlockCompilation();
private native int getMethodEntryBci0(Executable method);
public int getMethodEntryBci(Executable method) {
Objects.requireNonNull(method);
return getMethodEntryBci0(method);
}
private native Object[] getNMethod0(Executable method, boolean isOsr);
public Object[] getNMethod(Executable method, boolean isOsr) {
Objects.requireNonNull(method);
return getNMethod0(method, isOsr);
}
public native long allocateCodeBlob(int size, int type);
public long allocateCodeBlob(long size, int type) {
int intSize = (int) size;
if ((long) intSize != size || size < 0) {
throw new IllegalArgumentException(
"size argument has illegal value " + size);
}
return allocateCodeBlob( intSize, type);
}
public native void freeCodeBlob(long addr);
public native void forceNMethodSweep();
public native Object[] getCodeHeapEntries(int type);
public native int getCompilationActivityMode();
private native long getMethodData0(Executable method);
public long getMethodData(Executable method) {
Objects.requireNonNull(method);
return getMethodData0(method);
}
public native Object[] getCodeBlob(long addr);
private native void clearInlineCaches0(boolean preserve_static_stubs);
public void clearInlineCaches() {
clearInlineCaches0(false);
}
public void clearInlineCaches(boolean preserve_static_stubs) {
clearInlineCaches0(preserve_static_stubs);
}
// Intered strings
public native boolean isInStringTable(String str);
// Memory
public native void readReservedMemory();
public native long allocateMetaspace(ClassLoader classLoader, long size);
public native long incMetaspaceCapacityUntilGC(long increment);
public native long metaspaceCapacityUntilGC();
public native long metaspaceSharedRegionAlignment();
// Metaspace Arena Tests
public native long createMetaspaceTestContext(long commit_limit, long reserve_limit);
public native void destroyMetaspaceTestContext(long context);
public native void purgeMetaspaceTestContext(long context);
public native void printMetaspaceTestContext(long context);
public native long getTotalCommittedWordsInMetaspaceTestContext(long context);
public native long getTotalUsedWordsInMetaspaceTestContext(long context);
public native long createArenaInTestContext(long context, boolean is_micro);
public native void destroyMetaspaceTestArena(long arena);
public native long allocateFromMetaspaceTestArena(long arena, long word_size);
public native void deallocateToMetaspaceTestArena(long arena, long p, long word_size);
public native long maxMetaspaceAllocationSize();
// Don't use these methods directly
// Use sun.hotspot.gc.GC class instead.
public native boolean isGCSupported(int name);
public native boolean isGCSupportedByJVMCICompiler(int name);
public native boolean isGCSelected(int name);
public native boolean isGCSelectedErgonomically();
// Force Young GC
public native void youngGC();
// Force Full GC
public native void fullGC();
// Returns true if the current GC supports concurrent collection control.
public native boolean supportsConcurrentGCBreakpoints();
private void checkConcurrentGCBreakpointsSupported() {
if (!supportsConcurrentGCBreakpoints()) {
throw new UnsupportedOperationException("Concurrent GC breakpoints not supported");
}
}
private native void concurrentGCAcquireControl0();
private native void concurrentGCReleaseControl0();
private native void concurrentGCRunToIdle0();
private native boolean concurrentGCRunTo0(String breakpoint);
private static boolean concurrentGCIsControlled = false;
private void checkConcurrentGCIsControlled() {
if (!concurrentGCIsControlled) {
throw new IllegalStateException("Not controlling concurrent GC");
}
}
// All collectors supporting concurrent GC breakpoints are expected
// to provide at least the following breakpoints.
public final String AFTER_MARKING_STARTED = "AFTER MARKING STARTED";
public final String BEFORE_MARKING_COMPLETED = "BEFORE MARKING COMPLETED";
// Collectors supporting concurrent GC breakpoints that do reference
// processing concurrently should provide the following breakpoint.
public final String AFTER_CONCURRENT_REFERENCE_PROCESSING_STARTED =
"AFTER CONCURRENT REFERENCE PROCESSING STARTED";
// G1 specific GC breakpoints.
public final String G1_AFTER_REBUILD_STARTED = "AFTER REBUILD STARTED";
public final String G1_BEFORE_REBUILD_COMPLETED = "BEFORE REBUILD COMPLETED";
public final String G1_AFTER_CLEANUP_STARTED = "AFTER CLEANUP STARTED";
public final String G1_BEFORE_CLEANUP_COMPLETED = "BEFORE CLEANUP COMPLETED";
public void concurrentGCAcquireControl() {
checkConcurrentGCBreakpointsSupported();
if (concurrentGCIsControlled) {
throw new IllegalStateException("Already controlling concurrent GC");
}
concurrentGCAcquireControl0();
concurrentGCIsControlled = true;
}
public void concurrentGCReleaseControl() {
checkConcurrentGCBreakpointsSupported();
concurrentGCReleaseControl0();
concurrentGCIsControlled = false;
}
// Keep concurrent GC idle. Release from breakpoint.
public void concurrentGCRunToIdle() {
checkConcurrentGCBreakpointsSupported();
checkConcurrentGCIsControlled();
concurrentGCRunToIdle0();
}
// Allow concurrent GC to run to breakpoint.
// Throws IllegalStateException if reached end of cycle first.
public void concurrentGCRunTo(String breakpoint) {
concurrentGCRunTo(breakpoint, true);
}
// Allow concurrent GC to run to breakpoint.
// Returns true if reached breakpoint. If reached end of cycle first,
// then throws IllegalStateException if errorIfFail is true, returning
// false otherwise.
public boolean concurrentGCRunTo(String breakpoint, boolean errorIfFail) {
checkConcurrentGCBreakpointsSupported();
checkConcurrentGCIsControlled();
if (breakpoint == null) {
throw new NullPointerException("null breakpoint");
} else if (concurrentGCRunTo0(breakpoint)) {
return true;
} else if (errorIfFail) {
throw new IllegalStateException("Missed requested breakpoint \"" + breakpoint + "\"");
} else {
return false;
}
}
// Method tries to start concurrent mark cycle.
// It returns false if CM Thread is always in concurrent cycle.
public native boolean g1StartConcMarkCycle();
// Tests on ReservedSpace/VirtualSpace classes
public native int stressVirtualSpaceResize(long reservedSpaceSize, long magnitude, long iterations);
public native void readFromNoaccessArea();
public native long getThreadStackSize();
public native long getThreadRemainingStackSize();
// CPU features
public native String getCPUFeatures();
// VM flags
public native boolean isConstantVMFlag(String name);
public native boolean isLockedVMFlag(String name);
public native void setBooleanVMFlag(String name, boolean value);
public native void setIntVMFlag(String name, long value);
public native void setUintVMFlag(String name, long value);
public native void setIntxVMFlag(String name, long value);
public native void setUintxVMFlag(String name, long value);
public native void setUint64VMFlag(String name, long value);
public native void setSizeTVMFlag(String name, long value);
public native void setStringVMFlag(String name, String value);
public native void setDoubleVMFlag(String name, double value);
public native Boolean getBooleanVMFlag(String name);
public native Long getIntVMFlag(String name);
public native Long getUintVMFlag(String name);
public native Long getIntxVMFlag(String name);
public native Long getUintxVMFlag(String name);
public native Long getUint64VMFlag(String name);
public native Long getSizeTVMFlag(String name);
public native String getStringVMFlag(String name);
public native Double getDoubleVMFlag(String name);
private final List<Function<String,Object>> flagsGetters = Arrays.asList(
this::getBooleanVMFlag, this::getIntVMFlag, this::getUintVMFlag,
this::getIntxVMFlag, this::getUintxVMFlag, this::getUint64VMFlag,
this::getSizeTVMFlag, this::getStringVMFlag, this::getDoubleVMFlag);
public Object getVMFlag(String name) {
return flagsGetters.stream()
.map(f -> f.apply(name))
.filter(x -> x != null)
.findAny()
.orElse(null);
}
// Jigsaw
public native void DefineModule(Object module, boolean is_open, String version,
String location, Object[] packages);
public native void AddModuleExports(Object from_module, String pkg, Object to_module);
public native void AddReadsModule(Object from_module, Object source_module);
public native void AddModuleExportsToAllUnnamed(Object module, String pkg);
public native void AddModuleExportsToAll(Object module, String pkg);
public native int getCDSOffsetForName0(String name);
public int getCDSOffsetForName(String name) throws Exception {
int offset = getCDSOffsetForName0(name);
if (offset == -1) {
throw new RuntimeException(name + " not found");
}
return offset;
}
public native int getCDSConstantForName0(String name);
public int getCDSConstantForName(String name) throws Exception {
int constant = getCDSConstantForName0(name);
if (constant == -1) {
throw new RuntimeException(name + " not found");
}
return constant;
}
public native Boolean getMethodBooleanOption(Executable method, String name);
public native Long getMethodIntxOption(Executable method, String name);
public native Long getMethodUintxOption(Executable method, String name);
public native Double getMethodDoubleOption(Executable method, String name);
public native String getMethodStringOption(Executable method, String name);
private final List<BiFunction<Executable,String,Object>> methodOptionGetters
= Arrays.asList(this::getMethodBooleanOption, this::getMethodIntxOption,
this::getMethodUintxOption, this::getMethodDoubleOption,
this::getMethodStringOption);
public Object getMethodOption(Executable method, String name) {
return methodOptionGetters.stream()
.map(f -> f.apply(method, name))
.filter(x -> x != null)
.findAny()
.orElse(null);
}
// Sharing & archiving
public native int getCDSGenericHeaderMinVersion();
public native int getCurrentCDSVersion();
public native String getDefaultArchivePath();
public native boolean cdsMemoryMappingFailed();
public native boolean isSharingEnabled();
public native boolean isShared(Object o);
public native boolean isSharedClass(Class<?> c);
public native boolean areSharedStringsMapped();
public native boolean isSharedInternedString(String s);
public native boolean isCDSIncluded();
public native boolean isJFRIncluded();
public native boolean isDTraceIncluded();
public native boolean canWriteJavaHeapArchive();
public native Object getResolvedReferences(Class<?> c);
public native void linkClass(Class<?> c);
public native boolean areOpenArchiveHeapObjectsMapped();
// Compiler Directive
public native int addCompilerDirective(String compDirect);
public native void removeCompilerDirective(int count);
// Handshakes
public native int handshakeWalkStack(Thread t, boolean all_threads);
public native boolean handshakeReadMonitors(Thread t);
public native void asyncHandshakeWalkStack(Thread t);
public native void lockAndBlock(boolean suspender);
// Returns true on linux if library has the noexecstack flag set.
public native boolean checkLibSpecifiesNoexecstack(String libfilename);
// Container testing
public native boolean isContainerized();
public native int validateCgroup(String procCgroups,
String procSelfCgroup,
String procSelfMountinfo);
public native void printOsInfo();
// Decoder
public native void disableElfSectionCache();
// Resolved Method Table
public native long resolvedMethodItemsCount();
// Protection Domain Table
public native int protectionDomainRemovedCount();
public native int getKlassMetadataSize(Class<?> c);
// ThreadSMR GC safety check for threadObj
public native void checkThreadObjOfTerminatingThread(Thread target);
// libc name
public native String getLibcName();
// Walk stack frames of current thread
public native void verifyFrames(boolean log, boolean updateRegisterMap);
public native boolean isJVMTIIncluded();
public native void waitUnsafe(int time_ms);
public native void lockCritical();
public native void unlockCritical();
}

View File

@ -1,108 +0,0 @@
/*
* Copyright (c) 2014, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package sun.hotspot.code;
import java.lang.management.ManagementFactory;
import java.lang.management.MemoryPoolMXBean;
import java.util.EnumSet;
import jdk.test.whitebox.WhiteBox;
public enum BlobType {
// Execution level 1 and 4 (non-profiled) nmethods (including native nmethods)
MethodNonProfiled(0, "CodeHeap 'non-profiled nmethods'", "NonProfiledCodeHeapSize") {
@Override
public boolean allowTypeWhenOverflow(BlobType type) {
return super.allowTypeWhenOverflow(type)
|| type == BlobType.MethodProfiled;
}
},
// Execution level 2 and 3 (profiled) nmethods
MethodProfiled(1, "CodeHeap 'profiled nmethods'", "ProfiledCodeHeapSize") {
@Override
public boolean allowTypeWhenOverflow(BlobType type) {
return super.allowTypeWhenOverflow(type)
|| type == BlobType.MethodNonProfiled;
}
},
// Non-nmethods like Buffers, Adapters and Runtime Stubs
NonNMethod(2, "CodeHeap 'non-nmethods'", "NonNMethodCodeHeapSize") {
@Override
public boolean allowTypeWhenOverflow(BlobType type) {
return super.allowTypeWhenOverflow(type)
|| type == BlobType.MethodNonProfiled
|| type == BlobType.MethodProfiled;
}
},
// All types (No code cache segmentation)
All(3, "CodeCache", "ReservedCodeCacheSize");
public final int id;
public final String sizeOptionName;
public final String beanName;
private BlobType(int id, String beanName, String sizeOptionName) {
this.id = id;
this.beanName = beanName;
this.sizeOptionName = sizeOptionName;
}
public MemoryPoolMXBean getMemoryPool() {
for (MemoryPoolMXBean bean : ManagementFactory.getMemoryPoolMXBeans()) {
String name = bean.getName();
if (beanName.equals(name)) {
return bean;
}
}
return null;
}
public boolean allowTypeWhenOverflow(BlobType type) {
return type == this;
}
public static EnumSet<BlobType> getAvailable() {
WhiteBox whiteBox = WhiteBox.getWhiteBox();
if (!whiteBox.getBooleanVMFlag("SegmentedCodeCache")) {
// only All for non segmented world
return EnumSet.of(All);
}
if (System.getProperty("java.vm.info").startsWith("interpreted ")) {
// only NonNMethod for -Xint
return EnumSet.of(NonNMethod);
}
EnumSet<BlobType> result = EnumSet.complementOf(EnumSet.of(All));
if (!whiteBox.getBooleanVMFlag("TieredCompilation")
|| whiteBox.getIntxVMFlag("TieredStopAtLevel") <= 1) {
// there is no MethodProfiled in non tiered world or pure C1
result.remove(MethodProfiled);
}
return result;
}
public long getSize() {
return WhiteBox.getWhiteBox().getUintxVMFlag(sizeOptionName);
}
}

View File

@ -1,71 +0,0 @@
/*
* Copyright (c) 2014, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package sun.hotspot.code;
import jdk.test.whitebox.WhiteBox;
@Deprecated
public class CodeBlob {
private static final WhiteBox WB = WhiteBox.getWhiteBox();
public static CodeBlob[] getCodeBlobs(BlobType type) {
Object[] obj = WB.getCodeHeapEntries(type.id);
if (obj == null) {
return null;
}
CodeBlob[] result = new CodeBlob[obj.length];
for (int i = 0, n = result.length; i < n; ++i) {
result[i] = new CodeBlob((Object[]) obj[i]);
}
return result;
}
public static CodeBlob getCodeBlob(long addr) {
Object[] obj = WB.getCodeBlob(addr);
if (obj == null) {
return null;
}
return new CodeBlob(obj);
}
protected CodeBlob(Object[] obj) {
assert obj.length == 4;
name = (String) obj[0];
size = (Integer) obj[1];
int blob_type_index = (Integer) obj[2];
code_blob_type = BlobType.values()[blob_type_index];
assert code_blob_type.id == (Integer) obj[2];
address = (Long) obj[3];
}
public final String name;
public final int size;
public final BlobType code_blob_type;
public final long address;
@Override
public String toString() {
return "CodeBlob{"
+ "name=" + name
+ ", size=" + size
+ ", code_blob_type=" + code_blob_type
+ ", address=" + address
+ '}';
}
}

View File

@ -1,171 +0,0 @@
/*
* Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package sun.hotspot.code;
import java.lang.reflect.Executable;
import jdk.test.whitebox.WhiteBox;
/**
* API to obtain information about enabled JIT compilers
* retrieved from the VM with the WhiteBox API.
*/
public class Compiler {
private static final WhiteBox WB = WhiteBox.getWhiteBox();
/**
* Check if C2 or JVMCI were included in the VM build
*
* @return true if either C2 or JVMCI were included in the VM build.
*/
public static boolean isC2OrJVMCIIncluded() {
return WB.isC2OrJVMCIIncluded();
}
/**
* Check if JVMCI is enabled.
*
* @return true if JVMCI is enabled
*/
public static boolean isJVMCIEnabled() {
Boolean enableJvmci = WB.getBooleanVMFlag("EnableJVMCI");
if (enableJvmci == null || !enableJvmci) {
return false;
}
return true;
}
/**
* Check if Graal is used as JIT compiler.
*
* Graal is enabled if following conditions are true:
* - we are not in Interpreter mode
* - UseJVMCICompiler flag is true
* - jvmci.Compiler variable is equal to 'graal'
* - TieredCompilation is not used or TieredStopAtLevel is greater than 3
* No need to check client mode because it set UseJVMCICompiler to false.
*
* @return true if Graal is used as JIT compiler.
*/
public static boolean isGraalEnabled() {
Boolean useCompiler = WB.getBooleanVMFlag("UseCompiler");
if (useCompiler == null || !useCompiler) {
return false;
}
Boolean useJvmciComp = WB.getBooleanVMFlag("UseJVMCICompiler");
if (useJvmciComp == null || !useJvmciComp) {
return false;
}
Boolean tieredCompilation = WB.getBooleanVMFlag("TieredCompilation");
Long compLevel = WB.getIntxVMFlag("TieredStopAtLevel");
// if TieredCompilation is enabled and compilation level is <= 3 then no Graal is used
if (tieredCompilation != null && tieredCompilation &&
compLevel != null && compLevel <= 3) {
return false;
}
return true;
}
/**
* Check if C2 is used as JIT compiler.
*
* C2 is enabled if following conditions are true:
* - we are not in Interpreter mode
* - we are in Server compilation mode
* - TieredCompilation is not used or TieredStopAtLevel is greater than 3
* - Graal is not used
*
* @return true if C2 is used as JIT compiler.
*/
public static boolean isC2Enabled() {
Boolean useCompiler = WB.getBooleanVMFlag("UseCompiler");
if (useCompiler == null || !useCompiler) {
return false;
}
Boolean serverMode = WB.getBooleanVMFlag("ProfileInterpreter");
if (serverMode == null || !serverMode) {
return false;
}
Boolean tieredCompilation = WB.getBooleanVMFlag("TieredCompilation");
Long compLevel = WB.getIntxVMFlag("TieredStopAtLevel");
// if TieredCompilation is enabled and compilation level is <= 3 then no Graal is used
if (tieredCompilation != null && tieredCompilation &&
compLevel != null && compLevel <= 3) {
return false;
}
if (isGraalEnabled()) {
return false;
}
return true;
}
/*
* Check if C1 is used as JIT compiler.
*
* C1 is enabled if following conditions are true:
* - we are not in Interpreter mode
* - we are not in Server compilation mode
* - TieredCompilation is used in Server mode
*
* @return true if C1 is used as JIT compiler.
*/
public static boolean isC1Enabled() {
Boolean useCompiler = WB.getBooleanVMFlag("UseCompiler");
if (useCompiler == null || !useCompiler) {
return false;
}
Boolean serverMode = WB.getBooleanVMFlag("ProfileInterpreter");
if (serverMode == null || !serverMode) {
return true; // Client mode
}
Boolean tieredCompilation = WB.getBooleanVMFlag("TieredCompilation");
// C1 is not used in server mode if TieredCompilation is off.
if (tieredCompilation != null && !tieredCompilation) {
return false;
}
return true;
}
/*
* Determine if the compiler corresponding to the compilation level 'compLevel'
* provides an intrinsic for 'class'.'method'.
*/
public static boolean isIntrinsicAvailable(int compLevel, String klass, String method, Class<?>... parameterTypes) {
Executable intrinsicMethod;
try {
intrinsicMethod = Class.forName(klass).getDeclaredMethod(method, parameterTypes);
} catch (NoSuchMethodException e) {
throw new RuntimeException("Test bug, '" + method + "' method unavailable. " + e);
} catch (ClassNotFoundException e) {
throw new RuntimeException("Test bug, '" + klass + "' class unavailable. " + e);
}
return WB.isIntrinsicAvailable(intrinsicMethod, compLevel);
}
}

View File

@ -1,59 +0,0 @@
/*
* Copyright (c) 2014, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package sun.hotspot.code;
import java.lang.reflect.Executable;
import jdk.test.whitebox.WhiteBox;
@Deprecated
public class NMethod extends CodeBlob {
private static final WhiteBox wb = WhiteBox.getWhiteBox();
public static NMethod get(Executable method, boolean isOsr) {
Object[] obj = wb.getNMethod(method, isOsr);
return obj == null ? null : new NMethod(obj);
}
private NMethod(Object[] obj) {
super((Object[])obj[0]);
assert obj.length == 5;
comp_level = (Integer) obj[1];
insts = (byte[]) obj[2];
compile_id = (Integer) obj[3];
entry_point = (Long) obj[4];
}
public final byte[] insts;
public final int comp_level;
public final int compile_id;
public final long entry_point;
@Override
public String toString() {
return "NMethod{"
+ super.toString()
+ ", insts=" + insts
+ ", comp_level=" + comp_level
+ ", compile_id=" + compile_id
+ ", entry_point=" + entry_point
+ '}';
}
}

View File

@ -1,97 +0,0 @@
/*
* Copyright (c) 2014, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package sun.hotspot.cpuinfo;
import java.util.List;
import java.util.Arrays;
import java.util.Collections;
import java.util.regex.Pattern;
import java.util.regex.Matcher;
import jdk.test.whitebox.WhiteBox;
/**
* Information about CPU on test box.
*
* CPUInfo uses WhiteBox to gather information,
* so WhiteBox class should be added to bootclasspath
* and option -XX:+WhiteBoxAPI should be explicitly
* specified on command line.
*/
@Deprecated
public class CPUInfo {
private static final List<String> features;
private static final String additionalCPUInfo;
static {
WhiteBox wb = WhiteBox.getWhiteBox();
Pattern additionalCPUInfoRE =
Pattern.compile("([^(]*\\([^)]*\\)[^,]*),\\s*");
String cpuFeaturesString = wb.getCPUFeatures();
Matcher matcher = additionalCPUInfoRE.matcher(cpuFeaturesString);
if (matcher.find()) {
additionalCPUInfo = matcher.group(1);
} else {
additionalCPUInfo = "";
}
String splittedFeatures[] = matcher.replaceAll("").split("(, )| ");
features = Collections.unmodifiableList(Arrays.
asList(splittedFeatures));
}
/**
* Get additional information about CPU.
* For example, on X86 in will be family/model/stepping
* and number of cores.
*
* @return additional CPU info
*/
public static String getAdditionalCPUInfo() {
return additionalCPUInfo;
}
/**
* Get all known features supported by CPU.
*
* @return unmodifiable list with names of all known features
* supported by CPU.
*/
public static List<String> getFeatures() {
return features;
}
/**
* Check if some feature is supported by CPU.
*
* @param feature Name of feature to be tested.
* @return <b>true</b> if tested feature is supported by CPU.
*/
public static boolean hasFeature(String feature) {
return features.contains(feature.toLowerCase());
}
}

View File

@ -1,91 +0,0 @@
/*
* Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package sun.hotspot.gc;
import jdk.test.whitebox.WhiteBox;
/**
* API to obtain information about selected and supported Garbage Collectors
* retrieved from the VM with the WhiteBox API.
*/
public enum GC {
/*
* Enum values must match CollectedHeap::Name
*/
Serial(1),
Parallel(2),
G1(3),
Epsilon(4),
Z(5),
Shenandoah(6);
private static final WhiteBox WB = WhiteBox.getWhiteBox();
private final int name;
private GC(int name) {
this.name = name;
}
/**
* @return true if this GC is supported by the VM, i.e., it is built into the VM.
*/
public boolean isSupported() {
return WB.isGCSupported(name);
}
/**
* @return true if this GC is supported by the JVMCI compiler
*/
public boolean isSupportedByJVMCICompiler() {
return WB.isGCSupportedByJVMCICompiler(name);
}
/**
* @return true if this GC is currently selected/used
*/
public boolean isSelected() {
return WB.isGCSelected(name);
}
/**
* @return true if GC was selected ergonomically, as opposed
* to being explicitly specified on the command line
*/
public static boolean isSelectedErgonomically() {
return WB.isGCSelectedErgonomically();
}
/**
* @return the selected GC.
*/
public static GC selected() {
for (GC gc : values()) {
if (gc.isSelected()) {
return gc;
}
}
throw new IllegalStateException("No selected GC found");
}
}