use of com.oracle.truffle.llvm.runtime.NFIContextExtension 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;
}
use of com.oracle.truffle.llvm.runtime.NFIContextExtension 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));
}
use of com.oracle.truffle.llvm.runtime.NFIContextExtension in project sulong by graalvm.
the class BasicNodeFactory method allocateGlobalIntern.
private static Object allocateGlobalIntern(LLVMParserRuntime runtime, final GlobalValueSymbol global, LLVMSourceSymbol sourceSymbol) {
final Type resolvedType = ((PointerType) global.getType()).getPointeeType();
final String name = global.getName();
LLVMContext context = runtime.getContext();
if (global.isExternal()) {
NFIContextExtension nfiContextExtension = context.getContextExtension(NFIContextExtension.class);
return LLVMGlobal.external(context, global, name, resolvedType, LLVMAddress.fromLong(nfiContextExtension.getNativeHandle(context, name)), sourceSymbol);
} else {
return LLVMGlobal.internal(context, global, name, resolvedType, sourceSymbol);
}
}
use of com.oracle.truffle.llvm.runtime.NFIContextExtension in project sulong by graalvm.
the class LLVMAMD64PosixCallNode method createFunction.
protected TruffleObject createFunction() {
LLVMContext context = getContextReference().get();
NFIContextExtension nfiContextExtension = context.getContextExtension(NFIContextExtension.class);
return nfiContextExtension.getNativeFunction(context, "@__sulong_posix_" + name, signature);
}
Aggregations