Search in sources :

Example 1 with LLVMPointer

use of com.oracle.truffle.llvm.runtime.pointer.LLVMPointer in project graal by oracle.

the class LLVMToDebugValueNode method fromGlobal.

@Specialization
protected LLVMDebugValue fromGlobal(LLVMDebugGlobalVariable value, @Cached BranchProfile exception) {
    LLVMGlobal global = value.getDescriptor();
    LLVMPointer target = getContext().getSymbol(global, exception);
    if (LLVMManagedPointer.isInstance(target)) {
        final LLVMManagedPointer managedPointer = LLVMManagedPointer.cast(target);
        if (LLDBSupport.pointsToObjectAccess(LLVMManagedPointer.cast(target))) {
            return new LLDBMemoryValue(managedPointer);
        }
    }
    return new LLDBGlobalConstant(global);
}
Also used : LLVMPointer(com.oracle.truffle.llvm.runtime.pointer.LLVMPointer) LLVMGlobal(com.oracle.truffle.llvm.runtime.global.LLVMGlobal) LLVMManagedPointer(com.oracle.truffle.llvm.runtime.pointer.LLVMManagedPointer) Specialization(com.oracle.truffle.api.dsl.Specialization)

Example 2 with LLVMPointer

use of com.oracle.truffle.llvm.runtime.pointer.LLVMPointer in project graal by oracle.

the class LLVMX86_64VaListStorage method getArgPtrFromNativePtr.

/**
 * Calculate the number of argument shifts in the overflow area.
 *
 * @param srcVaList
 * @param readLib
 */
private static long getArgPtrFromNativePtr(LLVMX86_64VaListStorage srcVaList, LLVMManagedReadLibrary readLib) {
    long curAddr;
    long baseAddr;
    LLVMPointer overflowAreaPtr = readLib.readPointer(srcVaList, X86_64BitVarArgs.OVERFLOW_ARG_AREA);
    if (LLVMNativePointer.isInstance(overflowAreaPtr)) {
        curAddr = LLVMNativePointer.cast(overflowAreaPtr).asNative();
    } else {
        curAddr = LLVMManagedPointer.cast(overflowAreaPtr).getOffset();
    }
    if (LLVMNativePointer.isInstance(srcVaList.overflowArgAreaBaseNativePtr)) {
        baseAddr = LLVMNativePointer.cast(srcVaList.overflowArgAreaBaseNativePtr).asNative();
    } else {
        baseAddr = LLVMManagedPointer.cast(srcVaList.overflowArgAreaBaseNativePtr).getOffset();
    }
    return curAddr - baseAddr;
}
Also used : LLVMPointer(com.oracle.truffle.llvm.runtime.pointer.LLVMPointer)

Example 3 with LLVMPointer

use of com.oracle.truffle.llvm.runtime.pointer.LLVMPointer in project graal by oracle.

the class LLVMAarch64VaListStorage method getArgPtrFromNativePtr.

/**
 * Calculate the number of argument shifts in the overflow area.
 *
 * @param srcVaList
 * @param readLib
 */
private static long getArgPtrFromNativePtr(LLVMAarch64VaListStorage srcVaList, LLVMManagedReadLibrary readLib) {
    long curAddr;
    long baseAddr;
    LLVMPointer overflowAreaPtr = readLib.readPointer(srcVaList, Aarch64BitVarArgs.OVERFLOW_ARG_AREA);
    if (LLVMNativePointer.isInstance(overflowAreaPtr)) {
        curAddr = LLVMNativePointer.cast(overflowAreaPtr).asNative();
    } else {
        curAddr = LLVMManagedPointer.cast(overflowAreaPtr).getOffset();
    }
    if (LLVMNativePointer.isInstance(srcVaList.overflowArgAreaBaseNativePtr)) {
        baseAddr = LLVMNativePointer.cast(srcVaList.overflowArgAreaBaseNativePtr).asNative();
    } else {
        baseAddr = LLVMManagedPointer.cast(srcVaList.overflowArgAreaBaseNativePtr).getOffset();
    }
    return curAddr - baseAddr;
}
Also used : LLVMPointer(com.oracle.truffle.llvm.runtime.pointer.LLVMPointer)

Example 4 with LLVMPointer

use of com.oracle.truffle.llvm.runtime.pointer.LLVMPointer in project graal by oracle.

