Search in sources :

Example 1 with ForeignCallLinkage

use of org.graalvm.compiler.core.common.spi.ForeignCallLinkage in project graal by oracle.

the class AArch64HotSpotNodeLIRBuilder method emitJumpToExceptionHandlerInCaller.

@Override
public void emitJumpToExceptionHandlerInCaller(ValueNode handlerInCallerPc, ValueNode exception, ValueNode exceptionPc) {
    Variable handler = gen.load(operand(handlerInCallerPc));
    ForeignCallLinkage linkage = gen.getForeignCalls().lookupForeignCall(EXCEPTION_HANDLER_IN_CALLER);
    CallingConvention outgoingCc = linkage.getOutgoingCallingConvention();
    assert outgoingCc.getArgumentCount() == 2;
    RegisterValue exceptionFixed = (RegisterValue) outgoingCc.getArgument(0);
    RegisterValue exceptionPcFixed = (RegisterValue) outgoingCc.getArgument(1);
    gen.emitMove(exceptionFixed, operand(exception));
    gen.emitMove(exceptionPcFixed, operand(exceptionPc));
    Register thread = getGen().getProviders().getRegisters().getThreadRegister();
    AArch64HotSpotJumpToExceptionHandlerInCallerOp op = new AArch64HotSpotJumpToExceptionHandlerInCallerOp(handler, exceptionFixed, exceptionPcFixed, getGen().config.threadIsMethodHandleReturnOffset, thread, getGen().config);
    append(op);
}
Also used : CallingConvention(jdk.vm.ci.code.CallingConvention) RegisterValue(jdk.vm.ci.code.RegisterValue) Variable(org.graalvm.compiler.lir.Variable) AArch64HotSpotRegisterConfig.inlineCacheRegister(jdk.vm.ci.hotspot.aarch64.AArch64HotSpotRegisterConfig.inlineCacheRegister) Register(jdk.vm.ci.code.Register) AArch64HotSpotRegisterConfig.metaspaceMethodRegister(jdk.vm.ci.hotspot.aarch64.AArch64HotSpotRegisterConfig.metaspaceMethodRegister) ForeignCallLinkage(org.graalvm.compiler.core.common.spi.ForeignCallLinkage)

Example 2 with ForeignCallLinkage

use of org.graalvm.compiler.core.common.spi.ForeignCallLinkage in project graal by oracle.

the class AMD64HotSpotLIRGenerator method emitUnwind.

@Override
public void emitUnwind(Value exception) {
    ForeignCallLinkage linkage = getForeignCalls().lookupForeignCall(HotSpotBackend.UNWIND_EXCEPTION_TO_CALLER);
    CallingConvention outgoingCc = linkage.getOutgoingCallingConvention();
    assert outgoingCc.getArgumentCount() == 2;
    RegisterValue exceptionParameter = (RegisterValue) outgoingCc.getArgument(0);
    emitMove(exceptionParameter, exception);
    append(new AMD64HotSpotUnwindOp(exceptionParameter));
}
Also used : CallingConvention(jdk.vm.ci.code.CallingConvention) RegisterValue(jdk.vm.ci.code.RegisterValue) ForeignCallLinkage(org.graalvm.compiler.core.common.spi.ForeignCallLinkage) HotSpotForeignCallLinkage(org.graalvm.compiler.hotspot.HotSpotForeignCallLinkage)

Example 3 with ForeignCallLinkage

use of org.graalvm.compiler.core.common.spi.ForeignCallLinkage in project graal by oracle.

the class AMD64HotSpotLIRGenerator method emitConstantRetrieval.

private Value emitConstantRetrieval(ForeignCallDescriptor foreignCall, Object[] notes, Constant[] constants, AllocatableValue[] constantDescriptions, LIRFrameState frameState) {
    ForeignCallLinkage linkage = getForeignCalls().lookupForeignCall(foreignCall);
    append(new AMD64HotSpotConstantRetrievalOp(constants, constantDescriptions, frameState, linkage, notes));
    AllocatableValue result = linkage.getOutgoingCallingConvention().getReturn();
    return emitMove(result);
}
Also used : ForeignCallLinkage(org.graalvm.compiler.core.common.spi.ForeignCallLinkage) HotSpotForeignCallLinkage(org.graalvm.compiler.hotspot.HotSpotForeignCallLinkage) AllocatableValue(jdk.vm.ci.meta.AllocatableValue)

Example 4 with ForeignCallLinkage

