Commit 148fc238

148fc23801a9Merged

Dmitry Bochkarev <[email protected]> · 6 months ago · 3 files · +2 added · ~1 modified

Description

fix(analyze): promote empty array to poly_array when Proc is pushed

empty_array_promotion_for did not recognize the 'proc' type (it only handled obj_-prefixed types via is_obj_type). When a raw sp_Proc * was pushed into an ivar array that started as [] (int_array default), the array stayed int_array. The each-iteration variable was then typed mrb_int, and .call on it was silently skipped.

Add explicit proc -> poly_array promotion. The proc gets boxed as sp_RbVal{tag=OBJ, cls_id=SP_BUILTIN_PROC}.

Details

Commit
148fc23801a9
Parent
3eaa0a0d7bdb

spinel_analyze.rbmodifiedView file

@@ -12480,6 +12480,10 @@
1248012480 @needs_rb_value = 1
1248112481 return "poly_array"
1248212482 end
12483+ if elem_acc[0] == "proc"
12484+ @needs_rb_value = 1
12485+ return "poly_array"
12486+ end
1248312487 if is_obj_type(elem_acc[0]) == 1
1248412488 # Homogeneous obj array — use a typed `<obj>_ptr_array` so reads
1248512489 # return a typed pointer (no sp_RbVal unbox needed at the call
@@ -16603,7 +16607,6 @@
1660316607 bci = bci + 1
1660416608 end
1660516609 $stderr.puts "-----------------"
16606- end
1660716610 end
1660816611
1660916612