32 * @modules java.base/jdk.internal.org.objectweb.asm
33 * java.base/jdk.internal.org.objectweb.asm.tree
34 * jdk.vm.ci/jdk.vm.ci.hotspot
35 * jdk.vm.ci/jdk.vm.ci.code
36 * jdk.vm.ci/jdk.vm.ci.runtime
37 * @ignore 8139700
38 * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper
39 * @build compiler.jvmci.compilerToVM.InvalidateInstalledCodeTest
40 * @build sun.hotspot.WhiteBox
41 * @run main ClassFileInstaller sun.hotspot.WhiteBox
42 * sun.hotspot.WhiteBox$WhiteBoxPermission
43 * @run main/othervm -Xbootclasspath/a:.
44 * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
45 * -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI
46 * compiler.jvmci.compilerToVM.InvalidateInstalledCodeTest
47 */
48
49 package compiler.jvmci.compilerToVM;
50
51 import compiler.jvmci.common.CTVMUtilities;
52 import jdk.vm.ci.code.InstalledCode;
53 import jdk.vm.ci.hotspot.CompilerToVMHelper;
54 import jdk.test.lib.Asserts;
55 import jdk.test.lib.Utils;
56 import sun.hotspot.code.NMethod;
57
58 import java.util.List;
59 import jdk.vm.ci.code.CodeCacheProvider;
60 import jdk.vm.ci.code.CompilationResult;
61 import jdk.vm.ci.hotspot.HotSpotCompilationRequest;
62 import jdk.vm.ci.hotspot.HotSpotJVMCIRuntime;
63 import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod;
64
65 public class InvalidateInstalledCodeTest {
66 private static final CodeCacheProvider CACHE_PROVIDER
67 = HotSpotJVMCIRuntime.runtime().getHostJVMCIBackend()
68 .getCodeCache();
69
70 public static void main(String[] args) {
71 InvalidateInstalledCodeTest test
72 = new InvalidateInstalledCodeTest();
73 List<CompileCodeTestCase> testCases
74 = CompileCodeTestCase.generate(/* bci = */ 0);
75 testCases.addAll(CompileCodeTestCase.generate(/* bci = */ -1));
76 testCases.forEach(test::check);
77 test.checkNull();
78 }
79
80 private void checkNull() {
81 Utils.runAndCheckException(
82 () -> CompilerToVMHelper.invalidateInstalledCode(null),
83 NullPointerException.class);
84 }
|
32 * @modules java.base/jdk.internal.org.objectweb.asm
33 * java.base/jdk.internal.org.objectweb.asm.tree
34 * jdk.vm.ci/jdk.vm.ci.hotspot
35 * jdk.vm.ci/jdk.vm.ci.code
36 * jdk.vm.ci/jdk.vm.ci.runtime
37 * @ignore 8139700
38 * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper
39 * @build compiler.jvmci.compilerToVM.InvalidateInstalledCodeTest
40 * @build sun.hotspot.WhiteBox
41 * @run main ClassFileInstaller sun.hotspot.WhiteBox
42 * sun.hotspot.WhiteBox$WhiteBoxPermission
43 * @run main/othervm -Xbootclasspath/a:.
44 * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
45 * -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI
46 * compiler.jvmci.compilerToVM.InvalidateInstalledCodeTest
47 */
48
49 package compiler.jvmci.compilerToVM;
50
51 import compiler.jvmci.common.CTVMUtilities;
52 import jdk.test.lib.Asserts;
53 import jdk.test.lib.Utils;
54 import jdk.vm.ci.code.CodeCacheProvider;
55 import jdk.vm.ci.code.CompilationResult;
56 import jdk.vm.ci.code.InstalledCode;
57 import jdk.vm.ci.hotspot.CompilerToVMHelper;
58 import jdk.vm.ci.hotspot.HotSpotCompilationRequest;
59 import jdk.vm.ci.hotspot.HotSpotJVMCIRuntime;
60 import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod;
61 import sun.hotspot.code.NMethod;
62
63 import java.util.List;
64
65 public class InvalidateInstalledCodeTest {
66 private static final CodeCacheProvider CACHE_PROVIDER
67 = HotSpotJVMCIRuntime.runtime().getHostJVMCIBackend()
68 .getCodeCache();
69
70 public static void main(String[] args) {
71 InvalidateInstalledCodeTest test
72 = new InvalidateInstalledCodeTest();
73 List<CompileCodeTestCase> testCases
74 = CompileCodeTestCase.generate(/* bci = */ 0);
75 testCases.addAll(CompileCodeTestCase.generate(/* bci = */ -1));
76 testCases.forEach(test::check);
77 test.checkNull();
78 }
79
80 private void checkNull() {
81 Utils.runAndCheckException(
82 () -> CompilerToVMHelper.invalidateInstalledCode(null),
83 NullPointerException.class);
84 }
|