use of org.graalvm.compiler.core.common.spi.ForeignCallLinkage in project graal by oracle.

the class AMD64HotSpotNodeLIRBuilder method emitJumpToExceptionHandlerInCaller.

@Override
public void emitJumpToExceptionHandlerInCaller(ValueNode handlerInCallerPc, ValueNode exception, ValueNode exceptionPc) {
    Variable handler = gen.load(operand(handlerInCallerPc));
    ForeignCallLinkage linkage = gen.getForeignCalls().lookupForeignCall(EXCEPTION_HANDLER_IN_CALLER);
    CallingConvention outgoingCc = linkage.getOutgoingCallingConvention();
    assert outgoingCc.getArgumentCount() == 2;
    RegisterValue exceptionFixed = (RegisterValue) outgoingCc.getArgument(0);
    RegisterValue exceptionPcFixed = (RegisterValue) outgoingCc.getArgument(1);
    gen.emitMove(exceptionFixed, operand(exception));
    gen.emitMove(exceptionPcFixed, operand(exceptionPc));
    Register thread = getGen().getProviders().getRegisters().getThreadRegister();
    AMD64HotSpotJumpToExceptionHandlerInCallerOp op = new AMD64HotSpotJumpToExceptionHandlerInCallerOp(handler, exceptionFixed, exceptionPcFixed, getGen().config.threadIsMethodHandleReturnOffset, thread);
    append(op);
}
Also used : CallingConvention(jdk.vm.ci.code.CallingConvention) RegisterValue(jdk.vm.ci.code.RegisterValue) Variable(org.graalvm.compiler.lir.Variable) Register(jdk.vm.ci.code.Register) ForeignCallLinkage(org.graalvm.compiler.core.common.spi.ForeignCallLinkage)

Example 5 with ForeignCallLinkage

use of org.graalvm.compiler.core.common.spi.ForeignCallLinkage in project graal by oracle.

the class RegisterFinalizerNode method generate.

@Override
public void generate(NodeLIRBuilderTool gen) {
    // Note that an unconditional call to the runtime routine is made without
    // checking that the object actually has a finalizer. This requires the
    // runtime routine to do the check.
    ForeignCallLinkage linkage = gen.getLIRGeneratorTool().getForeignCalls().lookupForeignCall(REGISTER_FINALIZER);
    gen.getLIRGeneratorTool().emitForeignCall(linkage, gen.state(this), gen.operand(getValue()));
}
Also used : ForeignCallLinkage(org.graalvm.compiler.core.common.spi.ForeignCallLinkage)

Aggregations

ForeignCallLinkage (org.graalvm.compiler.core.common.spi.ForeignCallLinkage)16 CallingConvention (jdk.vm.ci.code.CallingConvention)9 Register (jdk.vm.ci.code.Register)7 RegisterValue (jdk.vm.ci.code.RegisterValue)6 ValueUtil.asRegister (jdk.vm.ci.code.ValueUtil.asRegister)4 Value (jdk.vm.ci.meta.Value)4 HotSpotForeignCallLinkage (org.graalvm.compiler.hotspot.HotSpotForeignCallLinkage)4 Variable (org.graalvm.compiler.lir.Variable)4 AllocatableValue (jdk.vm.ci.meta.AllocatableValue)2 AArch64HotSpotRegisterConfig.inlineCacheRegister (jdk.vm.ci.hotspot.aarch64.AArch64HotSpotRegisterConfig.inlineCacheRegister)1 AArch64HotSpotRegisterConfig.metaspaceMethodRegister (jdk.vm.ci.hotspot.aarch64.AArch64HotSpotRegisterConfig.metaspaceMethodRegister)1 ResolvedJavaMethod (jdk.vm.ci.meta.ResolvedJavaMethod)1 SPARCKind (jdk.vm.ci.sparc.SPARCKind)1 ScratchRegister (org.graalvm.compiler.asm.aarch64.AArch64MacroAssembler.ScratchRegister)1 AMD64Address (org.graalvm.compiler.asm.amd64.AMD64Address)1 LIRKind (org.graalvm.compiler.core.common.LIRKind)1 HotSpotForeignCallsProvider (org.graalvm.compiler.hotspot.meta.HotSpotForeignCallsProvider)1 HotSpotProviders (org.graalvm.compiler.hotspot.meta.HotSpotProviders)1 ConstantValue (org.graalvm.compiler.lir.ConstantValue)1 SPARCAddressValue (org.graalvm.compiler.lir.sparc.SPARCAddressValue)1