Commit e0c45fb3

e0c45fb3f979Merged

Yukihiro "Matz" Matsumoto <[email protected]> · 6 months ago · 1 file · ~1 modified

Description

fix(codegen): poly_array Method-dispatch arm skips double-wrap on bigint arg

The promote-mode Method ABI widening wraps an int arg via sp_bigint_new_int before passing to fn_ptr. But when the arg's actual emit is already sp_Bigint* (arith / bitop with one bigint operand, where infer_type returned stale int), the wrap chains to sp_bigint_new_int(sp_bigint_and(...)) -- a pointer where int64_t is expected. Detect via the same sp_bigint_* prefix check used elsewhere and pass the value through.

Co-Authored-By: Claude Opus 4.7 [email protected]

Details

Commit
e0c45fb3f979
Parent
3190f6ea44c0

spinel_codegen.rbmodifiedView file

@@ -23051,7 +23051,13 @@
2305123051 @needs_rb_value = 1
2305223052 ai_val = "sp_bigint_new_int((" + ai_val + ").v.i)"
2305323053 elsif mi < arg_types.length && base_type(arg_types[mi]) == "int"
23054- ai_val = "sp_bigint_new_int(" + ai_val + ")"
23054+ # Stale int cache: the emit already returns sp_Bigint*
23055+ # (arith/bitop with a bigint operand). Don't double-wrap.
23056+ if ai_val.start_with?("sp_bigint_") || ai_val.start_with?("(sp_Bigint *)")
23057+ # keep as-is
23058+ else
23059+ ai_val = "sp_bigint_new_int(" + ai_val + ")"
23060+ end
2305523061 end
2305623062 else
2305723063 if mi < arg_types.length && arg_types[mi] == "poly"