Search in sources :

Example 1 with UnsupportedNativeTypeException

use of com.oracle.truffle.llvm.runtime.NFIContextExtension.UnsupportedNativeTypeException in project sulong by graalvm.

the class LLVMDispatchNode method getSignature.

private String getSignature() {
    if (signature == null) {
        CompilerDirectives.transferToInterpreterAndInvalidate();
        try {
            LLVMContext context = getContextReference().get();
            NFIContextExtension nfiContextExtension = context.getContextExtension(NFIContextExtension.class);
            this.signature = nfiContextExtension.getNativeSignature(type, LLVMCallNode.USER_ARGUMENT_OFFSET);
        } catch (UnsupportedNativeTypeException ex) {
            throw new AssertionError(ex);
        }
    }
    return signature;
}
Also used : LLVMContext(com.oracle.truffle.llvm.runtime.LLVMContext) UnsupportedNativeTypeException(com.oracle.truffle.llvm.runtime.NFIContextExtension.UnsupportedNativeTypeException) NFIContextExtension(com.oracle.truffle.llvm.runtime.NFIContextExtension)

Example 2 with UnsupportedNativeTypeException

use of com.oracle.truffle.llvm.runtime.NFIContextExtension.UnsupportedNativeTypeException in project sulong by graalvm.

the class LLVMNativeDispatchNode method identityFunction.

@TruffleBoundary
protected TruffleObject identityFunction() {
    LLVMContext context = getContextReference().get();
    NFIContextExtension nfiContextExtension = context.getContextExtension(NFIContextExtension.class);
    String signature;
    try {
        signature = nfiContextExtension.getNativeSignature(type, LLVMCallNode.USER_ARGUMENT_OFFSET);
    } catch (UnsupportedNativeTypeException e) {
        throw new IllegalStateException(e);
    }
    return nfiContextExtension.getNativeFunction(context, "@identity", String.format("(POINTER):%s", signature));
}
Also used : LLVMContext(com.oracle.truffle.llvm.runtime.LLVMContext) UnsupportedNativeTypeException(com.oracle.truffle.llvm.runtime.NFIContextExtension.UnsupportedNativeTypeException) NFIContextExtension(com.oracle.truffle.llvm.runtime.NFIContextExtension) TruffleBoundary(com.oracle.truffle.api.CompilerDirectives.TruffleBoundary)

Aggregations

LLVMContext (com.oracle.truffle.llvm.runtime.LLVMContext)2 NFIContextExtension (com.oracle.truffle.llvm.runtime.NFIContextExtension)2 UnsupportedNativeTypeException (com.oracle.truffle.llvm.runtime.NFIContextExtension.UnsupportedNativeTypeException)2 TruffleBoundary (com.oracle.truffle.api.CompilerDirectives.TruffleBoundary)1