Commit 6a394049

6a39404910fcMerged

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

Description

fix(codegen): chained ivar write coerces int<->bigint per slot

compile_chained_ivar_writes's general arm computed the rhs once into a typed temp and stored into each slot. The poly arm boxed, but bigint slots fell through with the raw int temp, producing self->iv_c = _t2; where iv_c is sp_Bigint* and _t2 is mrb_int.

Mirror the existing poly box: when ivt is bigint and the rhs temp is int-typed, wrap via sp_bigint_new_int (and reverse-unbox if the chain crosses an int slot).

Promote-mode test count: 504 pass / 43 fail / 71 error -> 504 pass / 44 fail / 70 error. Default raise mode unchanged at 618 / 0 / 0.

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

Details

Commit
6a39404910fc
Parent
0f5caa5b04de

spinel_codegen.rbmodifiedView file

@@ -22767,6 +22767,13 @@
2276722767 if ivt_i == "poly" && rhs_type != "poly"
2276822768 val_i = box_value_to_poly(rhs_type, tmp)
2276922769 end
22770+ if ivt_i == "bigint" && rhs_type == "int"
22771+ @needs_bigint = 1
22772+ val_i = "sp_bigint_new_int(" + tmp + ")"
22773+ elsif ivt_i == "int" && rhs_type == "bigint"
22774+ @needs_bigint = 1
22775+ val_i = "sp_bigint_to_int((sp_Bigint *)" + tmp + ")"
22776+ end
2277022777 mod_ivar = 0
2277122778 mi3 = 0
2277222779 while mi3 < @module_names.length