-
Enhancement
-
Resolution: Unresolved
-
P4
-
repo-panama
It might sometimes be desirable to use the Linker API to call JNI functions. Here are some areas which might use better interop:
* Passing Java heap objects to JNI functions: this requires a function to take a Java object and turn it into a JNI handles, exposed as a native memory segment. Note: if the API to create a JNI handle takes an Arena, we can just provide one API to cover both global and weak handles.
* Create and manipulate memory segments from JNI - e.g. with a JNI function similar to NewDirectByteBuffer/GetDirectBufferAddress/ GetDirectBufferCapacity.
* Obtain the JNIEnv* from a given execution context, as that needs to be passed to the underlying JNI function.
* Look up JNI functions, perhaps in a slightly higher-level form - e.g. add logic that given a Class + method name + signature gives the mangled name of the JNI function. This can be done by wrapping a SymbolLookup.
* Passing Java heap objects to JNI functions: this requires a function to take a Java object and turn it into a JNI handles, exposed as a native memory segment. Note: if the API to create a JNI handle takes an Arena, we can just provide one API to cover both global and weak handles.
* Create and manipulate memory segments from JNI - e.g. with a JNI function similar to NewDirectByteBuffer/GetDirectBufferAddress/ GetDirectBufferCapacity.
* Obtain the JNIEnv* from a given execution context, as that needs to be passed to the underlying JNI function.
* Look up JNI functions, perhaps in a slightly higher-level form - e.g. add logic that given a Class + method name + signature gives the mangled name of the JNI function. This can be done by wrapping a SymbolLookup.