Skip to content

Commit

Permalink
Fix NonSnippetLowerings ClassCastException.
Browse files Browse the repository at this point in the history
  • Loading branch information
cstancu committed Dec 13, 2024
1 parent 1a5e49e commit 5ab888f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@
import jdk.vm.ci.meta.DeoptimizationReason;
import jdk.vm.ci.meta.JavaConstant;
import jdk.vm.ci.meta.JavaKind;
import jdk.vm.ci.meta.JavaMethodProfile;
import jdk.vm.ci.meta.JavaType;
import jdk.vm.ci.meta.ResolvedJavaMethod;

Expand Down Expand Up @@ -494,8 +495,8 @@ protected LoweredCallTargetNode createDirectCall(StructuredGraph graph, MethodCa

protected IndirectCallTargetNode createIndirectCall(StructuredGraph graph, MethodCallTargetNode callTarget, NodeInputList<ValueNode> parameters, SharedMethod method, JavaType[] signature,
CallingConvention.Type callType, InvokeKind invokeKind, ValueNode entry) {
return graph.add(new SubstrateIndirectCallTargetNode(entry, parameters.toArray(new ValueNode[parameters.size()]), callTarget.returnStamp(), signature, method, callType, invokeKind,
((SubstrateMethodCallTargetNode) callTarget).getMethodProfile()));
JavaMethodProfile methodProfile = callTarget instanceof SubstrateMethodCallTargetNode substrateCallTarget ? substrateCallTarget.getMethodProfile() : null;
return graph.add(new SubstrateIndirectCallTargetNode(entry, parameters.toArray(ValueNode.EMPTY_ARRAY), callTarget.returnStamp(), signature, method, callType, invokeKind, methodProfile));
}

private static CallTargetNode createUnreachableCallTarget(LoweringTool tool, FixedNode node, NodeInputList<ValueNode> parameters, StampPair returnStamp, JavaType[] signature,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@
import jdk.vm.ci.meta.JavaTypeProfile;
import jdk.vm.ci.meta.ResolvedJavaMethod;

/**
* Extension of {@link MethodCallTargetNode} that adds a {@link JavaMethodProfile} when available.
* Note that the replacement from {@link MethodCallTargetNode} to
* {@link SubstrateMethodCallTargetNode} is not mandatory. SVM code can introduce new
* {@link MethodCallTargetNode}s.
*/
@NodeInfo
public final class SubstrateMethodCallTargetNode extends MethodCallTargetNode {
public static final NodeClass<SubstrateMethodCallTargetNode> TYPE = NodeClass.create(SubstrateMethodCallTargetNode.class);
Expand Down

0 comments on commit 5ab888f

Please sign in to comment.