use of jdk.vm.ci.hotspot.VMIntrinsicMethod in project graal by oracle.
the class CheckGraalIntrinsics method test.
@Test
@SuppressWarnings("try")
public void test() throws ClassNotFoundException {
HotSpotGraalRuntimeProvider rt = (HotSpotGraalRuntimeProvider) Graal.getRequiredCapability(RuntimeProvider.class);
HotSpotProviders providers = rt.getHostBackend().getProviders();
Plugins graphBuilderPlugins = providers.getGraphBuilderPlugins();
InvocationPlugins invocationPlugins = graphBuilderPlugins.getInvocationPlugins();
HotSpotVMConfigStore store = rt.getVMConfig().getStore();
List<VMIntrinsicMethod> intrinsics = store.getIntrinsics();
List<String> missing = new ArrayList<>();
EconomicMap<String, List<Binding>> bindings = invocationPlugins.getBindings(true);
for (VMIntrinsicMethod intrinsic : intrinsics) {
InvocationPlugin plugin = findPlugin(bindings, intrinsic);
if (plugin == null) {
ResolvedJavaMethod method = resolveIntrinsic(providers.getMetaAccess(), intrinsic);
if (method != null) {
IntrinsicMethod intrinsicMethod = providers.getConstantReflection().getMethodHandleAccess().lookupMethodHandleIntrinsic(method);
if (intrinsicMethod != null) {
continue;
}
}
String m = String.format("%s.%s%s", intrinsic.declaringClass, intrinsic.name, intrinsic.descriptor);
if (!TO_BE_INVESTIGATED.contains(m) && !IGNORE.contains(m)) {
missing.add(m);
}
}
}
if (!missing.isEmpty()) {
Collections.sort(missing);
String missingString = missing.stream().collect(Collectors.joining(String.format("%n ")));
fail("missing Graal intrinsics for:%n %s", missingString);
}
}
use of jdk.vm.ci.hotspot.VMIntrinsicMethod in project graal by oracle.
the class TestIntrinsicCompiles method test.
@Test
@SuppressWarnings("try")
public void test() throws ClassNotFoundException {
HotSpotGraalCompiler compiler = (HotSpotGraalCompiler) JVMCI.getRuntime().getCompiler();
HotSpotGraalRuntimeProvider rt = (HotSpotGraalRuntimeProvider) Graal.getRequiredCapability(RuntimeProvider.class);
HotSpotProviders providers = rt.getHostBackend().getProviders();
Plugins graphBuilderPlugins = providers.getGraphBuilderPlugins();
InvocationPlugins invocationPlugins = graphBuilderPlugins.getInvocationPlugins();
EconomicMap<String, List<Binding>> bindings = invocationPlugins.getBindings(true);
HotSpotVMConfigStore store = rt.getVMConfig().getStore();
List<VMIntrinsicMethod> intrinsics = store.getIntrinsics();
OptionValues options = getInitialOptions();
DebugContext debug = getDebugContext(options);
for (VMIntrinsicMethod intrinsic : intrinsics) {
InvocationPlugin plugin = CheckGraalIntrinsics.findPlugin(bindings, intrinsic);
if (plugin != null) {
if (plugin instanceof MethodSubstitutionPlugin) {
ResolvedJavaMethod method = CheckGraalIntrinsics.resolveIntrinsic(getMetaAccess(), intrinsic);
if (!method.isNative()) {
StructuredGraph graph = compiler.getIntrinsicGraph(method, providers, INVALID_COMPILATION_ID, options, debug);
getCode(method, graph);
}
}
}
}
}
Aggregations