Search in sources :

Example 16 with Plugins

use of org.graalvm.compiler.nodes.graphbuilderconf.GraphBuilderConfiguration.Plugins in project graal by oracle.

the class ReplaceConstantNodesPhaseTest method getDefaultGraphBuilderPlugins.

@Override
protected Plugins getDefaultGraphBuilderPlugins() {
    Plugins plugins = super.getDefaultGraphBuilderPlugins();
    plugins.setClassInitializationPlugin(new HotSpotClassInitializationPlugin());
    return plugins;
}
Also used : HotSpotClassInitializationPlugin(org.graalvm.compiler.hotspot.meta.HotSpotClassInitializationPlugin) Plugins(org.graalvm.compiler.nodes.graphbuilderconf.GraphBuilderConfiguration.Plugins)

Example 17 with Plugins

use of org.graalvm.compiler.nodes.graphbuilderconf.GraphBuilderConfiguration.Plugins in project graal by oracle.

the class SPARCHotSpotBackendFactory method createGraphBuilderPlugins.

protected Plugins createGraphBuilderPlugins(CompilerConfiguration compilerConfiguration, GraalHotSpotVMConfig config, HotSpotMetaAccessProvider metaAccess, HotSpotConstantReflectionProvider constantReflection, HotSpotForeignCallsProvider foreignCalls, LoweringProvider lowerer, HotSpotStampProvider stampProvider, HotSpotSnippetReflectionProvider snippetReflection, HotSpotReplacementsImpl replacements, HotSpotWordTypes wordTypes) {
    Plugins plugins = HotSpotGraphBuilderPlugins.create(compilerConfiguration, config, wordTypes, metaAccess, constantReflection, snippetReflection, foreignCalls, lowerer, stampProvider, replacements);
    SPARCGraphBuilderPlugins.register(plugins, replacements.getDefaultReplacementBytecodeProvider());
    return plugins;
}
Also used : SPARCGraphBuilderPlugins(org.graalvm.compiler.replacements.sparc.SPARCGraphBuilderPlugins) HotSpotGraphBuilderPlugins(org.graalvm.compiler.hotspot.meta.HotSpotGraphBuilderPlugins) Plugins(org.graalvm.compiler.nodes.graphbuilderconf.GraphBuilderConfiguration.Plugins)

Example 18 with Plugins

use of org.graalvm.compiler.nodes.graphbuilderconf.GraphBuilderConfiguration.Plugins in project graal by oracle.

the class HotSpotLazyInitializationTest method getDefaultGraphBuilderPlugins.

@Override
protected Plugins getDefaultGraphBuilderPlugins() {
    Plugins plugins = super.getDefaultGraphBuilderPlugins();
    plugins.setClassInitializationPlugin(classInitPlugin);
    return plugins;
}
Also used : Plugins(org.graalvm.compiler.nodes.graphbuilderconf.GraphBuilderConfiguration.Plugins)

Example 19 with Plugins

use of org.graalvm.compiler.nodes.graphbuilderconf.GraphBuilderConfiguration.Plugins in project graal by oracle.

the class GraalUtil method getGraph.

public static StructuredGraph getGraph(GraalState graal, ResolvedJavaMethod javaMethod, boolean useProfilingInfo) {
    StructuredGraph graph = new StructuredGraph.Builder(graal.options, graal.debug, AllowAssumptions.YES).useProfilingInfo(useProfilingInfo).method(javaMethod).build();
    PhaseSuite<HighTierContext> graphBuilderSuite = new PhaseSuite<>();
    graphBuilderSuite.appendPhase(new GraphBuilderPhase(GraphBuilderConfiguration.getDefault(new Plugins(new InvocationPlugins()))));
    graphBuilderSuite.apply(graph, new HighTierContext(graal.providers, graphBuilderSuite, OptimisticOptimizations.ALL));
    return graph;
}
Also used : InvocationPlugins(org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugins) StructuredGraph(org.graalvm.compiler.nodes.StructuredGraph) HighTierContext(org.graalvm.compiler.phases.tiers.HighTierContext) PhaseSuite(org.graalvm.compiler.phases.PhaseSuite) GraphBuilderPhase(org.graalvm.compiler.java.GraphBuilderPhase) InvocationPlugins(org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugins) Plugins(org.graalvm.compiler.nodes.graphbuilderconf.GraphBuilderConfiguration.Plugins)

Example 20 with Plugins

use of org.graalvm.compiler.nodes.graphbuilderconf.GraphBuilderConfiguration.Plugins 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);
    }
}
Also used : InvocationPlugins(org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugins) VMIntrinsicMethod(jdk.vm.ci.hotspot.VMIntrinsicMethod) IntrinsicMethod(jdk.vm.ci.meta.MethodHandleAccessProvider.IntrinsicMethod) RuntimeProvider(org.graalvm.compiler.runtime.RuntimeProvider) HotSpotGraalRuntimeProvider(org.graalvm.compiler.hotspot.HotSpotGraalRuntimeProvider) HotSpotProviders(org.graalvm.compiler.hotspot.meta.HotSpotProviders) ArrayList(java.util.ArrayList) HotSpotGraalRuntimeProvider(org.graalvm.compiler.hotspot.HotSpotGraalRuntimeProvider) InvocationPlugin(org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugin) ArrayList(java.util.ArrayList) List(java.util.List) HotSpotVMConfigStore(jdk.vm.ci.hotspot.HotSpotVMConfigStore) VMIntrinsicMethod(jdk.vm.ci.hotspot.VMIntrinsicMethod) ResolvedJavaMethod(jdk.vm.ci.meta.ResolvedJavaMethod) InvocationPlugins(org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugins) Plugins(org.graalvm.compiler.nodes.graphbuilderconf.GraphBuilderConfiguration.Plugins) GraalTest(org.graalvm.compiler.test.GraalTest) Test(org.junit.Test)

Aggregations

Plugins (org.graalvm.compiler.nodes.graphbuilderconf.GraphBuilderConfiguration.Plugins)30 InvocationPlugins (org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugins)17 GraphBuilderPhase (org.graalvm.compiler.java.GraphBuilderPhase)15 StructuredGraph (org.graalvm.compiler.nodes.StructuredGraph)13 ResolvedJavaMethod (jdk.vm.ci.meta.ResolvedJavaMethod)12 GraphBuilderConfiguration (org.graalvm.compiler.nodes.graphbuilderconf.GraphBuilderConfiguration)12 OptionValues (org.graalvm.compiler.options.OptionValues)11 DebugContext (org.graalvm.compiler.debug.DebugContext)9 Providers (org.graalvm.compiler.phases.util.Providers)9 MetaAccessProvider (jdk.vm.ci.meta.MetaAccessProvider)8 HighTierContext (org.graalvm.compiler.phases.tiers.HighTierContext)8 Method (java.lang.reflect.Method)6 PhaseSuite (org.graalvm.compiler.phases.PhaseSuite)6 DebugCloseable (org.graalvm.compiler.debug.DebugCloseable)5 HotSpotGraphBuilderPlugins (org.graalvm.compiler.hotspot.meta.HotSpotGraphBuilderPlugins)5 HotSpotProviders (org.graalvm.compiler.hotspot.meta.HotSpotProviders)5 RuntimeProvider (org.graalvm.compiler.runtime.RuntimeProvider)5 HotSpotCodeCacheProvider (jdk.vm.ci.hotspot.HotSpotCodeCacheProvider)4 TargetDescription (jdk.vm.ci.code.TargetDescription)3 HotSpotConstantReflectionProvider (jdk.vm.ci.hotspot.HotSpotConstantReflectionProvider)3