Search in sources :

Example 56 with CEntryPoint

use of org.graalvm.nativeimage.c.function.CEntryPoint in project graal by oracle.

the class PolyglotNativeAPI method polyglot_create_float.

@SuppressWarnings("UnnecessaryBoxing")
@CEntryPoint(name = "polyglot_create_float")
public static PolyglotStatus polyglot_create_float(IsolateThread isolate_thread, PolyglotContextPointer polyglot_context, float value, PolyglotValuePointerPointer result) {
    return withHandledErrors(() -> {
        Context ctx = ObjectHandles.getGlobal().get(polyglot_context);
        result.write(createHandle(ctx.asValue(Float.valueOf(value))));
    });
}
Also used : CEntryPointContext(org.graalvm.nativeimage.c.function.CEntryPointContext) Context(org.graalvm.polyglot.Context) CEntryPoint(org.graalvm.nativeimage.c.function.CEntryPoint)

Example 57 with CEntryPoint

use of org.graalvm.nativeimage.c.function.CEntryPoint in project graal by oracle.

the class PolyglotNativeAPI method polyglot_create_int32.

@SuppressWarnings("UnnecessaryBoxing")
@CEntryPoint(name = "polyglot_create_int32")
public static PolyglotStatus polyglot_create_int32(IsolateThread isolate_thread, PolyglotContextPointer polyglot_context, int value, PolyglotValuePointerPointer result) {
    return withHandledErrors(() -> {
        Context ctx = ObjectHandles.getGlobal().get(polyglot_context);
        result.write(createHandle(ctx.asValue(Integer.valueOf(value))));
    });
}
Also used : CEntryPointContext(org.graalvm.nativeimage.c.function.CEntryPointContext) Context(org.graalvm.polyglot.Context) CEntryPoint(org.graalvm.nativeimage.c.function.CEntryPoint)

Example 58 with CEntryPoint

use of org.graalvm.nativeimage.c.function.CEntryPoint in project graal by oracle.

the class PolyglotNativeAPI method polyglot_value_fits_in_int64.

@CEntryPoint(name = "polyglot_value_fits_in_int64")
public static PolyglotStatus polyglot_value_fits_in_int64(IsolateThread isolate_thread, PolyglotValuePointer value, CIntPointer result) {
    return withHandledErrors(() -> {
        Value dataObject = fetchHandle(value);
        result.write(dataObject.fitsInLong() ? 1 : 0);
    });
}
Also used : Value(org.graalvm.polyglot.Value) CEntryPoint(org.graalvm.nativeimage.c.function.CEntryPoint)

Example 59 with CEntryPoint

use of org.graalvm.nativeimage.c.function.CEntryPoint in project graal by oracle.

the class PolyglotNativeAPI method polyglot_create_object.

@CEntryPoint(name = "polyglot_create_object")
public static PolyglotStatus polyglot_create_object(IsolateThread isolate_thread, PolyglotContextPointer polyglot_context, PolyglotValuePointerPointer result) {
    return withHandledErrors(() -> {
        Context c = ObjectHandles.getGlobal().get(polyglot_context);
        ProxyObject proxy = ProxyObject.fromMap(new HashMap<>());
        result.write(createHandle(c.asValue(proxy)));
    });
}
Also used : CEntryPointContext(org.graalvm.nativeimage.c.function.CEntryPointContext) Context(org.graalvm.polyglot.Context) ProxyObject(org.graalvm.polyglot.proxy.ProxyObject) CEntryPoint(org.graalvm.nativeimage.c.function.CEntryPoint)

Example 60 with CEntryPoint

use of org.graalvm.nativeimage.c.function.CEntryPoint in project graal by oracle.

the class PolyglotNativeAPI method polyglot_create_uint8.

@SuppressWarnings("UnnecessaryBoxing")
@CEntryPoint(name = "polyglot_create_uint8")
public static PolyglotStatus polyglot_create_uint8(IsolateThread isolate_thread, PolyglotContextPointer polyglot_context, int value, PolyglotValuePointerPointer result) {
    return withHandledErrors(() -> {
        Context ctx = ObjectHandles.getGlobal().get(polyglot_context);
        result.write(createHandle(ctx.asValue(Integer.valueOf(value))));
    });
}
Also used : CEntryPointContext(org.graalvm.nativeimage.c.function.CEntryPointContext) Context(org.graalvm.polyglot.Context) CEntryPoint(org.graalvm.nativeimage.c.function.CEntryPoint)

Aggregations

CEntryPoint (org.graalvm.nativeimage.c.function.CEntryPoint)81 CEntryPointOptions (com.oracle.svm.core.c.function.CEntryPointOptions)26 Value (org.graalvm.polyglot.Value)23 CEntryPointContext (org.graalvm.nativeimage.c.function.CEntryPointContext)19 Context (org.graalvm.polyglot.Context)19 Uninterruptible (com.oracle.svm.core.annotate.Uninterruptible)7 ObjectHandle (org.graalvm.nativeimage.ObjectHandle)5 TruffleObject (com.oracle.truffle.api.interop.TruffleObject)4 CCharPointer (org.graalvm.nativeimage.c.type.CCharPointer)4 CIntPointer (org.graalvm.nativeimage.c.type.CIntPointer)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