Search in sources :

Example 66 with Substitute

use of com.oracle.svm.core.annotate.Substitute in project graal by oracle.

the class Target_com_oracle_truffle_nfi_impl_NFIContext method prepareSignatureVarargs.

@Substitute
@SuppressWarnings("static-method")
long prepareSignatureVarargs(Target_com_oracle_truffle_nfi_impl_LibFFIType retType, int nFixedArgs, Target_com_oracle_truffle_nfi_impl_LibFFIType... args) {
    CifData data = PrepareHelper.prepareArgs(args);
    int ret = LibFFI.ffi_prep_cif_var(data.cif(), LibFFI.FFI_DEFAULT_ABI(), WordFactory.unsigned(nFixedArgs), WordFactory.unsigned(args.length), WordFactory.pointer(retType.type), data.args());
    return PrepareHelper.checkRet(data, ret);
}
Also used : CifData(com.oracle.svm.truffle.nfi.NativeSignature.CifData) Substitute(com.oracle.svm.core.annotate.Substitute)

Example 67 with Substitute

use of com.oracle.svm.core.annotate.Substitute in project graal by oracle.

the class Target_com_oracle_truffle_nfi_impl_NFIContext method initializeNativeContext.

// Checkstyle: resume
@Substitute
private long initializeNativeContext() {
    TruffleNFISupport support = ImageSingletons.lookup(TruffleNFISupport.class);
    NativeTruffleContext ret = UnmanagedMemory.malloc(SizeOf.get(NativeTruffleContext.class));
    ret.setContextHandle(support.createContextHandle(this));
    NFIInitialization.initializeContext(ret);
    return ret.rawValue();
}
Also used : NativeTruffleContext(com.oracle.svm.truffle.nfi.NativeAPI.NativeTruffleContext) Substitute(com.oracle.svm.core.annotate.Substitute)

Example 68 with Substitute

use of com.oracle.svm.core.annotate.Substitute in project graal by oracle.

the class Target_com_oracle_truffle_nfi_impl_NFIContext method initializeNativeEnv.

@Substitute
private static long initializeNativeEnv(long context) {
    NativeTruffleContext ctx = WordFactory.pointer(context);
    NativeTruffleEnv env = UnmanagedMemory.malloc(SizeOf.get(NativeTruffleEnv.class));
    NFIInitialization.initializeEnv(env, ctx);
    return env.rawValue();
}
Also used : NativeTruffleEnv(com.oracle.svm.truffle.nfi.NativeAPI.NativeTruffleEnv) NativeTruffleContext(com.oracle.svm.truffle.nfi.NativeAPI.NativeTruffleContext) Substitute(com.oracle.svm.core.annotate.Substitute)

Example 69 with Substitute

use of com.oracle.svm.core.annotate.Substitute in project graal by oracle.

the class Target_com_oracle_truffle_nfi_impl_NFIContext method disposeNativeContext.

@Substitute
private static void disposeNativeContext(long context) {
    TruffleNFISupport support = ImageSingletons.lookup(TruffleNFISupport.class);
    NativeTruffleContext ctx = WordFactory.pointer(context);
    support.destroyContextHandle(ctx.contextHandle());
    UnmanagedMemory.free(ctx);
}
Also used : NativeTruffleContext(com.oracle.svm.truffle.nfi.NativeAPI.NativeTruffleContext) Substitute(com.oracle.svm.core.annotate.Substitute)

Aggregations

Substitute (com.oracle.svm.core.annotate.Substitute)69 CCharPointer (org.graalvm.nativeimage.c.type.CCharPointer)18 SocketException (java.net.SocketException)11 IOException (java.io.IOException)10 CIntPointer (org.graalvm.nativeimage.c.type.CIntPointer)10 PinnedObject (org.graalvm.nativeimage.PinnedObject)9 Util_java_io_FileDescriptor (com.oracle.svm.core.posix.PosixOSInterface.Util_java_io_FileDescriptor)8 FileDescriptor (java.io.FileDescriptor)8 CCharPointerHolder (org.graalvm.nativeimage.c.type.CTypeConversion.CCharPointerHolder)8 ServerSocket (java.net.ServerSocket)7 Socket (com.oracle.svm.core.posix.headers.Socket)6 NativeTruffleContext (com.oracle.svm.truffle.nfi.NativeAPI.NativeTruffleContext)6 SignedWord (org.graalvm.word.SignedWord)6 InterruptedIOException (java.io.InterruptedIOException)5 Time.timeval (com.oracle.svm.core.posix.headers.Time.timeval)4 Uninterruptible (com.oracle.svm.core.annotate.Uninterruptible)3 Stat.fstat (com.oracle.svm.core.posix.headers.Stat.fstat)3 Stat.stat (com.oracle.svm.core.posix.headers.Stat.stat)3 Time.timezone (com.oracle.svm.core.posix.headers.Time.timezone)3 LibFFI.ffi_cif (com.oracle.svm.truffle.nfi.libffi.LibFFI.ffi_cif)3