Search in sources :

Example 16 with RegisterValue

use of jdk.vm.ci.code.RegisterValue in project graal by oracle.

the class SPARCHotSpotForeignCallsProvider method initialize.

@Override
public void initialize(HotSpotProviders providers, OptionValues options) {
    GraalHotSpotVMConfig config = runtime.getVMConfig();
    TargetDescription target = providers.getCodeCache().getTarget();
    PlatformKind word = target.arch.getWordKind();
    // The calling convention for the exception handler stub is (only?) defined in
    // TemplateInterpreterGenerator::generate_throw_exception()
    // in templateInterpreter_sparc.cpp around line 1925
    RegisterValue outgoingException = o0.asValue(LIRKind.fromJavaKind(target.arch, JavaKind.Object));
    RegisterValue outgoingExceptionPc = o1.asValue(LIRKind.value(word));
    RegisterValue incomingException = i0.asValue(LIRKind.fromJavaKind(target.arch, JavaKind.Object));
    RegisterValue incomingExceptionPc = i1.asValue(LIRKind.value(word));
    CallingConvention outgoingExceptionCc = new CallingConvention(0, ILLEGAL, outgoingException, outgoingExceptionPc);
    CallingConvention incomingExceptionCc = new CallingConvention(0, ILLEGAL, incomingException, incomingExceptionPc);
    register(new HotSpotForeignCallLinkageImpl(EXCEPTION_HANDLER, 0L, PRESERVES_REGISTERS, LEAF_NOFP, outgoingExceptionCc, incomingExceptionCc, NOT_REEXECUTABLE, any()));
    register(new HotSpotForeignCallLinkageImpl(EXCEPTION_HANDLER_IN_CALLER, JUMP_ADDRESS, PRESERVES_REGISTERS, LEAF_NOFP, outgoingExceptionCc, incomingExceptionCc, NOT_REEXECUTABLE, any()));
    if (config.useCRC32Intrinsics) {
        // This stub does callee saving
        registerForeignCall(UPDATE_BYTES_CRC32, config.updateBytesCRC32Stub, NativeCall, PRESERVES_REGISTERS, LEAF_NOFP, NOT_REEXECUTABLE, any());
    }
    if (config.useCRC32CIntrinsics) {
        registerForeignCall(UPDATE_BYTES_CRC32C, config.updateBytesCRC32C, NativeCall, PRESERVES_REGISTERS, LEAF_NOFP, NOT_REEXECUTABLE, any());
    }
    super.initialize(providers, options);
}
Also used : CallingConvention(jdk.vm.ci.code.CallingConvention) RegisterValue(jdk.vm.ci.code.RegisterValue) HotSpotForeignCallLinkageImpl(org.graalvm.compiler.hotspot.HotSpotForeignCallLinkageImpl) TargetDescription(jdk.vm.ci.code.TargetDescription) PlatformKind(jdk.vm.ci.meta.PlatformKind) GraalHotSpotVMConfig(org.graalvm.compiler.hotspot.GraalHotSpotVMConfig)

Example 17 with RegisterValue

use of jdk.vm.ci.code.RegisterValue in project graal by oracle.

the class SPARCHotSpotLIRGenerator method emitUnwind.

