JNI

JNIEnv and JavaVM given to the guest are tables in host memory whose entries are adapter addresses. Each adapter calls the host JVM's own JNI with the thread's host JNIEnv: references (jobject, jclass) and IDs pass through unchanged, since a guest pointer is a host pointer. The Call*Method functions with variable arguments build a jvalue array from the guest's registers and call the A form.

A native method of the app's classes is translated into a body that calls the bridge with its arguments. The bridge finds the guest function by RegisterNatives (which the guest called) or by its JNI name (Java_pkg_Class_method) in the loaded libraries, and runs it on the thread's CPU state. No host trampoline is generated at run time.


Made from docs/platforms/android-apps/native.md at 69237645142c. GPL-3.0-or-later.