Search in sources :

Example 1 with VerifyBailoutUsage

use of org.graalvm.compiler.phases.verify.VerifyBailoutUsage in project graal by oracle.

the class CheckGraalInvariants method checkGraph.

/**
 * Checks the invariants for a single graph.
 */
private static void checkGraph(HighTierContext context, StructuredGraph graph) {
    if (shouldVerifyEquals(graph.method())) {
        // If you add a new type to test here, be sure to add appropriate
        // methods to the BadUsageWithEquals class below
        new VerifyUsageWithEquals(Value.class).apply(graph, context);
        new VerifyUsageWithEquals(Register.class).apply(graph, context);
        new VerifyUsageWithEquals(RegisterCategory.class).apply(graph, context);
        new VerifyUsageWithEquals(JavaType.class).apply(graph, context);
        new VerifyUsageWithEquals(JavaMethod.class).apply(graph, context);
        new VerifyUsageWithEquals(JavaField.class).apply(graph, context);
        new VerifyUsageWithEquals(LocationIdentity.class).apply(graph, context);
        new VerifyUsageWithEquals(LIRKind.class).apply(graph, context);
        new VerifyUsageWithEquals(ArithmeticOpTable.class).apply(graph, context);
        new VerifyUsageWithEquals(ArithmeticOpTable.Op.class).apply(graph, context);
    }
    new VerifyDebugUsage().apply(graph, context);
    new VerifyCallerSensitiveMethods().apply(graph, context);
    new VerifyVirtualizableUsage().apply(graph, context);
    new VerifyUpdateUsages().apply(graph, context);
    new VerifyBailoutUsage().apply(graph, context);
    new VerifyInstanceOfUsage().apply(graph, context);
    new VerifyGraphAddUsage().apply(graph, context);
    new VerifyGetOptionsUsage().apply(graph, context);
    if (graph.method().isBridge()) {
        BridgeMethodUtils.getBridgedMethod(graph.method());
    }
}
Also used : RegisterCategory(jdk.vm.ci.code.Register.RegisterCategory) VerifyBailoutUsage(org.graalvm.compiler.phases.verify.VerifyBailoutUsage) VerifyGraphAddUsage(org.graalvm.compiler.phases.verify.VerifyGraphAddUsage) VerifyUsageWithEquals(org.graalvm.compiler.phases.verify.VerifyUsageWithEquals) VerifyUpdateUsages(org.graalvm.compiler.phases.verify.VerifyUpdateUsages) VerifyDebugUsage(org.graalvm.compiler.phases.verify.VerifyDebugUsage) VerifyVirtualizableUsage(org.graalvm.compiler.phases.verify.VerifyVirtualizableUsage) VerifyInstanceOfUsage(org.graalvm.compiler.phases.verify.VerifyInstanceOfUsage) ArithmeticOpTable(org.graalvm.compiler.core.common.type.ArithmeticOpTable) ResolvedJavaType(jdk.vm.ci.meta.ResolvedJavaType) JavaType(jdk.vm.ci.meta.JavaType) JavaField(jdk.vm.ci.meta.JavaField) Register(jdk.vm.ci.code.Register) VerifyGetOptionsUsage(org.graalvm.compiler.phases.verify.VerifyGetOptionsUsage) Value(jdk.vm.ci.meta.Value) JavaMethod(jdk.vm.ci.meta.JavaMethod) ResolvedJavaMethod(jdk.vm.ci.meta.ResolvedJavaMethod) LocationIdentity(org.graalvm.word.LocationIdentity) LIRKind(org.graalvm.compiler.core.common.LIRKind) VerifyCallerSensitiveMethods(org.graalvm.compiler.phases.verify.VerifyCallerSensitiveMethods)

Example 2 with VerifyBailoutUsage

use of org.graalvm.compiler.phases.verify.VerifyBailoutUsage 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

ResolvedJavaMethod (jdk.vm.ci.meta.ResolvedJavaMethod)2 VerifyBailoutUsage (org.graalvm.compiler.phases.verify.VerifyBailoutUsage)2 Method (java.lang.reflect.Method)1 Register (jdk.vm.ci.code.Register)1 RegisterCategory (jdk.vm.ci.code.Register.RegisterCategory)1 JavaField (jdk.vm.ci.meta.JavaField)1 JavaMethod (jdk.vm.ci.meta.JavaMethod)1 JavaType (jdk.vm.ci.meta.JavaType)1 MetaAccessProvider (jdk.vm.ci.meta.MetaAccessProvider)1 ResolvedJavaType (jdk.vm.ci.meta.ResolvedJavaType)1 Value (jdk.vm.ci.meta.Value)1 LIRKind (org.graalvm.compiler.core.common.LIRKind)1 ArithmeticOpTable (org.graalvm.compiler.core.common.type.ArithmeticOpTable)1 DebugCloseable (org.graalvm.compiler.debug.DebugCloseable)1 DebugContext (org.graalvm.compiler.debug.DebugContext)1 GraphBuilderPhase (org.graalvm.compiler.java.GraphBuilderPhase)1 StructuredGraph (org.graalvm.compiler.nodes.StructuredGraph)1 GraphBuilderConfiguration (org.graalvm.compiler.nodes.graphbuilderconf.GraphBuilderConfiguration)1 Plugins (org.graalvm.compiler.nodes.graphbuilderconf.GraphBuilderConfiguration.Plugins)1 InvocationPlugins (org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugins)1