Search in sources :

Example 1 with JNINativeInterface

use of com.oracle.svm.jni.nativeapi.JNINativeInterface in project graal by oracle.

the class JNIFunctionTables method getGlobalFunctionTable.

public JNINativeInterface getGlobalFunctionTable() {
    if (globalFunctionTable.isNull()) {
        JNINativeInterface functionTable = UnmanagedMemory.malloc(SizeOf.get(JNINativeInterface.class));
        functionTableInitializer.initialize(functionTable);
        globalFunctionTable = functionTable;
    }
    return globalFunctionTable;
}
Also used : JNINativeInterface(com.oracle.svm.jni.nativeapi.JNINativeInterface)

Example 2 with JNINativeInterface

use of com.oracle.svm.jni.nativeapi.JNINativeInterface in project graal by oracle.

the class JNIFunctionTablesFeature method beforeCompilation.

@Override
public void beforeCompilation(BeforeCompilationAccess a) {
    BeforeCompilationAccessImpl access = (BeforeCompilationAccessImpl) a;
    HostedMetaAccess metaAccess = access.getMetaAccess();
    CFunctionPointer unimplementedWithJavaVMArgument = getStubFunctionPointer(access, (HostedMethod) getSingleMethod(metaAccess, UnimplementedWithJavaVMArgument.class));
    JNIStructFunctionsInitializer<JNIInvokeInterface> invokesInitializer = buildInvokesInitializer(access, unimplementedWithJavaVMArgument);
    CFunctionPointer unimplementedWithJNIEnvArgument = getStubFunctionPointer(access, (HostedMethod) getSingleMethod(metaAccess, UnimplementedWithJNIEnvArgument.class));
    JNIStructFunctionsInitializer<JNINativeInterface> functionsInitializer = buildFunctionsInitializer(access, unimplementedWithJNIEnvArgument);
    JNIFunctionTables.singleton().initialize(invokesInitializer, functionsInitializer);
}
Also used : JNIInvokeInterface(com.oracle.svm.jni.nativeapi.JNIInvokeInterface) CFunctionPointer(org.graalvm.nativeimage.c.function.CFunctionPointer) JNINativeInterface(com.oracle.svm.jni.nativeapi.JNINativeInterface) HostedMetaAccess(com.oracle.svm.hosted.meta.HostedMetaAccess) BeforeCompilationAccessImpl(com.oracle.svm.hosted.FeatureImpl.BeforeCompilationAccessImpl)

Aggregations

JNINativeInterface (com.oracle.svm.jni.nativeapi.JNINativeInterface)2 BeforeCompilationAccessImpl (com.oracle.svm.hosted.FeatureImpl.BeforeCompilationAccessImpl)1 HostedMetaAccess (com.oracle.svm.hosted.meta.HostedMetaAccess)1 JNIInvokeInterface (com.oracle.svm.jni.nativeapi.JNIInvokeInterface)1 CFunctionPointer (org.graalvm.nativeimage.c.function.CFunctionPointer)1