Skip to content

Commit 45f8c40

Browse files
committed
[GR-59402] Adjustments for graph builder plugins
PullRequest: graal/19263
2 parents f1710cc + 83a55eb commit 45f8c40

File tree

4 files changed

+23
-3
lines changed

4 files changed

+23
-3
lines changed

compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/java/BytecodeParser.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2456,6 +2456,11 @@ public void close() {
24562456
}
24572457
}
24582458

2459+
@Override
2460+
public boolean canInvokeFallback() {
2461+
return true;
2462+
}
2463+
24592464
@Override
24602465
public Invoke invokeFallback(FixedWithNextNode predecessor, EndNode end) {
24612466
assert isParsingInvocationPlugin();

compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/nodes/calc/UnsignedDivNode.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2011, 2022, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2011, 2024, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -27,15 +27,14 @@
2727
import jdk.graal.compiler.core.common.type.IntegerStamp;
2828
import jdk.graal.compiler.core.common.type.Stamp;
2929
import jdk.graal.compiler.graph.NodeClass;
30+
import jdk.graal.compiler.nodeinfo.NodeInfo;
3031
import jdk.graal.compiler.nodes.ConstantNode;
3132
import jdk.graal.compiler.nodes.NodeView;
3233
import jdk.graal.compiler.nodes.ValueNode;
3334
import jdk.graal.compiler.nodes.extended.GuardingNode;
3435
import jdk.graal.compiler.nodes.spi.CanonicalizerTool;
3536
import jdk.graal.compiler.nodes.spi.LIRLowerable;
3637
import jdk.graal.compiler.nodes.spi.NodeLIRBuilderTool;
37-
import jdk.graal.compiler.nodeinfo.NodeInfo;
38-
3938
import jdk.vm.ci.code.CodeUtil;
4039

4140
@NodeInfo(shortName = "|/|")
@@ -64,6 +63,9 @@ public ValueNode canonical(CanonicalizerTool tool, ValueNode forX, ValueNode for
6463

6564
@SuppressWarnings("unused")
6665
private static ValueNode canonical(UnsignedDivNode self, ValueNode forX, ValueNode forY, GuardingNode zeroCheck, Stamp stamp, NodeView view) {
66+
if (!(stamp instanceof IntegerStamp)) {
67+
return self != null ? self : new UnsignedDivNode(forX, forY, zeroCheck);
68+
}
6769
int bits = ((IntegerStamp) stamp).getBits();
6870
if (forX.isConstant() && forY.isConstant()) {
6971
long yConst = CodeUtil.zeroExtend(forY.asJavaConstant().asLong(), bits);

compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/nodes/graphbuilderconf/GraphBuilderContext.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -472,6 +472,14 @@ default boolean allowDeoptInPlugins() {
472472
return !StrictDeoptInsertionChecks.getValue(getOptions());
473473
}
474474

475+
/**
476+
* Returns {@code true} if {@link #invokeFallback} can be called without throwing an
477+
* unconditional error.
478+
*/
479+
default boolean canInvokeFallback() {
480+
return false;
481+
}
482+
475483
@SuppressWarnings("all")
476484
default Invoke invokeFallback(FixedWithNextNode predecessor, EndNode end) {
477485
throw new GraalError("Cannot be called on a " + getClass().getName() + " object");

compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/replacements/IntrinsicGraphBuilder.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,11 @@ public boolean isParsingInvocationPlugin() {
393393
return true;
394394
}
395395

396+
@Override
397+
public boolean canInvokeFallback() {
398+
return true;
399+
}
400+
396401
@Override
397402
public Invoke invokeFallback(FixedWithNextNode predecessor, EndNode end) {
398403
assert isParsingInvocationPlugin();

0 commit comments

Comments
 (0)