ffi 1.18: #jni_call(s32) → CallIntMethod (slot 49) — make-green

One-line addition to the `call_method_offset` switch in
`emit_llvm.zig` — `.s32 => 49` (CallIntMethod). The 1.17 caching
infrastructure handles the rest: GetObjectClass → NewGlobalRef →
GetMethodID populate the shared `@SX_JNI_{CLS,MID}_<key>` pair on
miss; per-call lowering loads the cached jmethodID and dispatches
through vtable slot 49 with an `i32` return.

IR snapshot at `tests/expected/ffi-jni-call-04-jint-return.ir`
updated: the `ret i32 undef` placeholder is replaced by the full
lazy-cache + CallIntMethod sequence keyed on
`("getCount", "()I")`. Pre-1.18 snapshot was 1d7ea72.
This commit is contained in:
agra
2026-05-19 22:26:58 +03:00
parent 1d7ea72dc8
commit ebcfe4c4dc
2 changed files with 28 additions and 1 deletions

View File

@@ -1220,6 +1220,7 @@ pub const LLVMEmitter = struct {
const ret_ty_id = instruction.ty;
const call_method_offset: u32 = switch (ret_ty_id) {
.void => 61, // CallVoidMethod
.s32 => 49, // CallIntMethod
else => {
self.mapRef(c.LLVMGetUndef(self.toLLVMType(instruction.ty)));
return;