Skip to content

Commit a41d0b9

Browse files
committed
[GR-69420] Fix OutlineRuntimeChecksPhase NPE check detection
PullRequest: graal/22045
2 parents 0ea4d96 + 865aa09 commit a41d0b9

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

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

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -149,12 +149,15 @@ void replace(CoreProviders providers) {
149149
* {@link ThrowBytecodeExceptionNode}.
150150
*
151151
* @param node A {@link BytecodeExceptionNode} followed immediately by an {@link UnwindNode}
152-
* or a {@link ThrowBytecodeExceptionNode}
152+
* or just a {@link ThrowBytecodeExceptionNode}
153153
*/
154154
static void find(FixedNode node, List<Pattern> patterns) {
155-
boolean isNullCheck = node.predecessor() instanceof BeginNode;
156-
isNullCheck = isNullCheck && node.predecessor().predecessor() instanceof IfNode;
157-
isNullCheck = isNullCheck && singleInput(node.predecessor().predecessor()) instanceof IsNullNode;
155+
Node predecessor = node.predecessor();
156+
boolean isNullCheck = predecessor instanceof BeginNode;
157+
Node secondPredecessor = predecessor.predecessor();
158+
// It has to be an if node where the NPE is thrown in the true-successor
159+
isNullCheck = isNullCheck && secondPredecessor instanceof IfNode ifNode && ifNode.trueSuccessor() == predecessor;
160+
isNullCheck = isNullCheck && singleInput(secondPredecessor) instanceof IsNullNode;
158161

159162
if (isNullCheck) {
160163
NullCheckPattern pattern = new NullCheckPattern(node);

web-image/src/com.oracle.svm.hosted.webimage/src/com/oracle/svm/hosted/webimage/wasmgc/phases/WebImageWasmGCLowTier.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525

2626
package com.oracle.svm.hosted.webimage.wasmgc.phases;
2727

28-
import com.oracle.svm.hosted.webimage.codegen.phase.OutlineRuntimeChecksPhase;
2928
import com.oracle.svm.hosted.webimage.codegen.phase.ReconstructionVerificationPhase;
3029
import com.oracle.svm.hosted.webimage.codegen.phase.WebImageLowTier;
3130
import com.oracle.svm.hosted.webimage.codegen.reconstruction.stackifier.StackifierReconstructionPhase;
@@ -66,8 +65,6 @@ public WebImageWasmGCLowTier(OptionValues options) {
6665

6766
// TODO GR-59392 temporarily disable this because it fails some tests.
6867
removePhase(ReconstructionVerificationPhase.class);
69-
70-
removePhase(OutlineRuntimeChecksPhase.class);
7168
}
7269

7370
@Override

0 commit comments

Comments
 (0)