use of com.oracle.truffle.api.dsl.Specialization 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.api.dsl.Specialization 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.api.dsl.Specialization 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.api.dsl.Specialization 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;
}
use of com.oracle.truffle.api.dsl.Specialization in project sulong by graalvm.
the class LLVMStoreVectorNode method writeVector.
@Specialization(guards = "address.isManaged()")
@ExplodeLoop
protected Object writeVector(LLVMTruffleObject address, LLVMI64Vector 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(I64_SIZE_IN_BYTES);
}
return null;
}
Aggregations