use of jdk.vm.ci.code.CallingConvention in project graal by oracle.
the class AMD64HotSpotNodeLIRBuilder method emitPrologue.
@Override
protected void emitPrologue(StructuredGraph graph) {
CallingConvention incomingArguments = gen.getResult().getCallingConvention();
Value[] params = new Value[incomingArguments.getArgumentCount() + 1];
for (int i = 0; i < params.length - 1; i++) {
params[i] = incomingArguments.getArgument(i);
if (isStackSlot(params[i])) {
StackSlot slot = ValueUtil.asStackSlot(params[i]);
if (slot.isInCallerFrame() && !gen.getResult().getLIR().hasArgInCallerFrame()) {
gen.getResult().getLIR().setHasArgInCallerFrame();
}
}
}
params[params.length - 1] = rbp.asValue(LIRKind.value(AMD64Kind.QWORD));
gen.emitIncomingValues(params);
getGen().emitSaveRbp();
getGen().append(((HotSpotDebugInfoBuilder) getDebugInfoBuilder()).lockStack());
for (ParameterNode param : graph.getNodes(ParameterNode.TYPE)) {
Value paramValue = params[param.index()];
assert paramValue.getValueKind().equals(getLIRGeneratorTool().getLIRKind(param.stamp(NodeView.DEFAULT))) : paramValue.getValueKind() + " != " + param.stamp(NodeView.DEFAULT);
setResult(param, gen.emitMove(paramValue));
}
}
use of jdk.vm.ci.code.CallingConvention 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);
}
use of jdk.vm.ci.code.CallingConvention in project graal by oracle.
the class BitOpsTest method tzcntlMemTest.
@Test
public void tzcntlMemTest() {
if (tzcntSupported) {
CodeGenTest test = new CodeGenTest() {
@Override
public byte[] generateCode(CompilationResult compResult, TargetDescription target, RegisterConfig registerConfig, CallingConvention cc) {
AMD64Assembler asm = new AMD64Assembler(target);
Register ret = registerConfig.getReturnRegister(JavaKind.Int);
try {
Field f = IntField.class.getDeclaredField("x");
AMD64Address arg = new AMD64Address(asRegister(cc.getArgument(0)), (int) UNSAFE.objectFieldOffset(f));
TZCNT.emit(asm, DWORD, ret, arg);
asm.ret(0);
return asm.close(true);
} catch (Exception e) {
throw new RuntimeException("exception while trying to generate field access:", e);
}
}
};
assertReturn("intFieldStub", test, 31, new IntField(0x8000_0000));
}
}
use of jdk.vm.ci.code.CallingConvention in project graal by oracle.
the class BitOpsTest method tzcntqTest.
@Test
public void tzcntqTest() {
if (tzcntSupported) {
CodeGenTest test = new CodeGenTest() {
@Override
public byte[] generateCode(CompilationResult compResult, TargetDescription target, RegisterConfig registerConfig, CallingConvention cc) {
AMD64Assembler asm = new AMD64Assembler(target);
Register ret = registerConfig.getReturnRegister(JavaKind.Int);
Register arg = asRegister(cc.getArgument(0));
TZCNT.emit(asm, QWORD, ret, arg);
asm.ret(0);
return asm.close(true);
}
};
assertReturn("longStub", test, 63, 0x8000_0000_0000_0000L);
}
}
use of jdk.vm.ci.code.CallingConvention in project graal by oracle.
the class BitOpsTest method lzcntlTest.
@Test
public void lzcntlTest() {
if (lzcntSupported) {
CodeGenTest test = new CodeGenTest() {
@Override
public byte[] generateCode(CompilationResult compResult, TargetDescription target, RegisterConfig registerConfig, CallingConvention cc) {
AMD64Assembler asm = new AMD64Assembler(target);
Register ret = registerConfig.getReturnRegister(JavaKind.Int);
Register arg = asRegister(cc.getArgument(0));
LZCNT.emit(asm, DWORD, ret, arg);
asm.ret(0);
return asm.close(true);
}
};
assertReturn("intStub", test, 31, 1);
}
}
Aggregations