Search in sources :

Example 1 with HotSpotDirectCallTargetNode

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));
    }
}
Also used : HotSpotDirectCallTargetNode(org.graalvm.compiler.hotspot.nodes.HotSpotDirectCallTargetNode) HotSpotResolvedJavaMethod(jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod) InvokeKind(org.graalvm.compiler.nodes.CallTargetNode.InvokeKind)

Example 2 with HotSpotDirectCallTargetNode

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));
    }
}
Also used : HotSpotDirectCallTargetNode(org.graalvm.compiler.hotspot.nodes.HotSpotDirectCallTargetNode) HotSpotResolvedJavaMethod(jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod) InvokeKind(org.graalvm.compiler.nodes.CallTargetNode.InvokeKind)

Example 3 with HotSpotDirectCallTargetNode

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));
    }
}
Also used : HotSpotDirectCallTargetNode(org.graalvm.compiler.hotspot.nodes.HotSpotDirectCallTargetNode) HotSpotResolvedJavaMethod(jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod) InvokeKind(org.graalvm.compiler.nodes.CallTargetNode.InvokeKind)

Example 4 with HotSpotDirectCallTargetNode

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);
    }
}
Also used : HotSpotDirectCallTargetNode(org.graalvm.compiler.hotspot.nodes.HotSpotDirectCallTargetNode) HotSpotResolvedJavaMethod(jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod) ObjectStamp(org.graalvm.compiler.core.common.type.ObjectStamp) OptionValues(org.graalvm.compiler.options.OptionValues) HotSpotIndirectCallTargetNode(org.graalvm.compiler.hotspot.nodes.HotSpotIndirectCallTargetNode) ResolvedJavaType(jdk.vm.ci.meta.ResolvedJavaType) ResolvedJavaType(jdk.vm.ci.meta.ResolvedJavaType) JavaType(jdk.vm.ci.meta.JavaType) MethodCallTargetNode(org.graalvm.compiler.nodes.java.MethodCallTargetNode) ValueNode(org.graalvm.compiler.nodes.ValueNode) GetObjectAddressNode(org.graalvm.compiler.hotspot.nodes.GetObjectAddressNode) ComputeObjectAddressNode(org.graalvm.compiler.hotspot.nodes.ComputeObjectAddressNode) AddressNode(org.graalvm.compiler.nodes.memory.address.AddressNode) FloatingReadNode(org.graalvm.compiler.nodes.memory.FloatingReadNode) ReadNode(org.graalvm.compiler.nodes.memory.ReadNode) LoweredCallTargetNode(org.graalvm.compiler.nodes.LoweredCallTargetNode) JavaKind(jdk.vm.ci.meta.JavaKind)

Aggregations

HotSpotResolvedJavaMethod (jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod)4 HotSpotDirectCallTargetNode (org.graalvm.compiler.hotspot.nodes.HotSpotDirectCallTargetNode)4 InvokeKind (org.graalvm.compiler.nodes.CallTargetNode.InvokeKind)3 JavaKind (jdk.vm.ci.meta.JavaKind)1 JavaType (jdk.vm.ci.meta.JavaType)1 ResolvedJavaType (jdk.vm.ci.meta.ResolvedJavaType)1 ObjectStamp (org.graalvm.compiler.core.common.type.ObjectStamp)1 ComputeObjectAddressNode (org.graalvm.compiler.hotspot.nodes.ComputeObjectAddressNode)1 GetObjectAddressNode (org.graalvm.compiler.hotspot.nodes.GetObjectAddressNode)1 HotSpotIndirectCallTargetNode (org.graalvm.compiler.hotspot.nodes.HotSpotIndirectCallTargetNode)1 LoweredCallTargetNode (org.graalvm.compiler.nodes.LoweredCallTargetNode)1 ValueNode (org.graalvm.compiler.nodes.ValueNode)1 MethodCallTargetNode (org.graalvm.compiler.nodes.java.MethodCallTargetNode)1 FloatingReadNode (org.graalvm.compiler.nodes.memory.FloatingReadNode)1 ReadNode (org.graalvm.compiler.nodes.memory.ReadNode)1 AddressNode (org.graalvm.compiler.nodes.memory.address.AddressNode)1 OptionValues (org.graalvm.compiler.options.OptionValues)1