Search in sources :

Example 1 with InlineMethodSubstitutionsPolicy

use of org.graalvm.compiler.phases.common.inlining.policy.InlineMethodSubstitutionsPolicy in project graal by oracle.

the class EdgesTest method testMethod.

private void testMethod(Method method, Object receiver, Object... args) {
    try {
        // Invoke the method to ensure it has a type profile
        for (int i = 0; i < 5000; i++) {
            method.invoke(receiver, args);
        }
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
    ResolvedJavaMethod javaMethod = getMetaAccess().lookupJavaMethod(method);
    StructuredGraph g = parseProfiled(javaMethod, AllowAssumptions.NO);
    HighTierContext context = getDefaultHighTierContext();
    new InliningPhase(new InlineMethodSubstitutionsPolicy(), new CanonicalizerPhase()).apply(g, context);
    new CanonicalizerPhase().apply(g, context);
    Assert.assertTrue(g.getNodes().filter(InstanceOfNode.class).isEmpty());
}
Also used : StructuredGraph(org.graalvm.compiler.nodes.StructuredGraph) InlineMethodSubstitutionsPolicy(org.graalvm.compiler.phases.common.inlining.policy.InlineMethodSubstitutionsPolicy) CanonicalizerPhase(org.graalvm.compiler.phases.common.CanonicalizerPhase) HighTierContext(org.graalvm.compiler.phases.tiers.HighTierContext) InliningPhase(org.graalvm.compiler.phases.common.inlining.InliningPhase) ResolvedJavaMethod(jdk.vm.ci.meta.ResolvedJavaMethod)

Aggregations

ResolvedJavaMethod (jdk.vm.ci.meta.ResolvedJavaMethod)1 StructuredGraph (org.graalvm.compiler.nodes.StructuredGraph)1 CanonicalizerPhase (org.graalvm.compiler.phases.common.CanonicalizerPhase)1 InliningPhase (org.graalvm.compiler.phases.common.inlining.InliningPhase)1 InlineMethodSubstitutionsPolicy (org.graalvm.compiler.phases.common.inlining.policy.InlineMethodSubstitutionsPolicy)1 HighTierContext (org.graalvm.compiler.phases.tiers.HighTierContext)1