Commit da8ab9bb
da8ab9bb3036Merged
Yukihiro "Matz" Matsumoto <[email protected]> · 5 months ago · 1 file · ~1 modified
Description
Re-pin block-param types after the post-fixpoint write-type re-run
The post-fixpoint infer_write_types re-run can re-derive a container type (e.g. PolyPolyHash from a[1]=v) for an iteration-bound block param, clobbering the TY_POLY the block-param pass assigned for a poly-collection .each. The block param then declared a typed-hash pointer while the loop assigned a poly element. Re-run infer_block_params after the write-type re-run so poly elements stay poly (attr_lut_update.each {|a| a[1]=...} in PPU#poke_2007).
Co-Authored-By: Claude Opus 4.8 (1M context) [email protected]
Details
- Commit
- da8ab9bb3036
- Parent
- 844356c115a3
src/analyze.cmodifiedView file
@@ -1341,6 +1341,11 @@
13411341
a local like `xfine = 8 - (data & 0x7)` only becomes int once its method's13421342
`data` param is pinned to int by the backstop. */13431343
for (int iter = 0; iter < 8; iter++) if (!infer_write_types(c)) break;1344+
/* The write-type re-run can re-derive a hash/array container type for an1345+
iteration-bound block param from its element-index usage (e.g. `a[1]=v`),1346+
clobbering the TY_POLY the block-param pass pinned for a poly-collection1347+
`.each`. Re-pin block-param types so poly elements stay poly. */1348+
for (int iter = 0; iter < 8; iter++) if (!infer_block_params(c)) break;13441349
/* infer_write_types resets non-param locals, undoing the earlier bigint13451350
loop-variable promotion, so re-apply it. */13461351
detect_bigint_loop_vars(c);