Skip to content

Commit

Permalink
[GR-62388] Add missing NSPs in UseTrappingOperationPhase.
Browse files Browse the repository at this point in the history
PullRequest: graal/20119
  • Loading branch information
rmosaner committed Feb 25, 2025
2 parents e9ebdb0 + f96592e commit f5c6ce9
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import java.util.List;
import java.util.Optional;

import jdk.graal.compiler.debug.DebugCloseable;
import jdk.graal.compiler.debug.DebugContext;
import jdk.graal.compiler.graph.Node;
import jdk.graal.compiler.nodeinfo.InputType;
Expand All @@ -49,7 +50,6 @@
import jdk.graal.compiler.nodes.util.GraphUtil;
import jdk.graal.compiler.phases.BasePhase;
import jdk.graal.compiler.phases.tiers.LowTierContext;

import jdk.vm.ci.meta.DeoptimizationReason;
import jdk.vm.ci.meta.JavaConstant;
import jdk.vm.ci.meta.MetaAccessProvider;
Expand Down Expand Up @@ -202,6 +202,7 @@ protected void checkPredecessor(AbstractDeoptimizeNode deopt, Node predecessor,
}
}

@SuppressWarnings("try")
protected void replaceWithTrappingVersion(AbstractDeoptimizeNode deopt, IfNode ifNode, LogicNode condition, JavaConstant deoptReasonAndAction, JavaConstant deoptSpeculation,
LowTierContext context) {
StructuredGraph graph = deopt.graph();
Expand All @@ -210,8 +211,10 @@ protected void replaceWithTrappingVersion(AbstractDeoptimizeNode deopt, IfNode i
DeoptimizingFixedWithNextNode trappingVersionNode = null;
trappingVersionNode = tryReplaceExisting(graph, nonTrappingContinuation, trappingContinuation, condition, ifNode, deopt, deoptReasonAndAction, deoptSpeculation, context);
if (trappingVersionNode == null) {
// Need to add a null check node.
trappingVersionNode = createImplicitNode(graph, condition, deoptReasonAndAction, deoptSpeculation);
try (DebugCloseable closable = ifNode.withNodeSourcePosition()) {
// Need to add a null check node.
trappingVersionNode = createImplicitNode(graph, condition, deoptReasonAndAction, deoptSpeculation);
}
graph.replaceSplit(ifNode, trappingVersionNode, nonTrappingContinuation);
graph.getOptimizationLog().report(getClass(), "NullCheckInsertion", ifNode);
}
Expand Down

0 comments on commit f5c6ce9

Please sign in to comment.