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);
}
}
Aggregations