Search in sources :

Example 26 with ExplodeLoop

use of com.oracle.truffle.api.nodes.ExplodeLoop in project sulong by graalvm.

the class LLVMAddressArrayLiteralNode method foreignWriteRef.

// TODO: work around a DSL bug (GR-6493): remove cached int a and int b
@SuppressWarnings("unused")
@Specialization(guards = "addr.isManaged()")
@ExplodeLoop
protected LLVMTruffleObject foreignWriteRef(VirtualFrame frame, LLVMTruffleObject addr, @Cached("0") int a, @Cached("0") int b, @Cached("createForeignWrites()") LLVMForeignWriteNode[] foreignWrites) {
    LLVMTruffleObject currentPtr = addr;
    for (int i = 0; i < values.length; i++) {
        Object currentValue = values[i].execute(frame);
        foreignWrites[i].execute(currentPtr, currentValue);
        currentPtr = currentPtr.increment(stride);
    }
    return addr;
}
Also used : LLVMTruffleObject(com.oracle.truffle.llvm.runtime.LLVMTruffleObject) LLVMTruffleObject(com.oracle.truffle.llvm.runtime.LLVMTruffleObject) Specialization(com.oracle.truffle.api.dsl.Specialization) ExplodeLoop(com.oracle.truffle.api.nodes.ExplodeLoop)

Example 27 with ExplodeLoop

use of com.oracle.truffle.api.nodes.ExplodeLoop in project sulong by graalvm.

the class LLVMFloatArrayLiteralNode method foreignWriteFloat.

@Specialization(guards = "addr.isManaged()")
@ExplodeLoop
protected LLVMTruffleObject foreignWriteFloat(VirtualFrame frame, LLVMTruffleObject addr, @Cached("createForeignWrite()") LLVMForeignWriteNode foreignWrite) {
    LLVMTruffleObject currentPtr = addr;
    for (int i = 0; i < values.length; i++) {
        float currentValue = LLVMTypesGen.asFloat(values[i].executeGeneric(frame));
        foreignWrite.execute(currentPtr, currentValue);
        currentPtr = currentPtr.increment(stride);
    }
    return addr;
}
Also used : LLVMTruffleObject(com.oracle.truffle.llvm.runtime.LLVMTruffleObject) Specialization(com.oracle.truffle.api.dsl.Specialization) ExplodeLoop(com.oracle.truffle.api.nodes.ExplodeLoop)

Example 28 with ExplodeLoop

use of com.oracle.truffle.api.nodes.ExplodeLoop in project sulong by graalvm.

the class LLVMI1ArrayLiteralNode method foreignWriteI1.

@Specialization(guards = "addr.isManaged()")
@ExplodeLoop
protected LLVMTruffleObject foreignWriteI1(VirtualFrame frame, LLVMTruffleObject addr, @Cached("createForeignWrite()") LLVMForeignWriteNode foreignWrite) {
    LLVMTruffleObject currentPtr = addr;
    for (int i = 0; i < values.length; i++) {
        boolean currentValue = LLVMTypesGen.asBoolean(values[i].executeGeneric(frame));
        foreignWrite.execute(currentPtr, currentValue);
        currentPtr = currentPtr.increment(stride);
    }
    return addr;
}
Also used : LLVMTruffleObject(com.oracle.truffle.llvm.runtime.LLVMTruffleObject) Specialization(com.oracle.truffle.api.dsl.Specialization) ExplodeLoop(com.oracle.truffle.api.nodes.ExplodeLoop)

Example 29 with ExplodeLoop

use of com.oracle.truffle.api.nodes.ExplodeLoop in project sulong by graalvm.

the class LLVMI32ArrayLiteralNode method foreignWriteI32.

@Specialization(guards = "addr.isManaged()")
@ExplodeLoop
protected LLVMTruffleObject foreignWriteI32(VirtualFrame frame, LLVMTruffleObject addr, @Cached("createForeignWrite()") LLVMForeignWriteNode foreignWrite) {
    LLVMTruffleObject currentPtr = addr;
    for (int i = 0; i < values.length; i++) {
        int currentValue = LLVMTypesGen.asInteger(values[i].executeGeneric(frame));
        foreignWrite.execute(currentPtr, currentValue);
        currentPtr = currentPtr.increment(stride);
    }
    return addr;
}
Also used : LLVMTruffleObject(com.oracle.truffle.llvm.runtime.LLVMTruffleObject) Specialization(com.oracle.truffle.api.dsl.Specialization) ExplodeLoop(com.oracle.truffle.api.nodes.ExplodeLoop)

Example 30 with ExplodeLoop

use of com.oracle.truffle.api.nodes.ExplodeLoop in project sulong by graalvm.

the class LLVMI8ArrayLiteralNode method foreignWriteI8.

@Specialization(guards = "addr.isManaged()")
@ExplodeLoop
protected LLVMTruffleObject foreignWriteI8(VirtualFrame frame, LLVMTruffleObject addr, @Cached("createForeignWrite()") LLVMForeignWriteNode foreignWrite) {
    LLVMTruffleObject currentPtr = addr;
    for (int i = 0; i < values.length; i++) {
        byte currentValue = LLVMTypesGen.asByte(values[i].executeGeneric(frame));
        foreignWrite.execute(currentPtr, currentValue);
        currentPtr = currentPtr.increment(stride);
    }
    return addr;
}
Also used : LLVMTruffleObject(com.oracle.truffle.llvm.runtime.LLVMTruffleObject) Specialization(com.oracle.truffle.api.dsl.Specialization) ExplodeLoop(com.oracle.truffle.api.nodes.ExplodeLoop)

Aggregations

ExplodeLoop (com.oracle.truffle.api.nodes.ExplodeLoop)34 Specialization (com.oracle.truffle.api.dsl.Specialization)27 LLVMTruffleObject (com.oracle.truffle.llvm.runtime.LLVMTruffleObject)25 UnexpectedResultException (com.oracle.truffle.api.nodes.UnexpectedResultException)5 TruffleObject (com.oracle.truffle.api.interop.TruffleObject)3 LLVMAddress (com.oracle.truffle.llvm.runtime.LLVMAddress)3 StackPointer (com.oracle.truffle.llvm.runtime.memory.LLVMStack.StackPointer)3 ArityException (com.oracle.truffle.api.interop.ArityException)2 UnsupportedMessageException (com.oracle.truffle.api.interop.UnsupportedMessageException)2 UnsupportedTypeException (com.oracle.truffle.api.interop.UnsupportedTypeException)2 LLVMContext (com.oracle.truffle.llvm.runtime.LLVMContext)2 LLVMFunctionDescriptor (com.oracle.truffle.llvm.runtime.LLVMFunctionDescriptor)2 LLVM80BitFloat (com.oracle.truffle.llvm.runtime.floating.LLVM80BitFloat)2 LLVMStack (com.oracle.truffle.llvm.runtime.memory.LLVMStack)2 GenericArrayType (java.lang.reflect.GenericArrayType)2 Type (java.lang.reflect.Type)2 Assumption (com.oracle.truffle.api.Assumption)1 UnknownIdentifierException (com.oracle.truffle.api.interop.UnknownIdentifierException)1 CodeAnnotationMirror (com.oracle.truffle.dsl.processor.java.model.CodeAnnotationMirror)1 CodeAnnotationValue (com.oracle.truffle.dsl.processor.java.model.CodeAnnotationValue)1