21 * questions.
22 */
23
24 /*
25 * @test
26 * @bug 8136421
27 * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64")
28 * @library / /test/lib
29 * @library ../common/patches
30 * @modules java.base/jdk.internal.misc
31 * @modules java.base/jdk.internal.org.objectweb.asm
32 * java.base/jdk.internal.org.objectweb.asm.tree
33 * jdk.vm.ci/jdk.vm.ci.hotspot
34 * jdk.vm.ci/jdk.vm.ci.code
35 * jdk.vm.ci/jdk.vm.ci.code.site
36 * jdk.vm.ci/jdk.vm.ci.meta
37 * jdk.vm.ci/jdk.vm.ci.runtime
38 *
39 * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper
40 * @build compiler.jvmci.common.JVMCIHelpers
41 * @run driver jdk.test.lib.FileInstaller ../common/services/ ./META-INF/services/
42 * @run driver jdk.test.lib.FileInstaller ./JvmciNotifyInstallEventTest.config
43 * ./META-INF/services/jdk.vm.ci.hotspot.services.HotSpotVMEventListener
44 * @run driver ClassFileInstaller
45 * compiler.jvmci.common.JVMCIHelpers$EmptyHotspotCompiler
46 * compiler.jvmci.common.JVMCIHelpers$EmptyCompilerFactory
47 * compiler.jvmci.common.JVMCIHelpers$EmptyCompilationRequestResult
48 * compiler.jvmci.common.JVMCIHelpers$EmptyVMEventListener
49 * @run main/othervm -XX:+UnlockExperimentalVMOptions
50 * -Xbootclasspath/a:. -Xmixed
51 * -XX:+UseJVMCICompiler -XX:-BootstrapJVMCI
52 * -Dcompiler.jvmci.events.JvmciNotifyInstallEventTest.failoninit=false
53 * compiler.jvmci.events.JvmciNotifyInstallEventTest
54 * @run main/othervm -XX:+UnlockExperimentalVMOptions
55 * -Djvmci.compiler=EmptyCompiler -Xbootclasspath/a:. -Xmixed
56 * -XX:+UseJVMCICompiler -XX:-BootstrapJVMCI
57 * -Dcompiler.jvmci.events.JvmciNotifyInstallEventTest.failoninit=false
58 * compiler.jvmci.events.JvmciNotifyInstallEventTest
59 * @run main/othervm -XX:+UnlockExperimentalVMOptions
60 * -Djvmci.compiler=EmptyCompiler -Xbootclasspath/a:. -Xmixed
61 * -XX:+UseJVMCICompiler -XX:-BootstrapJVMCI -XX:JVMCINMethodSizeLimit=0
62 * -Dcompiler.jvmci.events.JvmciNotifyInstallEventTest.failoninit=false
63 * compiler.jvmci.events.JvmciNotifyInstallEventTest
64 * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:-EnableJVMCI
65 * -Djvmci.compiler=EmptyCompiler -Xbootclasspath/a:. -Xmixed
66 * -Dcompiler.jvmci.events.JvmciNotifyInstallEventTest.failoninit=true
67 * compiler.jvmci.events.JvmciNotifyInstallEventTest
68 */
69
70 package compiler.jvmci.events;
71
72 import compiler.jvmci.common.CTVMUtilities;
73 import compiler.jvmci.common.testcases.SimpleClass;
74 import jdk.test.lib.Asserts;
75 import jdk.test.lib.Utils;
76 import jdk.vm.ci.code.CompiledCode;
77 import jdk.vm.ci.code.InstalledCode;
78 import jdk.vm.ci.code.site.DataPatch;
79 import jdk.vm.ci.code.site.Site;
80 import jdk.vm.ci.hotspot.HotSpotCodeCacheProvider;
81 import jdk.vm.ci.hotspot.HotSpotCompiledCode;
82 import jdk.vm.ci.hotspot.HotSpotCompiledCode.Comment;
83 import jdk.vm.ci.hotspot.HotSpotJVMCIRuntime;
84 import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod;
85 import jdk.vm.ci.hotspot.services.HotSpotVMEventListener;
86 import jdk.vm.ci.meta.Assumptions.Assumption;
87 import jdk.vm.ci.meta.ResolvedJavaMethod;
88
89 import java.lang.reflect.Method;
90
91 public class JvmciNotifyInstallEventTest extends HotSpotVMEventListener {
92 private static final String METHOD_NAME = "testMethod";
93 private static final boolean FAIL_ON_INIT = !Boolean.getBoolean(
94 "compiler.jvmci.events.JvmciNotifyInstallEventTest.failoninit");
95 private static volatile int gotInstallNotification = 0;
96
97 public static void main(String args[]) {
98 new JvmciNotifyInstallEventTest().runTest();
99 }
100
101 private void runTest() {
102 if (gotInstallNotification != 0) {
103 throw new Error("Got install notification before test actions");
104 }
105 HotSpotCodeCacheProvider codeCache;
106 try {
107 codeCache = (HotSpotCodeCacheProvider) HotSpotJVMCIRuntime.runtime()
108 .getHostJVMCIBackend().getCodeCache();
109 } catch (InternalError ie) {
110 if (FAIL_ON_INIT) {
111 throw new AssertionError(
112 "Got unexpected InternalError trying to get code cache",
113 ie);
114 }
115 // passed
116 return;
117 }
118 Asserts.assertTrue(FAIL_ON_INIT,
119 "Haven't caught InternalError in negative case");
120 Method testMethod;
|
21 * questions.
22 */
23
24 /*
25 * @test
26 * @bug 8136421
27 * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64")
28 * @library / /test/lib
29 * @library ../common/patches
30 * @modules java.base/jdk.internal.misc
31 * @modules java.base/jdk.internal.org.objectweb.asm
32 * java.base/jdk.internal.org.objectweb.asm.tree
33 * jdk.vm.ci/jdk.vm.ci.hotspot
34 * jdk.vm.ci/jdk.vm.ci.code
35 * jdk.vm.ci/jdk.vm.ci.code.site
36 * jdk.vm.ci/jdk.vm.ci.meta
37 * jdk.vm.ci/jdk.vm.ci.runtime
38 *
39 * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper
40 * @build compiler.jvmci.common.JVMCIHelpers
41 * @run driver jdk.test.lib.FileInstaller ./JvmciNotifyInstallEventTest.config
42 * ./META-INF/services/jdk.vm.ci.services.JVMCIServiceLocator
43 * @run driver ClassFileInstaller
44 * compiler.jvmci.common.JVMCIHelpers$EmptyHotspotCompiler
45 * compiler.jvmci.common.JVMCIHelpers$EmptyCompilerFactory
46 * compiler.jvmci.common.JVMCIHelpers$EmptyCompilationRequestResult
47 * compiler.jvmci.common.JVMCIHelpers$EmptyVMEventListener
48 * @run main/othervm -XX:+UnlockExperimentalVMOptions
49 * -Xbootclasspath/a:. -Xmixed
50 * -XX:+UseJVMCICompiler -XX:-BootstrapJVMCI
51 * -Dcompiler.jvmci.events.JvmciNotifyInstallEventTest.failoninit=false
52 * compiler.jvmci.events.JvmciNotifyInstallEventTest
53 * @run main/othervm -XX:+UnlockExperimentalVMOptions
54 * -Djvmci.compiler=EmptyCompiler -Xbootclasspath/a:. -Xmixed
55 * -XX:+UseJVMCICompiler -XX:-BootstrapJVMCI
56 * -Dcompiler.jvmci.events.JvmciNotifyInstallEventTest.failoninit=false
57 * compiler.jvmci.events.JvmciNotifyInstallEventTest
58 * @run main/othervm -XX:+UnlockExperimentalVMOptions
59 * -Djvmci.compiler=EmptyCompiler -Xbootclasspath/a:. -Xmixed
60 * -XX:+UseJVMCICompiler -XX:-BootstrapJVMCI -XX:JVMCINMethodSizeLimit=0
61 * -Dcompiler.jvmci.events.JvmciNotifyInstallEventTest.failoninit=false
62 * compiler.jvmci.events.JvmciNotifyInstallEventTest
63 * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:-EnableJVMCI
64 * -Djvmci.compiler=EmptyCompiler -Xbootclasspath/a:. -Xmixed
65 * -Dcompiler.jvmci.events.JvmciNotifyInstallEventTest.failoninit=true
66 * compiler.jvmci.events.JvmciNotifyInstallEventTest
67 */
68
69 package compiler.jvmci.events;
70
71 import compiler.jvmci.common.CTVMUtilities;
72 import compiler.jvmci.common.testcases.SimpleClass;
73 import jdk.test.lib.Asserts;
74 import jdk.test.lib.Utils;
75 import jdk.vm.ci.services.JVMCIServiceLocator;
76 import jdk.vm.ci.code.CompiledCode;
77 import jdk.vm.ci.code.InstalledCode;
78 import jdk.vm.ci.code.site.DataPatch;
79 import jdk.vm.ci.code.site.Site;
80 import jdk.vm.ci.hotspot.HotSpotCodeCacheProvider;
81 import jdk.vm.ci.hotspot.HotSpotCompiledCode;
82 import jdk.vm.ci.hotspot.HotSpotCompiledCode.Comment;
83 import jdk.vm.ci.hotspot.HotSpotJVMCIRuntime;
84 import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod;
85 import jdk.vm.ci.hotspot.HotSpotVMEventListener;
86 import jdk.vm.ci.meta.Assumptions.Assumption;
87 import jdk.vm.ci.meta.ResolvedJavaMethod;
88
89 import java.lang.reflect.Method;
90
91 public class JvmciNotifyInstallEventTest extends JVMCIServiceLocator implements HotSpotVMEventListener {
92 private static final String METHOD_NAME = "testMethod";
93 private static final boolean FAIL_ON_INIT = !Boolean.getBoolean(
94 "compiler.jvmci.events.JvmciNotifyInstallEventTest.failoninit");
95 private static volatile int gotInstallNotification = 0;
96
97 public static void main(String args[]) {
98 new JvmciNotifyInstallEventTest().runTest();
99 }
100
101 @Override
102 public <S> S getProvider(Class<S> service) {
103 if (service == HotSpotVMEventListener.class) {
104 return service.cast(this);
105 }
106 return null;
107 }
108
109 private void runTest() {
110 if (gotInstallNotification != 0) {
111 throw new Error("Got install notification before test actions");
112 }
113 HotSpotCodeCacheProvider codeCache;
114 try {
115 codeCache = (HotSpotCodeCacheProvider) HotSpotJVMCIRuntime.runtime()
116 .getHostJVMCIBackend().getCodeCache();
117 } catch (InternalError ie) {
118 if (FAIL_ON_INIT) {
119 throw new AssertionError(
120 "Got unexpected InternalError trying to get code cache",
121 ie);
122 }
123 // passed
124 return;
125 }
126 Asserts.assertTrue(FAIL_ON_INIT,
127 "Haven't caught InternalError in negative case");
128 Method testMethod;
|