Skip to content

Commit fec14df

Browse files
committed
[GR-41522] Add assertion diagnostics for null value in patching.
PullRequest: graal/12885
2 parents 7d8524a + f93503c commit fec14df

File tree

1 file changed

+12
-0
lines changed
  • compiler/src/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/loop

1 file changed

+12
-0
lines changed

compiler/src/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/loop/LoopFragment.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,13 +200,25 @@ public Node replacement(Node o) {
200200
duplicationMap = graph().addDuplicates(nodesIterable, graph(), nodesIterable.count(), dr);
201201
finishDuplication();
202202
nodes = new NodeBitMap(graph());
203+
204+
assert checkNoNulls(duplicationMap);
205+
203206
nodes.markAll(duplicationMap.getValues());
204207
nodesReady = true;
205208
} else {
206209
// TODO (gd) apply fix ?
207210
}
208211
}
209212

213+
private boolean checkNoNulls(EconomicMap<Node, Node> dupMap) {
214+
MapCursor<Node, Node> c = dupMap.getEntries();
215+
while (c.advance()) {
216+
GraalError.guarantee(c.getKey() != null, "Key must not be null when patching nodes for %s", this);
217+
GraalError.guarantee(c.getValue() != null, "Value is null for %s when patching nodes for %s", c.getKey(), this);
218+
}
219+
return true;
220+
}
221+
210222
protected static void computeNodes(NodeBitMap nodes, Graph graph, LoopEx loop, Iterable<AbstractBeginNode> blocks, Iterable<AbstractBeginNode> earlyExits) {
211223
for (AbstractBeginNode b : blocks) {
212224
if (b.isDeleted()) {

0 commit comments

Comments
 (0)