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

@@ -770,10 +770,9 @@
770770 # expression for the proc to forward at a `&block`-taking call site
771771 # (a literal block compiles to sp_proc_new(...); a `&proc_var` is
772772 # the captured `sp_Proc *` local), or "" if the call site provides
773- # no block. Sets @needs_proc when a forwarded proc is emitted.
773+ # no block.
774774 def block_forward_expr(nid)
775775 if has_literal_block(nid) == 1
776- @needs_proc = 1
777776 return compile_proc_literal(nid)
778777 end
779778 # Anonymous `&` forwarding (Ruby 3.1+): `inner(&)` where the
@@ -783,13 +782,11 @@
783782 blk = @nd_block[nid]
784783 if blk >= 0 && @nd_type[blk] == "BlockArgumentNode" && @nd_expression[blk] < 0
785784 if @current_method_block_param != ""
786- @needs_proc = 1
787785 return "lv_" + @current_method_block_param
788786 end
789787 end
790788 ba = find_block_arg(nid)
791789 if ba >= 0
792- @needs_proc = 1
793790 return compile_expr(ba)
794791 end
795792 ""
@@ -7126,10 +7123,8 @@
71267123 elsif promoted == "sym_str_hash"
71277124 @needs_sym_str_hash = 1
71287125 elsif promoted == "str_poly_hash"
7129- @needs_str_poly_hash = 1
71307126 @needs_rb_value = 1
71317127 elsif promoted == "sym_poly_hash"
7132- @needs_sym_poly_hash = 1
71337128 @needs_rb_value = 1
71347129 end
71357130 end
@@ -11675,10 +11670,8 @@
1167511670 @needs_sym_str_hash = 1
1167611671 iv_ctor = "sp_SymStrHash_new()"
1167711672 elsif ivt == "str_poly_hash"
11678- @needs_str_poly_hash = 1
1167911673 iv_ctor = "sp_StrPolyHash_new()"
1168011674 elsif ivt == "sym_poly_hash"
11681- @needs_sym_poly_hash = 1
1168211675 iv_ctor = "sp_SymPolyHash_new()"
1168311676 end
1168411677 end
@@ -19780,10 +19773,8 @@
1978019773 @needs_sym_str_hash = 1
1978119774 ctor = "sp_SymStrHash_new()"
1978219775 elsif ivt == "str_poly_hash"
19783- @needs_str_poly_hash = 1
1978419776 ctor = "sp_StrPolyHash_new()"
1978519777 elsif ivt == "sym_poly_hash"
19786- @needs_sym_poly_hash = 1
1978719778 ctor = "sp_SymPolyHash_new()"
1978819779 end
1978919780 if ctor != ""