@Override
public void emitUnwind(Value exception) {
    ForeignCallLinkage linkage = getForeignCalls().lookupForeignCall(HotSpotBackend.UNWIND_EXCEPTION_TO_CALLER);
    CallingConvention linkageCc = linkage.getOutgoingCallingConvention();
    assert linkageCc.getArgumentCount() == 2;
    RegisterValue exceptionParameter = (RegisterValue) linkageCc.getArgument(0);
    emitMove(exceptionParameter, exception);
    append(new SPARCHotSpotUnwindOp(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 18 with RegisterValue

use of jdk.vm.ci.code.RegisterValue in project graal by oracle.

the class SPARCHotSpotLIRGenerator method moveValueToThread.

private void moveValueToThread(Value v, int offset) {
    LIRKind wordKind = LIRKind.value(target().arch.getWordKind());
    RegisterValue thread = getProviders().getRegisters().getThreadRegister().asValue(wordKind);
    SPARCAddressValue pendingDeoptAddress = new SPARCImmediateAddressValue(wordKind, thread, offset);
    append(new StoreOp(v.getPlatformKind(), pendingDeoptAddress, load(v), null));
}
Also used : RegisterValue(jdk.vm.ci.code.RegisterValue) SPARCImmediateAddressValue(org.graalvm.compiler.lir.sparc.SPARCImmediateAddressValue) SPARCAddressValue(org.graalvm.compiler.lir.sparc.SPARCAddressValue) StoreOp(org.graalvm.compiler.lir.sparc.SPARCMove.StoreOp) LIRKind(org.graalvm.compiler.core.common.LIRKind)

Example 19 with RegisterValue

use of jdk.vm.ci.code.RegisterValue in project graal by oracle.

the class SPARCHotSpotNodeLIRBuilder 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 linkageCc = linkage.getOutgoingCallingConvention();
    assert linkageCc.getArgumentCount() == 2;
    RegisterValue exceptionFixed = (RegisterValue) linkageCc.getArgument(0);
    RegisterValue exceptionPcFixed = (RegisterValue) linkageCc.getArgument(1);
    gen.emitMove(exceptionFixed, operand(exception));
    gen.emitMove(exceptionPcFixed, operand(exceptionPc));
    Register thread = getGen().getProviders().getRegisters().getThreadRegister();
    SPARCHotSpotJumpToExceptionHandlerInCallerOp op = new SPARCHotSpotJumpToExceptionHandlerInCallerOp(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 20 with RegisterValue

use of jdk.vm.ci.code.RegisterValue in project graal by oracle.

the class AMD64HotSpotForeignCallsProvider method initialize.

@Override
public void initialize(HotSpotProviders providers, OptionValues options) {
    GraalHotSpotVMConfig config = runtime.getVMConfig();
    TargetDescription target = providers.getCodeCache().getTarget();
    PlatformKind word = target.arch.getWordKind();
    // The calling convention for the exception handler stub is (only?) defined in
    // TemplateInterpreterGenerator::generate_throw_exception()
    // in templateInterpreter_x86_64.cpp around line 1923
    RegisterValue exception = rax.asValue(LIRKind.reference(word));
    RegisterValue exceptionPc = rdx.asValue(LIRKind.value(word));
    CallingConvention exceptionCc = new CallingConvention(0, ILLEGAL, exception, exceptionPc);
    register(new HotSpotForeignCallLinkageImpl(EXCEPTION_HANDLER, 0L, PRESERVES_REGISTERS, LEAF_NOFP, exceptionCc, null, NOT_REEXECUTABLE, any()));
    register(new HotSpotForeignCallLinkageImpl(EXCEPTION_HANDLER_IN_CALLER, JUMP_ADDRESS, PRESERVES_REGISTERS, LEAF_NOFP, exceptionCc, null, NOT_REEXECUTABLE, any()));
    link(new AMD64MathStub(ARITHMETIC_LOG_STUB, options, providers, registerStubCall(ARITHMETIC_LOG_STUB, REEXECUTABLE, LEAF, NO_LOCATIONS)));
    link(new AMD64MathStub(ARITHMETIC_LOG10_STUB, options, providers, registerStubCall(ARITHMETIC_LOG10_STUB, REEXECUTABLE, LEAF, NO_LOCATIONS)));
    link(new AMD64MathStub(ARITHMETIC_SIN_STUB, options, providers, registerStubCall(ARITHMETIC_SIN_STUB, REEXECUTABLE, LEAF, NO_LOCATIONS)));
    link(new AMD64MathStub(ARITHMETIC_COS_STUB, options, providers, registerStubCall(ARITHMETIC_COS_STUB, REEXECUTABLE, LEAF, NO_LOCATIONS)));
    link(new AMD64MathStub(ARITHMETIC_TAN_STUB, options, providers, registerStubCall(ARITHMETIC_TAN_STUB, REEXECUTABLE, LEAF, NO_LOCATIONS)));
    link(new AMD64MathStub(ARITHMETIC_EXP_STUB, options, providers, registerStubCall(ARITHMETIC_EXP_STUB, REEXECUTABLE, LEAF, NO_LOCATIONS)));
    link(new AMD64MathStub(ARITHMETIC_POW_STUB, options, providers, registerStubCall(ARITHMETIC_POW_STUB, REEXECUTABLE, LEAF, NO_LOCATIONS)));
    if (config.useCRC32Intrinsics) {
        // This stub does callee saving
        registerForeignCall(UPDATE_BYTES_CRC32, config.updateBytesCRC32Stub, NativeCall, PRESERVES_REGISTERS, LEAF_NOFP, NOT_REEXECUTABLE, any());
    }
    if (config.useCRC32CIntrinsics) {
        registerForeignCall(UPDATE_BYTES_CRC32C, config.updateBytesCRC32C, NativeCall, PRESERVES_REGISTERS, LEAF_NOFP, NOT_REEXECUTABLE, any());
    }
    super.initialize(providers, options);
}
Also used : CallingConvention(jdk.vm.ci.code.CallingConvention) RegisterValue(jdk.vm.ci.code.RegisterValue) HotSpotForeignCallLinkageImpl(org.graalvm.compiler.hotspot.HotSpotForeignCallLinkageImpl) TargetDescription(jdk.vm.ci.code.TargetDescription) PlatformKind(jdk.vm.ci.meta.PlatformKind) GraalHotSpotVMConfig(org.graalvm.compiler.hotspot.GraalHotSpotVMConfig)

Aggregations

RegisterValue (jdk.vm.ci.code.RegisterValue)30 CallingConvention (jdk.vm.ci.code.CallingConvention)9 Variable (org.graalvm.compiler.lir.Variable)9 LIRKind (org.graalvm.compiler.core.common.LIRKind)8 Register (jdk.vm.ci.code.Register)7 ForeignCallLinkage (org.graalvm.compiler.core.common.spi.ForeignCallLinkage)6 PlatformKind (jdk.vm.ci.meta.PlatformKind)4 LIRGeneratorTool (org.graalvm.compiler.lir.gen.LIRGeneratorTool)4 AMD64Kind (jdk.vm.ci.amd64.AMD64Kind)3 TargetDescription (jdk.vm.ci.code.TargetDescription)3 AllocatableValue (jdk.vm.ci.meta.AllocatableValue)3 GraalHotSpotVMConfig (org.graalvm.compiler.hotspot.GraalHotSpotVMConfig)3 HotSpotForeignCallLinkage (org.graalvm.compiler.hotspot.HotSpotForeignCallLinkage)3 HotSpotForeignCallLinkageImpl (org.graalvm.compiler.hotspot.HotSpotForeignCallLinkageImpl)3 AMD64AddressValue (org.graalvm.compiler.lir.amd64.AMD64AddressValue)3 CompareAndSwapOp (org.graalvm.compiler.lir.amd64.AMD64Move.CompareAndSwapOp)3 SubstrateRegisterConfig (com.oracle.svm.core.graal.meta.SubstrateRegisterConfig)2 ValueUtil.asRegisterValue (jdk.vm.ci.code.ValueUtil.asRegisterValue)2 TraceUtil.asShadowedRegisterValue (org.graalvm.compiler.lir.alloc.trace.TraceUtil.asShadowedRegisterValue)2 TraceUtil.isShadowedRegisterValue (org.graalvm.compiler.lir.alloc.trace.TraceUtil.isShadowedRegisterValue)2