Skip to content

Commit 14054fe

Browse files
committed
Docs: Correct the native-image note on reflection registration
The result table said the upcall path needs no reflection registration while the build log showed 1,822 types registered and the base metadata registers UpcallTarget. The generated function table needs none; the upcall bootstrap finds its five FFM entry points by name on that one class, which is registered by hand. The log line counts the whole image, JDK and library metadata included. Closes #244
1 parent c20546c commit 14054fe

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

‎docs/platforms/graal-native-image-verification.md‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,10 @@ the plugin's KMP support, not a native-image limitation.
9696
Finished generating 'upcall-native-demo' in 43.5s.
9797
```
9898

99+
The "registered for reflection" line counts everything in the image, the JDK's, Kotlin's and
100+
every library's shipped metadata included, not what this repository registers. Of it, this
101+
repository contributes one class, `UpcallTarget` (see the result table; corrected in #244).
102+
99103
Artifact: `sample/build/native/nativeCompile/upcall-native-demo`, **26,317,504 bytes (25.1 MB)**,
100104
`Mach-O 64-bit executable arm64`.
101105

@@ -217,7 +221,7 @@ rather than been produced silently.
217221
| Generated Python proxy layer works | **YES** (`PROXY_OK`, including `await` over a `suspend fun` settled from a Kotlin thread) |
218222
| `@PythonInternal` opt-out still enforced | **YES** (resolves to `-1`) |
219223
| Behaviour differs from JVM | **NO** (29/32 lines identical; the 3 differing lines are runtime addresses) |
220-
| Reflection registration needed for the upcall path | **NO**, the path uses none, which is the §7 design premise holding |
224+
| Reflection registration needed for the upcall path | **One class, by hand** (corrected in #244): the generated function table, which is every Kotlin declaration Python calls, needs none, which is the §7 premise holding; the upcall *bootstrap* finds its five FFM entry points by name on one fixed class of this repository (`UpcallStub.kt`, `UpcallTarget::class.java.methods`), so `python.native.ffi.UpcallTarget` is registered with `allPublicMethods` in `python-multiplatform/native-image/reachability-metadata.base.json` |
221225

222226
Nothing is outstanding on the desktop target. The untested surface is other targets: this verifies
223227
**desktop only**, as `sample/build.gradle.kts` wires `nativeCompile` from the `desktop` compilation.

0 commit comments

Comments
 (0)