use of com.oracle.truffle.llvm.runtime.LLVMTruffleObject in project sulong by graalvm.
the class LLVMI64ArrayLiteralNode method foreignWriteI64.
@Specialization(guards = "addr.isManaged()")
@ExplodeLoop
protected LLVMTruffleObject foreignWriteI64(VirtualFrame frame, LLVMTruffleObject addr, @Cached("createForeignWrite()") LLVMForeignWriteNode foreignWrite) {
LLVMTruffleObject currentPtr = addr;
for (int i = 0; i < values.length; i++) {
long currentValue = LLVMTypesGen.asLong(values[i].executeGeneric(frame));
foreignWrite.execute(currentPtr, currentValue);
currentPtr = currentPtr.increment(stride);
}
return addr;
}
use of com.oracle.truffle.llvm.runtime.LLVMTruffleObject in project sulong by graalvm.
the class LLVMIVarBitStoreNode method doForeign.
@Specialization(guards = "address.isManaged()")
protected Object doForeign(LLVMTruffleObject address, LLVMIVarBit value, @Cached("createForeignWrite()") LLVMForeignWriteNode foreignWrite) {
byte[] bytes = value.getBytes();
LLVMTruffleObject currentPtr = address;
for (int i = bytes.length - 1; i >= 0; i--) {
foreignWrite.execute(currentPtr, bytes[i]);
currentPtr = currentPtr.increment(I8_SIZE_IN_BYTES);
}
return null;
}
use of com.oracle.truffle.llvm.runtime.LLVMTruffleObject in project sulong by graalvm.
the class LLVMStoreVectorNode method writeVector.
@Specialization(guards = "address.isManaged()")
@ExplodeLoop
protected Object writeVector(LLVMTruffleObject address, LLVMAddressVector value, @Cached("createForeignWrite()") LLVMForeignWriteNode foreignWrite) {
assert value.getLength() == vectorLength;
LLVMTruffleObject currentPtr = address;
for (int i = 0; i < vectorLength; i++) {
foreignWrite.execute(currentPtr, value.getValue(i));
currentPtr = currentPtr.increment(ADDRESS_SIZE_IN_BYTES);
}
return null;
}
use of com.oracle.truffle.llvm.runtime.LLVMTruffleObject in project sulong by graalvm.
the class LLVMStoreVectorNode method writeVector.
@Specialization(guards = "address.isManaged()")
@ExplodeLoop
protected Object writeVector(LLVMTruffleObject address, LLVMFloatVector value, @Cached("createForeignWrite()") LLVMForeignWriteNode foreignWrite) {
assert value.getLength() == vectorLength;
LLVMTruffleObject currentPtr = address;
for (int i = 0; i < vectorLength; i++) {
foreignWrite.execute(currentPtr, value.getValue(i));
currentPtr = currentPtr.increment(FLOAT_SIZE_IN_BYTES);
}
return null;
}
use of com.oracle.truffle.llvm.runtime.LLVMTruffleObject in project sulong by graalvm.
the class LLVMStoreVectorNode method writeVector.
@Specialization(guards = "address.isManaged()")
@ExplodeLoop
protected Object writeVector(LLVMTruffleObject address, LLVMI16Vector value, @Cached("createForeignWrite()") LLVMForeignWriteNode foreignWrite) {
assert value.getLength() == vectorLength;
LLVMTruffleObject currentPtr = address;
for (int i = 0; i < vectorLength; i++) {
foreignWrite.execute(currentPtr, value.getValue(i));
currentPtr = currentPtr.increment(I16_SIZE_IN_BYTES);
}
return null;
}
Aggregations