Search in sources :

Example 26 with Specialization

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;
}
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 Specialization

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

Example 28 with Specialization

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

Example 29 with Specialization

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

Example 30 with Specialization

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;
}
Also used : UnexpectedResultException(com.oracle.truffle.api.nodes.UnexpectedResultException) LLVM80BitFloat(com.oracle.truffle.llvm.runtime.floating.LLVM80BitFloat) 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