Search in sources :

Example 21 with GraphBuilderConfiguration

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

the class VerifyBailoutUsageTest method testBailoutUsage.

@SuppressWarnings("try")
private static void testBailoutUsage(Class<?> c) {
    RuntimeProvider rt = Graal.getRequiredCapability(RuntimeProvider.class);
    Providers providers = rt.getHostBackend().getProviders();
    MetaAccessProvider metaAccess = providers.getMetaAccess();
    PhaseSuite<HighTierContext> graphBuilderSuite = new PhaseSuite<>();
    Plugins plugins = new Plugins(new InvocationPlugins());
    GraphBuilderConfiguration config = GraphBuilderConfiguration.getDefault(plugins).withEagerResolving(true).withUnresolvedIsError(true);
    graphBuilderSuite.appendPhase(new GraphBuilderPhase(config));
    HighTierContext context = new HighTierContext(providers, graphBuilderSuite, OptimisticOptimizations.NONE);
    OptionValues options = getInitialOptions();
    DebugContext debug = DebugContext.create(options, DebugHandlersFactory.LOADER);
    for (Method m : c.getDeclaredMethods()) {
        if (!Modifier.isNative(m.getModifiers()) && !Modifier.isAbstract(m.getModifiers())) {
            ResolvedJavaMethod method = metaAccess.lookupJavaMethod(m);
            StructuredGraph graph = new StructuredGraph.Builder(options, debug).method(method).build();
            graphBuilderSuite.apply(graph, context);
            try (DebugCloseable s = debug.disableIntercept()) {
                new VerifyBailoutUsage().apply(graph, context);
            }
        }
    }
}
Also used : InvocationPlugins(org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugins) OptionValues(org.graalvm.compiler.options.OptionValues) VerifyBailoutUsage(org.graalvm.compiler.phases.verify.VerifyBailoutUsage) RuntimeProvider(org.graalvm.compiler.runtime.RuntimeProvider) GraphBuilderConfiguration(org.graalvm.compiler.nodes.graphbuilderconf.GraphBuilderConfiguration) DebugContext(org.graalvm.compiler.debug.DebugContext) Method(java.lang.reflect.Method) ResolvedJavaMethod(jdk.vm.ci.meta.ResolvedJavaMethod) Providers(org.graalvm.compiler.phases.util.Providers) StructuredGraph(org.graalvm.compiler.nodes.StructuredGraph) HighTierContext(org.graalvm.compiler.phases.tiers.HighTierContext) DebugCloseable(org.graalvm.compiler.debug.DebugCloseable) PhaseSuite(org.graalvm.compiler.phases.PhaseSuite) GraphBuilderPhase(org.graalvm.compiler.java.GraphBuilderPhase) MetaAccessProvider(jdk.vm.ci.meta.MetaAccessProvider) ResolvedJavaMethod(jdk.vm.ci.meta.ResolvedJavaMethod) InvocationPlugins(org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugins) Plugins(org.graalvm.compiler.nodes.graphbuilderconf.GraphBuilderConfiguration.Plugins)

Aggregations

GraphBuilderConfiguration (org.graalvm.compiler.nodes.graphbuilderconf.GraphBuilderConfiguration)21 StructuredGraph (org.graalvm.compiler.nodes.StructuredGraph)16 GraphBuilderPhase (org.graalvm.compiler.java.GraphBuilderPhase)15 Plugins (org.graalvm.compiler.nodes.graphbuilderconf.GraphBuilderConfiguration.Plugins)12 ResolvedJavaMethod (jdk.vm.ci.meta.ResolvedJavaMethod)11 DebugContext (org.graalvm.compiler.debug.DebugContext)11 InvocationPlugins (org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugins)11 OptionValues (org.graalvm.compiler.options.OptionValues)10 HighTierContext (org.graalvm.compiler.phases.tiers.HighTierContext)10 MetaAccessProvider (jdk.vm.ci.meta.MetaAccessProvider)9 Providers (org.graalvm.compiler.phases.util.Providers)7 Method (java.lang.reflect.Method)6 CanonicalizerPhase (org.graalvm.compiler.phases.common.CanonicalizerPhase)6 DebugCloseable (org.graalvm.compiler.debug.DebugCloseable)5 PhaseSuite (org.graalvm.compiler.phases.PhaseSuite)5 PhaseContext (org.graalvm.compiler.phases.tiers.PhaseContext)5 RuntimeProvider (org.graalvm.compiler.runtime.RuntimeProvider)5 SnippetReflectionProvider (org.graalvm.compiler.api.replacements.SnippetReflectionProvider)3 Bytecode (org.graalvm.compiler.bytecode.Bytecode)3 IntrinsicContext (org.graalvm.compiler.nodes.graphbuilderconf.IntrinsicContext)3