use of com.oracle.truffle.api.dsl.Specialization in project sulong by graalvm.
the class StructLiteralNode method doLLVMTruffleObject.
@ExplodeLoop
@Specialization
protected LLVMTruffleObject doLLVMTruffleObject(VirtualFrame frame, LLVMTruffleObject address) {
for (int i = 0; i < offsets.length; i++) {
LLVMTruffleObject currentAddr = address.increment(offsets[i]);
Object value = values[i] == null ? null : values[i].executeGeneric(frame);
elementWriteNodes[i].executeWithTarget(currentAddr, value);
}
return address;
}
use of com.oracle.truffle.api.dsl.Specialization in project sulong by graalvm.
the class StructLiteralNode method doLLVMAddress.
@ExplodeLoop
@Specialization
protected LLVMAddress doLLVMAddress(VirtualFrame frame, LLVMAddress address) {
for (int i = 0; i < offsets.length; i++) {
LLVMAddress currentAddr = address.increment(offsets[i]);
Object value = values[i] == null ? null : values[i].executeGeneric(frame);
elementWriteNodes[i].executeWithTarget(currentAddr, value);
}
return address;
}
use of com.oracle.truffle.api.dsl.Specialization in project sulong by graalvm.
the class NativeMemSetNode method memset.
@SuppressWarnings("unused")
@Specialization(guards = { "isManagedMallocObject(object)", "value == 0" })
protected Object memset(LLVMTruffleObject object, byte value, long length) {
assert length % ADDRESS_SIZE_IN_BYTES == 0;
final ManagedMallocObject obj = (ManagedMallocObject) object.getObject();
int arrayOffset = (int) (object.getOffset() / ADDRESS_SIZE_IN_BYTES);
for (int i = 0; i < length / ADDRESS_SIZE_IN_BYTES; i++) {
obj.set(arrayOffset + i, LLVMAddress.nullPointer());
}
return null;
}
use of com.oracle.truffle.api.dsl.Specialization in project sulong by graalvm.
the class LLVM80BitFloatArrayLiteralNode method foreignWrite.
@Specialization
@ExplodeLoop
protected LLVMTruffleObject foreignWrite(VirtualFrame frame, LLVMTruffleObject addr, @Cached("create80BitFloatStore()") LLVM80BitFloatStoreNode write) {
LLVMTruffleObject currentPtr = addr;
for (int i = 0; i < values.length; i++) {
try {
LLVM80BitFloat currentValue = values[i].executeLLVM80BitFloat(frame);
write.executeWithTarget(addr, currentValue);
currentPtr = currentPtr.increment(stride);
} catch (UnexpectedResultException e) {
CompilerDirectives.transferToInterpreter();
throw new IllegalStateException(e);
}
}
return addr;
}
use of com.oracle.truffle.api.dsl.Specialization in project sulong by graalvm.
the class LLVM80BitFloatArrayLiteralNode method write80BitFloat.
@Specialization
@ExplodeLoop
protected LLVMAddress write80BitFloat(VirtualFrame frame, LLVMAddress addr, @Cached("getLLVMMemory()") LLVMMemory memory) {
long currentPtr = addr.getVal();
for (int i = 0; i < values.length; i++) {
try {
LLVM80BitFloat currentValue = values[i].executeLLVM80BitFloat(frame);
memory.put80BitFloat(currentPtr, currentValue);
currentPtr += stride;
} catch (UnexpectedResultException e) {
CompilerDirectives.transferToInterpreter();
throw new IllegalStateException(e);
}
}
return addr;
}
Aggregations