Skip to content

Commit a7dab67

Browse files
author
Michael Haas
committed
Refactoring.
1 parent 6e12262 commit a7dab67

File tree

4 files changed

+22
-22
lines changed

4 files changed

+22
-22
lines changed

compiler/src/jdk.graal.compiler.test/src/jdk/graal/compiler/hotspot/test/HotSpotDeoptInBoundJavaMethodTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import org.junit.Test;
55

66
import jdk.graal.compiler.hotspot.meta.HotSpotForeignCallsProviderImpl;
7-
import jdk.graal.compiler.hotspot.nodes.InvokeJavaMethodNode;
7+
import jdk.graal.compiler.hotspot.nodes.InvokeStaticJavaMethodNode;
88
import jdk.graal.compiler.nodes.ValueNode;
99
import jdk.graal.compiler.nodes.extended.ForeignCallNode;
1010
import jdk.graal.compiler.nodes.graphbuilderconf.GraphBuilderContext;
@@ -15,17 +15,17 @@
1515

1616
/**
1717
* Verifies that deoptimization functions correctly when triggered during a method call invoked by
18-
* an {@link InvokeJavaMethodNode}.
18+
* an {@link InvokeStaticJavaMethodNode}.
1919
*/
2020
public class HotSpotDeoptInBoundJavaMethodTest extends HotSpotInvokeBoundJavaMethodBaseTest {
2121

2222
/**
2323
* Calling {@link #getForeignCallInvokerMethod()} will deoptimize the calling frame. We will
24-
* deoptimize to {@link InvokeJavaMethodNode#stateBefore()}.
24+
* deoptimize to {@link InvokeStaticJavaMethodNode#stateBefore()}.
2525
*/
2626
@Override
2727
protected boolean invocationPluginApply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, InvocationPlugin.Receiver receiver, ValueNode arg, JavaKind kind) {
28-
InvokeJavaMethodNode node = InvokeJavaMethodNode.create(b, getForeignCallInvokerMethod(), b.bci());
28+
InvokeStaticJavaMethodNode node = InvokeStaticJavaMethodNode.create(b, getForeignCallInvokerMethod(), b.bci());
2929
b.add(node);
3030
// add the arg to the stack as the method has a return value
3131
b.addPush(kind, arg);

compiler/src/jdk.graal.compiler.test/src/jdk/graal/compiler/hotspot/test/HotSpotInvokeBoundJavaMethodTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727
import org.junit.Test;
2828

29-
import jdk.graal.compiler.hotspot.nodes.InvokeJavaMethodNode;
29+
import jdk.graal.compiler.hotspot.nodes.InvokeStaticJavaMethodNode;
3030
import jdk.graal.compiler.nodes.Invoke;
3131
import jdk.graal.compiler.nodes.ValueNode;
3232
import jdk.graal.compiler.nodes.graphbuilderconf.GraphBuilderContext;
@@ -35,14 +35,14 @@
3535
import jdk.vm.ci.meta.ResolvedJavaMethod;
3636

3737
/**
38-
* Tests that using an {@link InvokeJavaMethodNode} instead of an {@link Invoke} to call a
38+
* Tests that using an {@link InvokeStaticJavaMethodNode} instead of an {@link Invoke} to call a
3939
* side-effect-free static method produces identical behavior.
4040
*/
4141
public class HotSpotInvokeBoundJavaMethodTest extends HotSpotInvokeBoundJavaMethodBaseTest {
4242

4343
@Override
4444
protected boolean invocationPluginApply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, InvocationPlugin.Receiver receiver, ValueNode arg, JavaKind kind) {
45-
InvokeJavaMethodNode node = InvokeJavaMethodNode.create(b, targetMethod, b.bci(), arg);
45+
InvokeStaticJavaMethodNode node = InvokeStaticJavaMethodNode.create(b, targetMethod, b.bci(), arg);
4646
b.addPush(kind, node);
4747
return false;
4848
}
Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,14 @@
5757
size = SIZE_UNKNOWN, sizeRationale = SIZE_UNKNOWN_RATIONALE)
5858
// @formatter:on
5959
@NodeIntrinsicFactory
60-
public class InvokeJavaMethodNode extends DeoptimizingFixedWithNextNode implements Invokable, Lowerable {
61-
public static final NodeClass<InvokeJavaMethodNode> TYPE = NodeClass.create(InvokeJavaMethodNode.class);
60+
public class InvokeStaticJavaMethodNode extends DeoptimizingFixedWithNextNode implements Invokable, Lowerable {
61+
public static final NodeClass<InvokeStaticJavaMethodNode> TYPE = NodeClass.create(InvokeStaticJavaMethodNode.class);
6262

6363
/**
6464
* Enables passing a method (to be invoked by this node) as a constant within an intrinsic
6565
* context. This is required when the specific method to invoke is known, but the corresponding
6666
* {@link ResolvedJavaMethod} instance is not available at the time of
67-
* {@link InvokeJavaMethodNode} creation. See
67+
* {@link InvokeStaticJavaMethodNode} creation. See
6868
* {@code HotSpotTruffleSafepointLoweringSnippet#pollSnippet} for usage details.
6969
*/
7070
public static final class MethodReference {
@@ -96,7 +96,7 @@ public String getName() {
9696
private MethodReference methodReference;
9797

9898
@SuppressWarnings("this-escape")
99-
protected InvokeJavaMethodNode(NodeClass<? extends InvokeJavaMethodNode> c, ResolvedJavaMethod targetMethod, ResolvedJavaMethod callerMethod,
99+
protected InvokeStaticJavaMethodNode(NodeClass<? extends InvokeStaticJavaMethodNode> c, ResolvedJavaMethod targetMethod, ResolvedJavaMethod callerMethod,
100100
StampPair returnStamp, int bci, ValueNode... args) {
101101
super(c, returnStamp.getTrustedStamp());
102102
this.arguments = new NodeInputList<>(this, args);
@@ -108,31 +108,31 @@ protected InvokeJavaMethodNode(NodeClass<? extends InvokeJavaMethodNode> c, Reso
108108
}
109109

110110
@SuppressWarnings("unused")
111-
public static InvokeJavaMethodNode create(MethodReference wrapper, ResolvedJavaMethod callerMethod, int bci, ValueNode... args) {
111+
public static InvokeStaticJavaMethodNode create(MethodReference wrapper, ResolvedJavaMethod callerMethod, int bci, ValueNode... args) {
112112
verifyTargetMethod(wrapper.targetMethod);
113113
ResolvedJavaMethod targetMethod = wrapper.targetMethod;
114114
JavaKind returnKind = targetMethod.getSignature().getReturnKind();
115-
return new InvokeJavaMethodNode(TYPE, targetMethod, callerMethod, StampPair.createSingle(StampFactory.forKind(returnKind)), bci, args);
115+
return new InvokeStaticJavaMethodNode(TYPE, targetMethod, callerMethod, StampPair.createSingle(StampFactory.forKind(returnKind)), bci, args);
116116
}
117117

118-
public static InvokeJavaMethodNode create(GraphBuilderContext b, ResolvedJavaMethod targetMethod, int bci, ValueNode... args) {
118+
public static InvokeStaticJavaMethodNode create(GraphBuilderContext b, ResolvedJavaMethod targetMethod, int bci, ValueNode... args) {
119119
Signature signature = targetMethod.getSignature();
120120
JavaType returnType = signature.getReturnType(null);
121121
StructuredGraph graph = b.getGraph();
122122
StampPair returnStamp = StampFactory.forDeclaredType(graph.getAssumptions(), returnType, false);
123123
return create(b, targetMethod, b.getMethod(), returnStamp, bci, args);
124124
}
125125

126-
private static InvokeJavaMethodNode createWithoutTargetMethod(GraphBuilderContext b, MethodReference method, Stamp returnStamp, int bci, ValueNode... args) {
127-
InvokeJavaMethodNode invoke = create(b, null, b.getMethod(), StampPair.createSingle(returnStamp), bci, args);
126+
private static InvokeStaticJavaMethodNode createWithoutTargetMethod(GraphBuilderContext b, MethodReference method, Stamp returnStamp, int bci, ValueNode... args) {
127+
InvokeStaticJavaMethodNode invoke = create(b, null, b.getMethod(), StampPair.createSingle(returnStamp), bci, args);
128128
invoke.methodReference = method;
129129
return invoke;
130130
}
131131

132-
private static InvokeJavaMethodNode create(GraphBuilderContext b, ResolvedJavaMethod targetMethod, ResolvedJavaMethod callerMethod,
132+
private static InvokeStaticJavaMethodNode create(GraphBuilderContext b, ResolvedJavaMethod targetMethod, ResolvedJavaMethod callerMethod,
133133
StampPair returnStamp, int bci, ValueNode... args) {
134134
GraalError.guarantee(b.getInvokeKind() == CallTargetNode.InvokeKind.Static, "can only invoke static methods");
135-
return new InvokeJavaMethodNode(TYPE, targetMethod, callerMethod, returnStamp, bci, args);
135+
return new InvokeStaticJavaMethodNode(TYPE, targetMethod, callerMethod, returnStamp, bci, args);
136136
}
137137

138138
@Override
@@ -207,7 +207,7 @@ public Map<Object, Object> getDebugProperties(Map<Object, Object> map) {
207207
public static boolean intrinsify(GraphBuilderContext b, @InjectedNodeParameter Stamp returnStamp, MethodReference method, ValueNode... args) {
208208
GraphBuilderContext nonIntrinsicAncestor = b.getNonIntrinsicAncestor();
209209
int bci = nonIntrinsicAncestor == null ? BytecodeFrame.UNKNOWN_BCI : b.bci();
210-
InvokeJavaMethodNode invoke = InvokeJavaMethodNode.createWithoutTargetMethod(b, method, returnStamp, bci, args);
210+
InvokeStaticJavaMethodNode invoke = InvokeStaticJavaMethodNode.createWithoutTargetMethod(b, method, returnStamp, bci, args);
211211
JavaKind returnKind = returnStamp.getStackKind();
212212
if (returnKind == JavaKind.Void) {
213213
b.add(invoke);

compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/truffle/hotspot/HotSpotTruffleSafepointLoweringSnippet.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
import jdk.graal.compiler.hotspot.meta.HotSpotHostForeignCallsProvider;
3939
import jdk.graal.compiler.hotspot.meta.HotSpotProviders;
4040
import jdk.graal.compiler.hotspot.nodes.CurrentJavaThreadNode;
41-
import jdk.graal.compiler.hotspot.nodes.InvokeJavaMethodNode;
41+
import jdk.graal.compiler.hotspot.nodes.InvokeStaticJavaMethodNode;
4242
import jdk.graal.compiler.nodes.NamedLocationIdentity;
4343
import jdk.graal.compiler.nodes.StructuredGraph;
4444
import jdk.graal.compiler.nodes.extended.BranchProbabilityNode;
@@ -73,7 +73,7 @@ private static void pollSnippet(Object node, @ConstantParameter int pendingHands
7373
Word thread = CurrentJavaThreadNode.get();
7474
if (BranchProbabilityNode.probability(BranchProbabilityNode.VERY_SLOW_PATH_PROBABILITY,
7575
thread.readInt(pendingHandshakeOffset, PENDING_HANDSHAKE_LOCATION) != 0)) {
76-
InvokeJavaMethodNode.invoke(InvokeJavaMethodNode.TRUFFLE_SAFEPOINT, node);
76+
InvokeStaticJavaMethodNode.invoke(InvokeStaticJavaMethodNode.TRUFFLE_SAFEPOINT, node);
7777
}
7878
}
7979

@@ -152,7 +152,7 @@ public void initialize(HotSpotProviders providers,
152152
if (config.jvmciReserved0Offset != -1) {
153153
this.templates = new Templates(options, providers, config.jvmciReserved0Offset);
154154
this.deferredInit = () -> {
155-
InvokeJavaMethodNode.TRUFFLE_SAFEPOINT.setTargetMethod(types.HotSpotThreadLocalHandshake_doHandshake);
155+
InvokeStaticJavaMethodNode.TRUFFLE_SAFEPOINT.setTargetMethod(types.HotSpotThreadLocalHandshake_doHandshake);
156156
};
157157
}
158158
}

0 commit comments

Comments
 (0)