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 = 11248112481
return "poly_array"1248212482
end12483+
if elem_acc[0] == "proc"12484+
@needs_rb_value = 112485+
return "poly_array"12486+
end1248312487
if is_obj_type(elem_acc[0]) == 11248412488
# Homogeneous obj array — use a typed `<obj>_ptr_array` so reads1248512489
# return a typed pointer (no sp_RbVal unbox needed at the call@@ -16603,7 +16607,6 @@
1660316607
bci = bci + 11660416608
end1660516609
$stderr.puts "-----------------"16606-
end1660716610
end1660816611
1660916612
test/proc_array_push.rbaddedView file
Loading diff…
test/proc_array_push.rb.expectedaddedView file
Loading diff…