public static LLVMAddress allocateCString(String string) { LLVMAddress baseAddress = LLVMHeap.allocateMemory(string.length() + 1); LLVMAddress currentAddress = baseAddress; for (int i = 0; i < string.length(); i++) { byte c = (byte) string.charAt(i); LLVMMemory.putI8(currentAddress, c); currentAddress = currentAddress.increment(1); } LLVMMemory.putI8(currentAddress, (byte) 0); return baseAddress; }
public static void memSet(LLVMAddress target, int value, long length) { long targetAddress = LLVMMemory.extractAddr(target); memSetHandle.call(targetAddress, value, length); }
public static int getFunctionIndex(LLVMAddress addr) { int functionIndex = UNSAFE.getInt(LLVMMemory.extractAddr(addr)); return functionIndex; }
public static void putFunctionIndex(LLVMAddress address, int functionIndex) { UNSAFE.putInt(LLVMMemory.extractAddr(address), functionIndex); }