ffi 1.21: lock in undef shape for #jni_call(bool)

Test-add for the jboolean return. JNI `jboolean` is a single byte (0
or 1); sx's `bool` lowers to LLVM `i1` with byte-coercion at the ABI
boundary. CallBooleanMethod is at vtable slot 37.

IR snapshot captures today's `ret i1 undef`. Next commit adds the
`.bool => Jni.CallBooleanMethod` arm.
This commit is contained in:
agra
2026-05-19 22:33:58 +03:00
parent ca4ba7589c
commit 1ee4017426
4 changed files with 292 additions and 0 deletions

View File

@@ -0,0 +1,21 @@
// Phase 1 step 1.21 (PLAN-FFI.md): `#jni_call(bool)` (jboolean
// return). JNI's `jboolean` is a single-byte unsigned integer (0 or
// 1) on every supported ABI; sx's `bool` lowers to LLVM `i1` but the
// arg/return coercion path widens it to the byte slot the JNI
// runtime expects. CallBooleanMethod lives at vtable slot 37.
#import "modules/std.sx";
g_should_call : bool = false;
read_bool :: (env: *void, target: *void) -> bool {
#jni_call(bool)(env, target, "isShown", "()Z");
}
main :: () -> s32 {
if g_should_call {
_ := read_bool(null, null);
}
print("ok\n");
0;
}