use of org.graalvm.compiler.core.common.spi.ForeignCallLinkage in project graal by oracle.
the class AMD64HotSpotUnwindOp method emitCode.
@Override
public void emitCode(CompilationResultBuilder crb, AMD64MacroAssembler masm) {
leaveFrameAndRestoreRbp(crb, masm);
ForeignCallLinkage linkage = crb.foreignCalls.lookupForeignCall(UNWIND_EXCEPTION_TO_CALLER);
CallingConvention cc = linkage.getOutgoingCallingConvention();
assert cc.getArgumentCount() == 2;
assert exception.equals(cc.getArgument(0));
// Get return address (is on top of stack after leave).
Register returnAddress = asRegister(cc.getArgument(1));
masm.movq(returnAddress, new AMD64Address(rsp, 0));
AMD64Call.directJmp(crb, masm, linkage);
}
use of org.graalvm.compiler.core.common.spi.ForeignCallLinkage in project graal by oracle.
the class AArch64HotSpotLIRGenerator 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 AArch64HotSpotUnwindOp(config, exceptionParameter));
}
use of org.graalvm.compiler.core.common.spi.ForeignCallLinkage in project graal by oracle.
the class AArch64HotSpotBackend method emitCodeSuffix.
private void emitCodeSuffix(CompilationResultBuilder crb, AArch64MacroAssembler masm, FrameMap frameMap) {
HotSpotProviders providers = getProviders();
HotSpotFrameContext frameContext = (HotSpotFrameContext) crb.frameContext;
if (!frameContext.isStub) {
HotSpotForeignCallsProvider foreignCalls = providers.getForeignCalls();
try (ScratchRegister sc = masm.getScratchRegister()) {
Register scratch = sc.getRegister();
crb.recordMark(config.MARKID_EXCEPTION_HANDLER_ENTRY);
ForeignCallLinkage linkage = foreignCalls.lookupForeignCall(EXCEPTION_HANDLER);
Register helper = AArch64Call.isNearCall(linkage) ? null : scratch;
AArch64Call.directCall(crb, masm, linkage, helper, null);
}
crb.recordMark(config.MARKID_DEOPT_HANDLER_ENTRY);
ForeignCallLinkage linkage = foreignCalls.lookupForeignCall(DEOPTIMIZATION_HANDLER);
// Warning: the argument is an offset from the instruction!
masm.adr(lr, 0);
AArch64Call.directJmp(crb, masm, linkage);
} else {
// it has no calls that can cause such "return" entries
assert !frameMap.accessesCallerFrame();
}
}
use of org.graalvm.compiler.core.common.spi.ForeignCallLinkage in project graal by oracle.
the class AArch64HotSpotUnwindOp method emitCode.
@Override
public void emitCode(CompilationResultBuilder crb, AArch64MacroAssembler masm) {
leaveFrame(crb, masm, /* emitSafepoint */
false);
ForeignCallLinkage linkage = crb.foreignCalls.lookupForeignCall(UNWIND_EXCEPTION_TO_CALLER);
CallingConvention cc = linkage.getOutgoingCallingConvention();
assert cc.getArgumentCount() == 2;
assert exception.equals(cc.getArgument(0));
// Get return address (is in lr after frame leave)
Register returnAddress = asRegister(cc.getArgument(1));
masm.movx(returnAddress, lr);
AArch64Call.directJmp(crb, masm, linkage);
}
use of org.graalvm.compiler.core.common.spi.ForeignCallLinkage in project graal by oracle.
the class ForeignCallNode method generate.
@Override
public void generate(NodeLIRBuilderTool gen) {
ForeignCallLinkage linkage = gen.getLIRGeneratorTool().getForeignCalls().lookupForeignCall(descriptor);
Value[] operands = operands(gen);
Value result = gen.getLIRGeneratorTool().emitForeignCall(linkage, gen.state(this), operands);
if (result != null) {
gen.setResult(this, result);
}
}
Aggregations