Search in sources :

Example 1 with ManagedMallocObject

use of com.oracle.truffle.llvm.nodes.intrinsics.interop.LLVMTruffleManagedMalloc.ManagedMallocObject 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;
}
Also used : ManagedMallocObject(com.oracle.truffle.llvm.nodes.intrinsics.interop.LLVMTruffleManagedMalloc.ManagedMallocObject) Specialization(com.oracle.truffle.api.dsl.Specialization)

Aggregations

Specialization (com.oracle.truffle.api.dsl.Specialization)1 ManagedMallocObject (com.oracle.truffle.llvm.nodes.intrinsics.interop.LLVMTruffleManagedMalloc.ManagedMallocObject)1