the class AggregateLiteralInPlaceNode method writePrimitives.

private void writePrimitives(LLVMContext context, LLVMI8OffsetStoreNode storeI8, LLVMI64OffsetStoreNode storeI64, BranchProfile exception) {
    int offset = 0;
    int nextStore = 0;
    for (int i = 0; i < descriptors.length; i++) {
        LLVMPointer address = context.getSymbol(descriptors[i], exception);
        int bufferOffset = bufferOffsets[i];
        int bufferEnd = i == descriptors.length - 1 ? data.length : bufferOffsets[i + 1];
        while (offset < bufferEnd) {
            int nextStoreOffset = Math.min(offsets[nextStore], bufferEnd);
            offset = initializePrimitiveBlock(address, storeI8, storeI64, offset, nextStoreOffset, bufferOffset);
            if (offset < bufferEnd && nextStore < stores.length) {
                offset += sizes[nextStore++];
            }
        }
    }
}
Also used : LLVMPointer(com.oracle.truffle.llvm.runtime.pointer.LLVMPointer)

Example 5 with LLVMPointer

use of com.oracle.truffle.llvm.runtime.pointer.LLVMPointer in project graal by oracle.

the class AggregateLiteralInPlaceNode method writeObjects.

@ExplodeLoop
private void writeObjects(VirtualFrame frame, LLVMContext context, BranchProfile exception) {
    int offset = 0;
    int nextStore = 0;
    for (int i = 0; i < descriptors.length; i++) {
        LLVMPointer address = context.getSymbol(descriptors[i], exception);
        int bufferOffset = bufferOffsets[i];
        int bufferEnd = i == descriptors.length - 1 ? data.length : bufferOffsets[i + 1];
        while (offset < bufferEnd) {
            offset = Math.min(offsets[nextStore], bufferEnd);
            if (offset < bufferEnd && nextStore < stores.length) {
                stores[nextStore].executeWithTarget(frame, address, offset - bufferOffset);
                offset += sizes[nextStore++];
            }
        }
    }
}
Also used : LLVMPointer(com.oracle.truffle.llvm.runtime.pointer.LLVMPointer) ExplodeLoop(com.oracle.truffle.api.nodes.ExplodeLoop)

Aggregations

LLVMPointer (com.oracle.truffle.llvm.runtime.pointer.LLVMPointer)33 Specialization (com.oracle.truffle.api.dsl.Specialization)12 TruffleBoundary (com.oracle.truffle.api.CompilerDirectives.TruffleBoundary)5 LLVMGlobal (com.oracle.truffle.llvm.runtime.global.LLVMGlobal)4 TruffleSafepoint (com.oracle.truffle.api.TruffleSafepoint)3 ExportMessage (com.oracle.truffle.api.library.ExportMessage)3 ExplodeLoop (com.oracle.truffle.api.nodes.ExplodeLoop)3 UnexpectedResultException (com.oracle.truffle.api.nodes.UnexpectedResultException)3 BitcodeID (com.oracle.truffle.llvm.runtime.IDGenerater.BitcodeID)3 LLVMSymbol (com.oracle.truffle.llvm.runtime.LLVMSymbol)3 LLVMIllegalSymbolIndexException (com.oracle.truffle.llvm.runtime.except.LLVMIllegalSymbolIndexException)3 LLVMLinkerException (com.oracle.truffle.llvm.runtime.except.LLVMLinkerException)3 Assumption (com.oracle.truffle.api.Assumption)2 LLVMFunction (com.oracle.truffle.llvm.runtime.LLVMFunction)2 LLVMFunctionDescriptor (com.oracle.truffle.llvm.runtime.LLVMFunctionDescriptor)2 LLVMScopeChain (com.oracle.truffle.llvm.runtime.LLVMScopeChain)2 LLVM80BitFloat (com.oracle.truffle.llvm.runtime.floating.LLVM80BitFloat)2 LLVMForeignGetSuperElemPtrNode (com.oracle.truffle.llvm.runtime.interop.export.LLVMForeignGetSuperElemPtrNode)2 LLVMStack (com.oracle.truffle.llvm.runtime.memory.LLVMStack)2 LLVMManagedPointer (com.oracle.truffle.llvm.runtime.pointer.LLVMManagedPointer)2