Skip to content

Commit 0be7205

Browse files
committed
compiler: allow to fixup the stamp of FallbackInvokeWithExceptionNode
1 parent ad33a54 commit 0be7205

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

compiler/src/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/nodes/FallbackInvokeWithExceptionNode.java

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,20 +31,17 @@
3131
import static org.graalvm.compiler.nodes.Invoke.CYCLES_UNKNOWN_RATIONALE;
3232
import static org.graalvm.compiler.nodes.Invoke.SIZE_UNKNOWN_RATIONALE;
3333

34-
import org.graalvm.compiler.core.common.type.StampFactory;
35-
import org.graalvm.compiler.core.common.type.TypeReference;
34+
import org.graalvm.compiler.core.common.type.Stamp;
3635
import org.graalvm.compiler.graph.NodeClass;
3736
import org.graalvm.compiler.nodeinfo.NodeInfo;
3837
import org.graalvm.compiler.nodes.WithExceptionNode;
3938
import org.graalvm.compiler.nodes.memory.SingleMemoryKill;
4039
import org.graalvm.word.LocationIdentity;
4140

42-
import jdk.vm.ci.meta.MetaAccessProvider;
43-
4441
/**
4542
* Placeholder for a fallback call from a {@link MacroStateSplitWithExceptionNode}.
4643
*
47-
* The {@link #fallbackFunctionCallThrowing()} intrinsic can be used in snippets that lower a
44+
* The {@link #fallbackFunctionCall()} intrinsic can be used in snippets that lower a
4845
* {@link MacroStateSplitWithExceptionNode}. The {@link FallbackInvokeWithExceptionNode} will be
4946
* replaced with the {@linkplain MacroStateSplitWithExceptionNode#createInvoke original call} of the
5047
* macro node. This can be useful for handling exceptional and/or slow path cases.
@@ -60,18 +57,27 @@ public final class FallbackInvokeWithExceptionNode extends WithExceptionNode imp
6057

6158
public static final NodeClass<FallbackInvokeWithExceptionNode> TYPE = NodeClass.create(FallbackInvokeWithExceptionNode.class);
6259

63-
public FallbackInvokeWithExceptionNode(@InjectedNodeParameter MetaAccessProvider metaAccess) {
64-
super(TYPE, StampFactory.objectNonNull(TypeReference.createExactTrusted(metaAccess.lookupJavaType(Object.class))));
60+
public FallbackInvokeWithExceptionNode(@InjectedNodeParameter Stamp stamp) {
61+
super(TYPE, stamp);
6562
}
6663

6764
@Override
6865
public LocationIdentity getKilledLocationIdentity() {
6966
return LocationIdentity.any();
7067
}
7168

69+
/**
70+
* At the time when this node was created (i.e. when creating the snippet template), we did not
71+
* have actual parameters so the precise stamp was not known. To fix that, we allow updating it
72+
* after the snippet was instantiated.
73+
*/
74+
public boolean updateInitialStamp(Stamp newStamp) {
75+
return updateStamp(newStamp);
76+
}
77+
7278
/**
7379
* @see FallbackInvokeWithExceptionNode
7480
*/
7581
@NodeIntrinsic
76-
public static native void fallbackFunctionCallThrowing();
82+
public static native Object fallbackFunctionCall();
7783
}

0 commit comments

Comments
 (0)