Search in sources :

Example 36 with Specialization

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;
}
Also used : LLVMTruffleObject(com.oracle.truffle.llvm.runtime.LLVMTruffleObject) Specialization(com.oracle.truffle.api.dsl.Specialization)

Example 37 with Specialization

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;
}
Also used : LLVMTruffleObject(com.oracle.truffle.llvm.runtime.LLVMTruffleObject) Specialization(com.oracle.truffle.api.dsl.Specialization) ExplodeLoop(com.oracle.truffle.api.nodes.ExplodeLoop)

Example 38 with Specialization

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;
}
Also used : LLVMTruffleObject(com.oracle.truffle.llvm.runtime.LLVMTruffleObject) Specialization(com.oracle.truffle.api.dsl.Specialization) ExplodeLoop(com.oracle.truffle.api.nodes.ExplodeLoop)

Example 39 with Specialization

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;
}
Also used : LLVMTruffleObject(com.oracle.truffle.llvm.runtime.LLVMTruffleObject) Specialization(com.oracle.truffle.api.dsl.Specialization) ExplodeLoop(com.oracle.truffle.api.nodes.ExplodeLoop)

Example 40 with Specialization

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;
}
Also used : LLVMTruffleObject(com.oracle.truffle.llvm.runtime.LLVMTruffleObject) Specialization(com.oracle.truffle.api.dsl.Specialization) ExplodeLoop(com.oracle.truffle.api.nodes.ExplodeLoop)

Aggregations

Specialization (com.oracle.truffle.api.dsl.Specialization)73 LLVMTruffleObject (com.oracle.truffle.llvm.runtime.LLVMTruffleObject)35 ExplodeLoop (com.oracle.truffle.api.nodes.ExplodeLoop)27 TruffleObject (com.oracle.truffle.api.interop.TruffleObject)16 UnsupportedMessageException (com.oracle.truffle.api.interop.UnsupportedMessageException)6 UnexpectedResultException (com.oracle.truffle.api.nodes.UnexpectedResultException)6 LLVMAddress (com.oracle.truffle.llvm.runtime.LLVMAddress)6 StackPointer (com.oracle.truffle.llvm.runtime.memory.LLVMStack.StackPointer)6 TruffleBoundary (com.oracle.truffle.api.CompilerDirectives.TruffleBoundary)5 FileValue (cz.cuni.mff.d3s.trupple.language.runtime.customvalues.FileValue)3 OptimizedCallTarget (org.graalvm.compiler.truffle.runtime.OptimizedCallTarget)3 Frame (com.oracle.truffle.api.frame.Frame)2 InteropException (com.oracle.truffle.api.interop.InteropException)2 UnknownIdentifierException (com.oracle.truffle.api.interop.UnknownIdentifierException)2 LLVMFunctionDescriptor (com.oracle.truffle.llvm.runtime.LLVMFunctionDescriptor)2 LLVM80BitFloat (com.oracle.truffle.llvm.runtime.floating.LLVM80BitFloat)2 SLRootNode (com.oracle.truffle.sl.nodes.SLRootNode)2 GenericArrayType (java.lang.reflect.GenericArrayType)2 Type (java.lang.reflect.Type)2 Assumption (com.oracle.truffle.api.Assumption)1