Search in sources :

Example 31 with LIRFrameState

use of org.graalvm.compiler.lir.LIRFrameState in project graal by oracle.

the class InitializeKlassStubCall method generate.

@Override
public void generate(NodeLIRBuilderTool gen) {
    assert constant != null : "Expected the value to fold: " + value;
    Value stringValue = gen.operand(string);
    LIRFrameState fs = gen.state(this);
    assert fs != null : "Frame state should be set";
    assert constant instanceof HotSpotMetaspaceConstant;
    Value result = ((HotSpotLIRGenerator) gen.getLIRGeneratorTool()).emitKlassInitializationAndRetrieval(constant, stringValue, fs);
    gen.setResult(this, result);
}
Also used : LIRFrameState(org.graalvm.compiler.lir.LIRFrameState) HotSpotLIRGenerator(org.graalvm.compiler.hotspot.HotSpotLIRGenerator) Value(jdk.vm.ci.meta.Value) HotSpotMetaspaceConstant(jdk.vm.ci.hotspot.HotSpotMetaspaceConstant)

Example 32 with LIRFrameState

use of org.graalvm.compiler.lir.LIRFrameState in project graal by oracle.

the class ResolveMethodAndLoadCountersStubCall method generate.

@Override
public void generate(NodeLIRBuilderTool gen) {
    assert methodConstant != null : "Expected method to fold: " + method;
    Value methodDescriptionValue = gen.operand(methodDescription);
    Value klassHintValue = gen.operand(klassHint);
    LIRFrameState fs = gen.state(this);
    assert fs != null : "The stateAfter is null";
    Value result = ((HotSpotLIRGenerator) gen.getLIRGeneratorTool()).emitResolveMethodAndLoadCounters(methodConstant, klassHintValue, methodDescriptionValue, fs);
    gen.setResult(this, result);
}
Also used : LIRFrameState(org.graalvm.compiler.lir.LIRFrameState) HotSpotLIRGenerator(org.graalvm.compiler.hotspot.HotSpotLIRGenerator) Value(jdk.vm.ci.meta.Value)

Example 33 with LIRFrameState

use of org.graalvm.compiler.lir.LIRFrameState in project graal by oracle.

the class NodeLIRBuilder method emitInvoke.

@Override
public void emitInvoke(Invoke x) {
    LoweredCallTargetNode callTarget = (LoweredCallTargetNode) x.callTarget();
    FrameMapBuilder frameMapBuilder = gen.getResult().getFrameMapBuilder();
    CallingConvention invokeCc = frameMapBuilder.getRegisterConfig().getCallingConvention(callTarget.callType(), x.asNode().stamp(NodeView.DEFAULT).javaType(gen.getMetaAccess()), callTarget.signature(), gen);
    frameMapBuilder.callsMethod(invokeCc);
    Value[] parameters = visitInvokeArguments(invokeCc, callTarget.arguments());
    LabelRef exceptionEdge = null;
    if (x instanceof InvokeWithExceptionNode) {
        exceptionEdge = getLIRBlock(((InvokeWithExceptionNode) x).exceptionEdge());
    }
    LIRFrameState callState = stateWithExceptionEdge(x, exceptionEdge);
    Value result = invokeCc.getReturn();
    if (callTarget instanceof DirectCallTargetNode) {
        emitDirectCall((DirectCallTargetNode) callTarget, result, parameters, AllocatableValue.NONE, callState);
    } else if (callTarget instanceof IndirectCallTargetNode) {
        emitIndirectCall((IndirectCallTargetNode) callTarget, result, parameters, AllocatableValue.NONE, callState);
    } else {
        throw GraalError.shouldNotReachHere();
    }
    if (isLegal(result)) {
        setResult(x.asNode(), gen.emitMove(result));
    }
    if (x instanceof InvokeWithExceptionNode) {
        gen.emitJump(getLIRBlock(((InvokeWithExceptionNode) x).next()));
    }
}
Also used : CallingConvention(jdk.vm.ci.code.CallingConvention) LIRFrameState(org.graalvm.compiler.lir.LIRFrameState) InvokeWithExceptionNode(org.graalvm.compiler.nodes.InvokeWithExceptionNode) FrameMapBuilder(org.graalvm.compiler.lir.framemap.FrameMapBuilder) DirectCallTargetNode(org.graalvm.compiler.nodes.DirectCallTargetNode) ComplexMatchValue(org.graalvm.compiler.core.match.ComplexMatchValue) Value(jdk.vm.ci.meta.Value) AllocatableValue(jdk.vm.ci.meta.AllocatableValue) IndirectCallTargetNode(org.graalvm.compiler.nodes.IndirectCallTargetNode) LoweredCallTargetNode(org.graalvm.compiler.nodes.LoweredCallTargetNode) LabelRef(org.graalvm.compiler.lir.LabelRef)

Aggregations

LIRFrameState (org.graalvm.compiler.lir.LIRFrameState)33 GraalCompilerTest (org.graalvm.compiler.core.test.GraalCompilerTest)15 Test (org.junit.Test)15 Register (jdk.vm.ci.code.Register)7 Value (jdk.vm.ci.meta.Value)7 VirtualObject (jdk.vm.ci.code.VirtualObject)5 Variable (org.graalvm.compiler.lir.Variable)5 ResolvedJavaType (jdk.vm.ci.meta.ResolvedJavaType)4 AllocatableValue (jdk.vm.ci.meta.AllocatableValue)3 DebugContext (org.graalvm.compiler.debug.DebugContext)3 HotSpotForeignCallLinkage (org.graalvm.compiler.hotspot.HotSpotForeignCallLinkage)3 HotSpotLIRGenerator (org.graalvm.compiler.hotspot.HotSpotLIRGenerator)3 SaveRegistersOp (org.graalvm.compiler.lir.StandardOp.SaveRegistersOp)3 BytecodeFrame (jdk.vm.ci.code.BytecodeFrame)2 CallingConvention (jdk.vm.ci.code.CallingConvention)2 HotSpotMetaspaceConstant (jdk.vm.ci.hotspot.HotSpotMetaspaceConstant)2 JavaValue (jdk.vm.ci.meta.JavaValue)2 HotSpotLIRGenerationResult (org.graalvm.compiler.hotspot.HotSpotLIRGenerationResult)2 HotSpotRegistersProvider (org.graalvm.compiler.hotspot.meta.HotSpotRegistersProvider)2 Stub (org.graalvm.compiler.hotspot.stubs.Stub)2