Search in sources :

Example 26 with CEntryPointOptions

use of com.oracle.svm.core.c.function.CEntryPointOptions in project graal by oracle.

the class NativeClosure method invokeClosureObjectRet.

@CEntryPoint
@CEntryPointOptions(prologue = EnterClosureDataIsolatePrologue.class, publishAs = Publish.NotPublished, include = CEntryPointOptions.NotIncludedAutomatically.class)
static void invokeClosureObjectRet(@SuppressWarnings("unused") ffi_cif cif, WordPointer ret, WordPointer args, ClosureData user) {
    CIntPointer errnoMirror = ErrnoMirror.getErrnoMirrorLocation();
    errnoMirror.write(Errno.errno());
    try {
        Object obj = lookup(user).call(args, null);
        if (obj == null) {
            ret.write(WordFactory.zero());
        } else {
            TruffleObjectHandle handle = ImageSingletons.lookup(TruffleNFISupport.class).createGlobalHandle(obj);
            ret.write(handle);
        }
    } finally {
        Errno.set_errno(errnoMirror.read());
    }
}
Also used : CIntPointer(org.graalvm.nativeimage.c.type.CIntPointer) PinnedObject(org.graalvm.nativeimage.PinnedObject) CEntryPoint(org.graalvm.nativeimage.c.function.CEntryPoint) CEntryPointOptions(com.oracle.svm.core.c.function.CEntryPointOptions)

Example 27 with CEntryPointOptions

use of com.oracle.svm.core.c.function.CEntryPointOptions in project graal by oracle.

the class NativeClosure method invokeClosureStringRet.

@CEntryPoint
@CEntryPointOptions(prologue = EnterClosureDataIsolatePrologue.class, publishAs = Publish.NotPublished, include = CEntryPointOptions.NotIncludedAutomatically.class)
static void invokeClosureStringRet(@SuppressWarnings("unused") ffi_cif cif, WordPointer ret, WordPointer args, ClosureData user) {
    CIntPointer errnoMirror = ErrnoMirror.getErrnoMirrorLocation();
    errnoMirror.write(Errno.errno());
    try {
        Object retValue = lookup(user).call(args, null);
        ret.write(serializeStringRet(retValue));
    } finally {
        Errno.set_errno(errnoMirror.read());
    }
}
Also used : CIntPointer(org.graalvm.nativeimage.c.type.CIntPointer) PinnedObject(org.graalvm.nativeimage.PinnedObject) CEntryPoint(org.graalvm.nativeimage.c.function.CEntryPoint) CEntryPointOptions(com.oracle.svm.core.c.function.CEntryPointOptions)

Aggregations

CEntryPointOptions (com.oracle.svm.core.c.function.CEntryPointOptions)27 CEntryPoint (org.graalvm.nativeimage.c.function.CEntryPoint)26 CIntPointer (org.graalvm.nativeimage.c.type.CIntPointer)5 TruffleObject (com.oracle.truffle.api.interop.TruffleObject)4 JNIObjectHandle (com.oracle.svm.jni.nativeapi.JNIObjectHandle)3 PinnedObject (org.graalvm.nativeimage.PinnedObject)3 Log (com.oracle.svm.core.log.Log)2 JNIAccessibleMethodDescriptor (com.oracle.svm.jni.access.JNIAccessibleMethodDescriptor)2 JNINativeLinkage (com.oracle.svm.jni.access.JNINativeLinkage)2 JNIMethodId (com.oracle.svm.jni.nativeapi.JNIMethodId)2 JNINativeMethod (com.oracle.svm.jni.nativeapi.JNINativeMethod)2 Executable (java.lang.reflect.Executable)2 Method (java.lang.reflect.Method)2 ByteBuffer (java.nio.ByteBuffer)2 WordPointer (org.graalvm.nativeimage.c.type.WordPointer)2 WrappedJavaMethod (com.oracle.graal.pointsto.infrastructure.WrappedJavaMethod)1 AnalysisMethod (com.oracle.graal.pointsto.meta.AnalysisMethod)1 AllocationSite (com.oracle.svm.core.allocationprofile.AllocationSite)1 RestrictHeapAccess (com.oracle.svm.core.annotate.RestrictHeapAccess)1 Uninterruptible (com.oracle.svm.core.annotate.Uninterruptible)1