Files
sx/src/ir
agra 063bbb5419 ffi #jni_main R.3: synthesize JNI-mangled exports for bodied methods
After lowering completes, a new pass walks `foreign_class_map` and, for
every bodied non-static method on a `#jni_main #jni_class("...")` decl,
synthesises a C-ABI exported function whose name follows JNI's name-
mangling convention:

    `Java_<pkg-mangled>_<Class>_sx_1<method-mangled>`

(`/` → `_`, `_` → `_1`). Android's JNI runtime resolves `private native
sx_<method>(...)` declared in the bundled classes.dex via this symbol
without needing an explicit `JNI_OnLoad`/`RegisterNatives` — the
name-mangling fallback is enough.

Param ABI: `(env: *void, self: *void)` prepended (JNIEnv* + jobject
receiver), followed by the user-declared params with pointer types
type-erased to `*void`. The user's body is lowered through the normal
fn-body pipeline with `env`, `self`, and the user-named params bound in
scope. `isExportedEntryName` now also returns true for any name starting
with `Java_` so emit_llvm sets external linkage.

Verified end-to-end: `llvm-nm -D` on the slice 2 smoke .so shows
`Java_co_swipelab_sxjnimain_SxApp_sx_1onCreate` as an exported T
symbol. 131 host / 4 cross / zig build test all green.

Future work (R.3b territory): richer typing inside bodies so `*Self` /
`*Bundle` params support method dispatch through the foreign-class
slot interning. For now `self`/`b` are opaque `*void` jobjects in
scope — fine for stub bodies and `#jni_call`-driven dispatch.
2026-05-20 15:10:33 +03:00
..
2026-05-17 13:19:08 +03:00
2026-03-01 22:38:41 +02:00
ir
2026-02-26 02:25:02 +02:00
ir
2026-02-26 02:25:02 +02:00
ir
2026-02-26 02:25:02 +02:00
ir
2026-02-26 02:25:02 +02:00
ir
2026-02-26 02:25:02 +02:00
ir
2026-02-26 02:25:02 +02:00
ir
2026-02-26 02:25:02 +02:00