Skip to content

Commit 3ef6cba

Browse files
committed
Handle deleted if node in OutlineRuntimeChecksPhase.ArrayBoundCheckPattern.
1 parent 1352a05 commit 3ef6cba

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

web-image/src/com.oracle.svm.hosted.webimage/src/com/oracle/svm/hosted/webimage/codegen/phase/OutlineRuntimeChecksPhase.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@
2828
import java.util.ArrayList;
2929
import java.util.List;
3030

31-
import com.oracle.svm.webimage.functionintrinsics.ImplicitExceptions;
3231
import com.oracle.svm.core.graal.nodes.ThrowBytecodeExceptionNode;
32+
import com.oracle.svm.webimage.functionintrinsics.ImplicitExceptions;
3333

3434
import jdk.graal.compiler.core.common.spi.ForeignCallDescriptor;
3535
import jdk.graal.compiler.graph.Node;
@@ -203,6 +203,16 @@ private static class ArrayBoundCheckPattern extends Pattern {
203203
*/
204204
@Override
205205
void replace(CoreProviders providers) {
206+
if (ifNode.isDeleted()) {
207+
/*
208+
* This case can happen when both branches of an if node throw a bytecode exception;
209+
* e.g. if (array == null) where the true successor throws a NullPointerException,
210+
* and the other throws an ArrayIndexOutOfBoundsException, which is then replaced
211+
* with checkNullPointer(array) followed by ThrowBytecodeException(OUT_OF_BOUNDS).
212+
*/
213+
return;
214+
}
215+
206216
StructuredGraph graph = ifNode.graph();
207217

208218
/*

0 commit comments

Comments
 (0)