Skip to content

GraalVM native images and ART as runtimes, besides jdk-mobile's JVM - #3

Merged
kdroidFilter merged 1 commit into
mainfrom
feat/graalvm-runtime
Oct 17, 2026
Merged

kdroidFilter merged 1 commit into
mainfrom
feat/graalvm-runtime

Conversation

@kdroidFilter

Copy link
Copy Markdown
Contributor

Summary

What runs the façades becomes a choice, per platform: nucleusJvm { runtime / iosRuntime / androidRuntime }, with NjaRuntimeType.

iOS Android Downloaded by the plugin
JVM (default, unchanged) Zero, linked into the app HotSpot in the app's process jdk-mobile's runtimes
GRAALVM the façades' native image the façades' native image (built on Linux) graalvm-mobile's kit + the GraalVM CE release it names, for the host
ART – (iOS keeps JVM) the façades dexed with the app nothing
  • GraalVM
    • njaGraalvmMobile<Target>: the kit, from graalvm-mobile's latest release (graalvmMobileRelease, graalvmMobileRepository). It reuses the jdk-mobile download task, now generic over the release's product.
    • njaGraalvm<Target>: GraalVM CE for the build host, cached in ~/.gradle/caches/nja/graalvm.
    • njaNativeImage<Target>: compiles the façades into a relocatable object.
    • Linking: iOS binaries link the object with the kit's libraries. On Android, libnja.so is the object plus the kit's libraries plus nja_android_graal.c.
    • Options: jvmOptions' -Xmx becomes -R:MaxHeapSize, and -D options are kept. nativeImageOptions is passed to native-image as is.
    • Reachability metadata: libraries bring it in their jars.
    • Server: GraalLink adds the image's @CEntryPoints (nja_graal_dispatch, nja_graal_set_upcall).
    • iOS client: it looks the runtime's entry points up with dlsym, so the same client links with either Zero or an image.
    • Android client: AndroidJvm starts the image when the app ships nja/native-image.
    • Building on another host: an Android image built anywhere but Linux fails with an explicit message, because native-image compiles its host's Java classes.
  • ART
    • The façades and nja-server become the Android app's own dependencies.
    • The client calls NjaServer.handle in process, by reflection, with consumer keep rules.
    • The client's minSdk drops to 21. HotSpot and native images still need Android 10.
  • NjaServer and the torture façade no longer call Runtime.version(), which ART lacks.
  • The README covers the runtimes.
  • test-graalvm-android.yml builds the example in GRAALVM mode on Linux and runs its suites on an x86_64 emulator.

Verification

  • Example suites (2008 tests):
    • iOS simulator, GRAALVM: 2008/2008 ("Substrate VM 25.0.4.1.1, iOS/arm64").
    • Android 15 emulator, ART: 2008/2008.
    • Android 15 emulator, JVM: 2008/2008.
    • jvmTest: passes.
  • graalvm-mobile: its CI smoke-tests each kit with Lucene (iOS simulator, Android arm64 through qemu, Android x86_64) and published graalvm-mobile-25.4.4.1.1b1.1.
  • A real app (Zayit's search, Lucene 10 with KNN):
    • iOS, GRAALVM vs JVM:
      • first page 144 ms vs 1.18 s;
      • facets 18 ms vs 148 ms;
      • cold start 0.8 s vs 4.6 s.
    • Android, GRAALVM: on par with the former Lucene-on-ART build.
      • Cold start: 1.5 s vs 1.4 s.
      • Peak PSS: 481 MB vs 426 MB in hybrid search.
      • In comparison, JVM (HotSpot) is faster once warm, at 2.1 s cold and 559 MB.
  • Not run here: the GRAALVM suites on Android. That's the new workflow's job: the Android image was built on Linux in CI and the app benchmarked on an emulator, not the example's suites.

…dk-mobile's JVM

Signed-off-by: Elie Gambache <elyahou.hadass@gmail.com>
@kdroidFilter
kdroidFilter merged commit 39bc282 into main Oct 17, 2026
1 check failed
@kdroidFilter
kdroidFilter deleted the feat/graalvm-runtime branch October 17, 2026 21:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant