use of org.graalvm.compiler.hotspot.nodes.HotSpotDirectCallTargetNode in project graal by oracle.
the class SPARCHotSpotNodeLIRBuilder method emitDirectCall.
@Override
protected void emitDirectCall(DirectCallTargetNode callTarget, Value result, Value[] parameters, Value[] temps, LIRFrameState callState) {
InvokeKind invokeKind = ((HotSpotDirectCallTargetNode) callTarget).invokeKind();
if (invokeKind.isIndirect()) {
append(new SPARCHotspotDirectVirtualCallOp(callTarget.targetMethod(), result, parameters, temps, callState, invokeKind, getGen().config));
} else {
assert invokeKind.isDirect();
HotSpotResolvedJavaMethod resolvedMethod = (HotSpotResolvedJavaMethod) callTarget.targetMethod();
assert resolvedMethod.isConcrete() : "Cannot make direct call to abstract method.";
append(new SPARCHotspotDirectStaticCallOp(callTarget.targetMethod(), result, parameters, temps, callState, invokeKind, getGen().config));
}
}
use of org.graalvm.compiler.hotspot.nodes.HotSpotDirectCallTargetNode in project graal by oracle.
the class AMD64HotSpotNodeLIRBuilder method emitDirectCall.
@Override
protected void emitDirectCall(DirectCallTargetNode callTarget, Value result, Value[] parameters, Value[] temps, LIRFrameState callState) {
InvokeKind invokeKind = ((HotSpotDirectCallTargetNode) callTarget).invokeKind();
if (invokeKind.isIndirect()) {
append(new AMD64HotspotDirectVirtualCallOp(callTarget.targetMethod(), result, parameters, temps, callState, invokeKind, getGen().config));
} else {
assert invokeKind.isDirect();
HotSpotResolvedJavaMethod resolvedMethod = (HotSpotResolvedJavaMethod) callTarget.targetMethod();
assert resolvedMethod.isConcrete() : "Cannot make direct call to abstract method.";
append(new AMD64HotSpotDirectStaticCallOp(callTarget.targetMethod(), result, parameters, temps, callState, invokeKind, getGen().config));
}
}
use of org.graalvm.compiler.hotspot.nodes.HotSpotDirectCallTargetNode in project graal by oracle.
the class AArch64HotSpotNodeLIRBuilder method emitDirectCall.
@Override
protected void emitDirectCall(DirectCallTargetNode callTarget, Value result, Value[] parameters, Value[] temps, LIRFrameState callState) {
InvokeKind invokeKind = ((HotSpotDirectCallTargetNode) callTarget).invokeKind();
if (invokeKind.isIndirect()) {
append(new AArch64HotSpotDirectVirtualCallOp(callTarget.targetMethod(), result, parameters, temps, callState, invokeKind, getGen().config));
} else {
assert invokeKind.isDirect();
HotSpotResolvedJavaMethod resolvedMethod = (HotSpotResolvedJavaMethod) callTarget.targetMethod();
assert resolvedMethod.isConcrete() : "Cannot make direct call to abstract method.";
append(new AArch64HotSpotDirectStaticCallOp(callTarget.targetMethod(), result, parameters, temps, callState, invokeKind, getGen().config));
}
}
use of org.graalvm.compiler.hotspot.nodes.HotSpotDirectCallTargetNode in project graal by oracle.
the class DefaultHotSpotLoweringProvider method lowerInvoke.
private void lowerInvoke(Invoke invoke, LoweringTool tool, StructuredGraph graph) {
if (invoke.callTarget() instanceof MethodCallTargetNode) {
MethodCallTargetNode callTarget = (MethodCallTargetNode) invoke.callTarget();
NodeInputList<ValueNode> parameters = callTarget.arguments();
ValueNode receiver = parameters.size() <= 0 ? null : parameters.get(0);
if (!callTarget.isStatic() && receiver.stamp(NodeView.DEFAULT) instanceof ObjectStamp && !StampTool.isPointerNonNull(receiver)) {
ValueNode nonNullReceiver = createNullCheckedValue(receiver, invoke.asNode(), tool);
parameters.set(0, nonNullReceiver);
receiver = nonNullReceiver;
}
JavaType[] signature = callTarget.targetMethod().getSignature().toParameterTypes(callTarget.isStatic() ? null : callTarget.targetMethod().getDeclaringClass());
LoweredCallTargetNode loweredCallTarget = null;
OptionValues options = graph.getOptions();
if (InlineVTableStubs.getValue(options) && callTarget.invokeKind().isIndirect() && (AlwaysInlineVTableStubs.getValue(options) || invoke.isPolymorphic())) {
HotSpotResolvedJavaMethod hsMethod = (HotSpotResolvedJavaMethod) callTarget.targetMethod();
ResolvedJavaType receiverType = invoke.getReceiverType();
if (hsMethod.isInVirtualMethodTable(receiverType)) {
JavaKind wordKind = runtime.getTarget().wordJavaKind;
ValueNode hub = createReadHub(graph, receiver, tool);
ReadNode metaspaceMethod = createReadVirtualMethod(graph, hub, hsMethod, receiverType);
// We use LocationNode.ANY_LOCATION for the reads that access the
// compiled code entry as HotSpot does not guarantee they are final
// values.
int methodCompiledEntryOffset = runtime.getVMConfig().methodCompiledEntryOffset;
AddressNode address = createOffsetAddress(graph, metaspaceMethod, methodCompiledEntryOffset);
ReadNode compiledEntry = graph.add(new ReadNode(address, any(), StampFactory.forKind(wordKind), BarrierType.NONE));
loweredCallTarget = graph.add(new HotSpotIndirectCallTargetNode(metaspaceMethod, compiledEntry, parameters.toArray(new ValueNode[parameters.size()]), callTarget.returnStamp(), signature, callTarget.targetMethod(), HotSpotCallingConventionType.JavaCall, callTarget.invokeKind()));
graph.addBeforeFixed(invoke.asNode(), metaspaceMethod);
graph.addAfterFixed(metaspaceMethod, compiledEntry);
}
}
if (loweredCallTarget == null) {
loweredCallTarget = graph.add(new HotSpotDirectCallTargetNode(parameters.toArray(new ValueNode[parameters.size()]), callTarget.returnStamp(), signature, callTarget.targetMethod(), HotSpotCallingConventionType.JavaCall, callTarget.invokeKind()));
}
callTarget.replaceAndDelete(loweredCallTarget);
}
}
Aggregations