Search in sources :

Example 1 with SubstrateMethodCallTargetNode

use of com.oracle.svm.hosted.nodes.SubstrateMethodCallTargetNode in project graal by oracle.

the class DevirtualizeCallsPhase method run.

@Override
protected void run(StructuredGraph graph) {
    for (Invoke invoke : graph.getInvokes()) {
        if (invoke.callTarget() instanceof SubstrateMethodCallTargetNode) {
            SubstrateMethodCallTargetNode callTarget = (SubstrateMethodCallTargetNode) invoke.callTarget();
            JavaMethodProfile methodProfile = callTarget.getMethodProfile();
            if (methodProfile != null) {
                if (methodProfile.getMethods().length == 0) {
                    unreachableInvoke(graph, invoke, callTarget);
                } else if (methodProfile.getMethods().length == 1) {
                    if (callTarget.invokeKind().isIndirect()) {
                        singleCallee((HostedMethod) methodProfile.getMethods()[0].getMethod(), graph, invoke, callTarget);
                    }
                }
            }
        }
    }
}
Also used : HostedMethod(com.oracle.svm.hosted.meta.HostedMethod) SubstrateMethodCallTargetNode(com.oracle.svm.hosted.nodes.SubstrateMethodCallTargetNode) JavaMethodProfile(jdk.vm.ci.meta.JavaMethodProfile) Invoke(org.graalvm.compiler.nodes.Invoke)

Aggregations

HostedMethod (com.oracle.svm.hosted.meta.HostedMethod)1 SubstrateMethodCallTargetNode (com.oracle.svm.hosted.nodes.SubstrateMethodCallTargetNode)1 JavaMethodProfile (jdk.vm.ci.meta.JavaMethodProfile)1 Invoke (org.graalvm.compiler.nodes.Invoke)1