Commit ea8f4043
ea8f4043d8f0Merged
Yukihiro "Matz" Matsumoto <[email protected]> · 6 months ago · 1 file · ~1 modified
Description
chore(codegen): drop dead @needs_proc / @needs_*_poly_hash writes
Audit of @needs_* flags (refactor item 4) caught nine dead writes that crept back in after the original removals.
@needs_proc was retired entirely by 5876869 (init + reads) and PR #110
finished the cleanup, with 7e8e76b dropping two stragglers from PRs
#108/#109 that had landed in between. Three more came in afterwards via
the &block-forwarding paths (2749b98 anonymous &, 37d00a6 &expr): all
in block_forward_expr setting a flag that nothing reads. Drop them
plus the stale "Sets @needs_proc" line in the doc comment.
@needs_str_poly_hash and @needs_sym_poly_hash got the same treatment in 5876869 (init + reads removed). Three subsequent feature commits (98d1179, 79327be) added writes alongside the *_PolyHash constructor emits — also unread. Drop those, leaving the @needs_rb_value writes that share the call sites and are still load-bearing.
Bootstrap (gen2 == gen3) clean; 199 tests + 56 benches pass.
Co-Authored-By: Claude Opus 4.7 (1M context) [email protected]
Details
- Commit
- ea8f4043d8f0
- Parent
- 84715d7bed78
spinel_codegen.rbmodifiedView file
# expression for the proc to forward at a `&block`-taking call site # (a literal block compiles to sp_proc_new(...); a `&proc_var` is # the captured `sp_Proc *` local), or "" if the call site provides # no block. Sets @needs_proc when a forwarded proc is emitted. # no block. def block_forward_expr(nid) if has_literal_block(nid) == 1 @needs_proc = 1 return compile_proc_literal(nid) end # Anonymous `&` forwarding (Ruby 3.1+): `inner(&)` where the blk = @nd_block[nid] if blk >= 0 && @nd_type[blk] == "BlockArgumentNode" && @nd_expression[blk] < 0 if @current_method_block_param != "" @needs_proc = 1 return "lv_" + @current_method_block_param end end ba = find_block_arg(nid) if ba >= 0 @needs_proc = 1 return compile_expr(ba) end "" elsif promoted == "sym_str_hash" @needs_sym_str_hash = 1 elsif promoted == "str_poly_hash" @needs_str_poly_hash = 1 @needs_rb_value = 1 elsif promoted == "sym_poly_hash" @needs_sym_poly_hash = 1 @needs_rb_value = 1 end end @needs_sym_str_hash = 1 iv_ctor = "sp_SymStrHash_new()" elsif ivt == "str_poly_hash" @needs_str_poly_hash = 1 iv_ctor = "sp_StrPolyHash_new()" elsif ivt == "sym_poly_hash" @needs_sym_poly_hash = 1 iv_ctor = "sp_SymPolyHash_new()" end end @needs_sym_str_hash = 1 ctor = "sp_SymStrHash_new()" elsif ivt == "str_poly_hash" @needs_str_poly_hash = 1 ctor = "sp_StrPolyHash_new()" elsif ivt == "sym_poly_hash" @needs_sym_poly_hash = 1 ctor = "sp_SymPolyHash_new()" end if ctor != ""