use of org.graalvm.compiler.lir.amd64.AMD64CCall in project graal by oracle.
the class AMD64HotSpotLIRGenerator method emitCCall.
@Override
public void emitCCall(long address, CallingConvention nativeCallingConvention, Value[] args, int numberOfFloatingPointArguments) {
Value[] argLocations = new Value[args.length];
getResult().getFrameMapBuilder().callsMethod(nativeCallingConvention);
// TODO(mg): in case a native function uses floating point varargs, the ABI requires that
// RAX contains the length of the varargs
PrimitiveConstant intConst = JavaConstant.forInt(numberOfFloatingPointArguments);
AllocatableValue numberOfFloatingPointArgumentsRegister = AMD64.rax.asValue(LIRKind.value(AMD64Kind.DWORD));
emitMoveConstant(numberOfFloatingPointArgumentsRegister, intConst);
for (int i = 0; i < args.length; i++) {
Value arg = args[i];
AllocatableValue loc = nativeCallingConvention.getArgument(i);
emitMove(loc, arg);
argLocations[i] = loc;
}
Value ptr = emitLoadConstant(LIRKind.value(AMD64Kind.QWORD), JavaConstant.forLong(address));
append(new AMD64CCall(nativeCallingConvention.getReturn(), ptr, numberOfFloatingPointArgumentsRegister, argLocations));
}
Aggregations