Search in sources :

Example 1 with LLVMForeignGetSuperElemPtrNode

use of com.oracle.truffle.llvm.runtime.interop.export.LLVMForeignGetSuperElemPtrNode in project graal by oracle.

the class LLVMResolveForeignClassChainNode method doClassResolvingCached.

/**
 * @param ident
 * @param clazz
 * @param cachedIdent
 * @param cachedClazz
 */
@Specialization(guards = { "ident.equals(cachedIdent)", "clazz==cachedClazz" })
public LLVMPointer doClassResolvingCached(LLVMPointer receiver, String ident, LLVMInteropType.Clazz clazz, @Cached(value = "ident", allowUncached = true) String cachedIdent, @Cached(value = "clazz", allowUncached = true) LLVMInteropType.Clazz cachedClazz, @Cached LLVMForeignVirtualSuperElemPtrNode virtualSuperElemPtrNode, @Cached LLVMForeignDirectSuperElemPtrNode directSuperElemPtrNode, @Cached(value = "clazz.getSuperOffsetInformation(ident)", allowUncached = true) Pair<long[], Struct> p, @Cached(value = "p.getLeft()") long[] offsetInformation) {
    LLVMPointer curReceiver = receiver;
    for (long val : offsetInformation) {
        LLVMForeignGetSuperElemPtrNode access = (val & 1) == 1 ? virtualSuperElemPtrNode : directSuperElemPtrNode;
        curReceiver = access.execute(curReceiver, val >> 1);
    }
    return curReceiver.export(p.getRight() == null ? clazz : p.getRight());
}
Also used : LLVMPointer(com.oracle.truffle.llvm.runtime.pointer.LLVMPointer) LLVMForeignGetSuperElemPtrNode(com.oracle.truffle.llvm.runtime.interop.export.LLVMForeignGetSuperElemPtrNode) Specialization(com.oracle.truffle.api.dsl.Specialization)

Example 2 with LLVMForeignGetSuperElemPtrNode

use of com.oracle.truffle.llvm.runtime.interop.export.LLVMForeignGetSuperElemPtrNode in project graal by oracle.

the class LLVMResolveForeignClassChainNode method doClazzResolving.

@Specialization(replaces = "doClassResolvingCached")
public LLVMPointer doClazzResolving(LLVMPointer receiver, String ident, LLVMInteropType.Clazz clazz, @Cached LLVMForeignVirtualSuperElemPtrNode virtualSuperElemPtrNode, @Cached LLVMForeignDirectSuperElemPtrNode directSuperElemPtrNode) throws UnknownIdentifierException {
    LLVMPointer curReceiver = receiver;
    Pair<long[], Struct> p = clazz.getSuperOffsetInformation(ident);
    for (long val : p.getLeft()) {
        LLVMForeignGetSuperElemPtrNode access = (val & 1) == 1 ? virtualSuperElemPtrNode : directSuperElemPtrNode;
        curReceiver = access.execute(curReceiver, val >> 1);
    }
    return curReceiver.export(p.getRight() == null ? clazz : p.getRight());
}
Also used : LLVMPointer(com.oracle.truffle.llvm.runtime.pointer.LLVMPointer) LLVMForeignGetSuperElemPtrNode(com.oracle.truffle.llvm.runtime.interop.export.LLVMForeignGetSuperElemPtrNode) Struct(com.oracle.truffle.llvm.runtime.interop.access.LLVMInteropType.Struct) Specialization(com.oracle.truffle.api.dsl.Specialization)

Aggregations

Specialization (com.oracle.truffle.api.dsl.Specialization)2 LLVMForeignGetSuperElemPtrNode (com.oracle.truffle.llvm.runtime.interop.export.LLVMForeignGetSuperElemPtrNode)2 LLVMPointer (com.oracle.truffle.llvm.runtime.pointer.LLVMPointer)2 Struct (com.oracle.truffle.llvm.runtime.interop.access.LLVMInteropType.Struct)1