Search in sources :

Example 1 with Method

use of com.oracle.truffle.llvm.runtime.interop.access.LLVMInteropType.Method in project graal by oracle.

the class LLVMInteropInvokeNode method doClazz.

@Specialization
@GenerateAOT.Exclude
Object doClazz(LLVMPointer receiver, LLVMInteropType.Clazz type, String method, Object[] arguments, @Cached LLVMInteropMethodInvokeNode invoke, @Cached LLVMSelfArgumentPackNode selfPackNode, @CachedLibrary(limit = "5") InteropLibrary interop) throws ArityException, UnknownIdentifierException, UnsupportedTypeException, UnsupportedMessageException {
    Object[] selfArgs = selfPackNode.execute(receiver, arguments);
    Method methodObject = type.findMethodByArgumentsWithSelf(method, selfArgs);
    if (methodObject == null) {
        return doStruct(receiver, type, method, arguments, interop);
    }
    long virtualIndex = methodObject.getVirtualIndex();
    return invoke.execute(receiver, method, type, methodObject, virtualIndex, selfArgs);
}
Also used : Method(com.oracle.truffle.llvm.runtime.interop.access.LLVMInteropType.Method) Specialization(com.oracle.truffle.api.dsl.Specialization)

Example 2 with Method

use of com.oracle.truffle.llvm.runtime.interop.access.LLVMInteropType.Method in project graal by oracle.

the class LLVMInteropNonvirtualCallNode method doResolve.

/**
 * @param receiver
 * @param method
 */
@Specialization
@GenerateAOT.Exclude
Object doResolve(LLVMPointer receiver, LLVMInteropType.Clazz type, String methodName, Method method, Object[] arguments, @Cached LLVMDynAccessSymbolNode dynAccessSymbolNode, @CachedLibrary(limit = "5") InteropLibrary interop, @Cached BranchProfile notFound) throws UnsupportedTypeException, ArityException, UnsupportedMessageException {
    Method newMethod = type.findMethodByArgumentsWithSelf(methodName, arguments);
    LLVMFunction newLLVMFunction = getLLVMFunction(newMethod, type, notFound);
    Object newReceiver = dynAccessSymbolNode.execute(newLLVMFunction);
    return interop.execute(newReceiver, arguments);
}
Also used : LLVMFunction(com.oracle.truffle.llvm.runtime.LLVMFunction) Method(com.oracle.truffle.llvm.runtime.interop.access.LLVMInteropType.Method) Specialization(com.oracle.truffle.api.dsl.Specialization)

Aggregations

Specialization (com.oracle.truffle.api.dsl.Specialization)2 Method (com.oracle.truffle.llvm.runtime.interop.access.LLVMInteropType.Method)2 LLVMFunction (com.oracle.truffle.llvm.runtime.LLVMFunction)1