Search in sources :

Example 31 with FixedGuardNode

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

the class TypeGuardInlineInfo method createGuard.

@SuppressWarnings("try")
private void createGuard(StructuredGraph graph, Providers providers) {
    try (DebugCloseable context = invoke.asNode().withNodeSourcePosition()) {
        ValueNode nonNullReceiver = InliningUtil.nonNullReceiver(invoke);
        LoadHubNode receiverHub = graph.unique(new LoadHubNode(providers.getStampProvider(), nonNullReceiver));
        ConstantNode typeHub = ConstantNode.forConstant(receiverHub.stamp(NodeView.DEFAULT), providers.getConstantReflection().asObjectHub(type), providers.getMetaAccess(), graph);
        LogicNode typeCheck = CompareNode.createCompareNode(graph, CanonicalCondition.EQ, receiverHub, typeHub, providers.getConstantReflection(), NodeView.DEFAULT);
        FixedGuardNode guard = graph.add(new FixedGuardNode(typeCheck, DeoptimizationReason.TypeCheckedInliningViolated, DeoptimizationAction.InvalidateReprofile));
        assert invoke.predecessor() != null;
        ValueNode anchoredReceiver = InliningUtil.createAnchoredReceiver(graph, guard, type, nonNullReceiver, true);
        invoke.callTarget().replaceFirstInput(nonNullReceiver, anchoredReceiver);
        graph.addBeforeFixed(invoke.asNode(), guard);
    }
}
Also used : FixedGuardNode(org.graalvm.compiler.nodes.FixedGuardNode) LoadHubNode(org.graalvm.compiler.nodes.extended.LoadHubNode) ConstantNode(org.graalvm.compiler.nodes.ConstantNode) ValueNode(org.graalvm.compiler.nodes.ValueNode) LogicNode(org.graalvm.compiler.nodes.LogicNode) DebugCloseable(org.graalvm.compiler.debug.DebugCloseable)

Aggregations

FixedGuardNode (org.graalvm.compiler.nodes.FixedGuardNode)31 LogicNode (org.graalvm.compiler.nodes.LogicNode)25 ValueNode (org.graalvm.compiler.nodes.ValueNode)24 ResolvedJavaType (jdk.vm.ci.meta.ResolvedJavaType)10 ObjectStamp (org.graalvm.compiler.core.common.type.ObjectStamp)8 TypeReference (org.graalvm.compiler.core.common.type.TypeReference)8 ConstantNode (org.graalvm.compiler.nodes.ConstantNode)8 ResolvedJavaMethod (jdk.vm.ci.meta.ResolvedJavaMethod)7 Stamp (org.graalvm.compiler.core.common.type.Stamp)7 JavaConstant (jdk.vm.ci.meta.JavaConstant)6 DebugCloseable (org.graalvm.compiler.debug.DebugCloseable)5 StructuredGraph (org.graalvm.compiler.nodes.StructuredGraph)5 RuntimeConstraint (jdk.vm.ci.meta.DeoptimizationReason.RuntimeConstraint)4 IntegerStamp (org.graalvm.compiler.core.common.type.IntegerStamp)4 AbstractBeginNode (org.graalvm.compiler.nodes.AbstractBeginNode)4 FixedNode (org.graalvm.compiler.nodes.FixedNode)4 IfNode (org.graalvm.compiler.nodes.IfNode)4 LogicConstantNode (org.graalvm.compiler.nodes.LogicConstantNode)4 PiNode (org.graalvm.compiler.nodes.PiNode)4 InvocationPlugin (org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugin)4