use of com.oracle.truffle.llvm.runtime.LLVMAddress in project sulong by graalvm.
the class LLVMInfo method uname.
public static long uname(LLVMMemory memory, LLVMAddress name) {
LLVMAddress ptr = name;
LLVMString.strcpy(memory, ptr, sysname);
ptr = ptr.increment(UTS_FIELD_LENGTH);
LLVMString.strcpy(memory, ptr, getHostname());
ptr = ptr.increment(UTS_FIELD_LENGTH);
LLVMString.strcpy(memory, ptr, release);
ptr = ptr.increment(UTS_FIELD_LENGTH);
LLVMString.strcpy(memory, ptr, getVersion());
ptr = ptr.increment(UTS_FIELD_LENGTH);
LLVMString.strcpy(memory, ptr, machine);
ptr = ptr.increment(UTS_FIELD_LENGTH);
LLVMString.strcpy(memory, ptr, getDomainName());
return 0;
}
use of com.oracle.truffle.llvm.runtime.LLVMAddress in project sulong by graalvm.
the class LLVMString method strcpy.
public static void strcpy(LLVMMemory memory, LLVMAddress dst, String src) {
memcpy(memory, getBytes(src), dst, src.length());
LLVMAddress zero = dst.increment(src.length());
memory.putI8(zero, (byte) 0);
}
use of com.oracle.truffle.llvm.runtime.LLVMAddress in project sulong by graalvm.
the class LLVMString method strncpy.
public static void strncpy(LLVMMemory memory, LLVMAddress dst, String src, long size) {
memcpy(memory, getBytes(src), dst, size);
if (src.length() < size) {
LLVMAddress zero = dst.increment(src.length());
memory.putI8(zero, (byte) 0);
}
}
use of com.oracle.truffle.llvm.runtime.LLVMAddress in project sulong by graalvm.
the class LLVMAMD64SyscallClockGetTimeNode method clockGetTime.
private static int clockGetTime(LLVMMemory memory, int clkId, LLVMAddress timespec) {
long s;
long ns;
switch(clkId) {
case CLOCK_REALTIME:
{
long t = currentTimeMillis();
s = t / 1000;
ns = (t % 1000) * 1000000;
break;
}
case CLOCK_MONOTONIC:
{
long t = nanoTime();
s = t / 1000000000L;
ns = (t % 1000000000L);
break;
}
default:
return -LLVMAMD64Error.EINVAL;
}
LLVMAddress ptr = timespec;
memory.putI64(ptr, s);
ptr = ptr.increment(8);
memory.putI64(ptr, ns);
return 0;
}
use of com.oracle.truffle.llvm.runtime.LLVMAddress in project sulong by graalvm.
the class LLVMPanic method doOp.
@Specialization
protected Object doOp(LLVMGlobal panicLocVar, @Cached("createToNativeWithTarget()") LLVMToNativeNode globalAccess, @Cached("createPanicLocation()") PanicLocType panicLoc, @Cached("getLLVMMemory()") LLVMMemory memory) {
LLVMAddress addr = globalAccess.executeWithTarget(panicLocVar);
CompilerDirectives.transferToInterpreter();
throw panicLoc.read(memory, addr.getVal());
}
Aggregations