-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix: JNA over Static JNI (Part II) #11
Commits on Jun 11, 2024
-
Adds a JAR publication at `jna-graalvm.jar`, with accompanying build infrastructure, which provides support for JNA within the context of the Substrate Virtual Machine (SVM). GraalVM Native Image targets use SVM instead of JVM at runtime. JNA's current strategy of unpacking libraries at runtime works under SVM, but is suboptimal; the binary is native, so it can simply include JNA object code for the current platform directly. To accomplish this, several GraalVM "feature" implementations are provided in this new publication. By default, regular JNA access is enabled through the `JavaNativeAccess` feature; this class enables reflection and runtime JNI configurations for downstream projects which use JNA. Another feature, `SubstrateStaticJNA`, is experimental because it relies on unstable GraalVM APIs, but instead of loading JNA at runtime from a dynamic library, it builds JNA into the final native image with a static object. These features are enabled through a resource within `META-INF`, called `native-image.properties`, which is picked up by the native image compiler at build time. The new artifact only needs to be present for GraalVM native targets at build time; otherwise, the classes and libraries in `jna-graalvm.jar` are inert. Includes tested support for: - macOS aarch64 - Linux amd64 - feat: add `jna-graalvm.jar` publication - feat: add base `JavaNativeAccess` feature for auto-config of JNA - feat: add initial implementation of `SubstrateStaticJNA` feature - test: sample/test gradle build for native image - chore: ci config to run native sample Signed-off-by: Sam Gammon <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 8978b9b - Browse repository at this point
Copy the full SHA 8978b9bView commit details
Commits on Jun 13, 2024
-
Signed-off-by: Sam Gammon <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 8e74b6c - Browse repository at this point
Copy the full SHA 8e74b6cView commit details -
fix: gvm features at jvm21+ only
Signed-off-by: Sam Gammon <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 6fd8e37 - Browse repository at this point
Copy the full SHA 6fd8e37View commit details -
chore: changes to build for static jni
Signed-off-by: Sam Gammon <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 915c880 - Browse repository at this point
Copy the full SHA 915c880View commit details -
fix: posix (but non-linux) static lib build
Signed-off-by: Sam Gammon <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 518e6e3 - Browse repository at this point
Copy the full SHA 518e6e3View commit details -
fix: static-compatible init of jna native layer
Signed-off-by: Sam Gammon <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 32361ae - Browse repository at this point
Copy the full SHA 32361aeView commit details -
chore: cleanups in
JavaNativeAccess
featureSigned-off-by: Sam Gammon <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 8041a67 - Browse repository at this point
Copy the full SHA 8041a67View commit details -
feat: implement static jni feature
Signed-off-by: Sam Gammon <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for b5a64a3 - Browse repository at this point
Copy the full SHA b5a64a3View commit details -
chore: better debugging for basic gvm sample
Signed-off-by: Sam Gammon <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for ee9acbc - Browse repository at this point
Copy the full SHA ee9acbcView commit details -
Signed-off-by: Sam Gammon <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 0a8a437 - Browse repository at this point
Copy the full SHA 0a8a437View commit details -
chore: break install tasks into separate ones for testing on mac
Signed-off-by: Sam Gammon <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for ef5f90c - Browse repository at this point
Copy the full SHA ef5f90cView commit details -
fix: symbol resolution under static linkage on gvm
When linked statically on GraalVM, JNI symbols declared in the overloaded form cannot be resolved. Luckily, all of `Native`'s callsites are in `Pointer` or itself, and all `native` methods of `Native` are non-public. This PR adjusts the JNA C API to avoid using overloaded `read`, `write`, or `getDirectByteBuffer`. Callsites are amended in `Pointer` accordingly. Signed-off-by: Sam Gammon <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for d4daa08 - Browse repository at this point
Copy the full SHA d4daa08View commit details -
Signed-off-by: Sam Gammon <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for e3cdca2 - Browse repository at this point
Copy the full SHA e3cdca2View commit details -
Signed-off-by: Sam Gammon <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 815278c - Browse repository at this point
Copy the full SHA 815278cView commit details