@@ -135,7 +135,7 @@ impl std::fmt::Display for BlockId {
135135
136136type InsnSet = BitSet<InsnId>;
137137type BlockSet = BitSet<BlockId>;
138- /// Set of indices into a frame's local table. Always sized to [`field@FrameState::locals`] .
138+ /// A bit for each local in a frame, matched by local table index .
139139pub type LocalSet = BitSet<usize>;
140140
141141fn write_vec<T: std::fmt::Display>(f: &mut std::fmt::Formatter, objs: &Vec<T>) -> std::fmt::Result {
@@ -8071,14 +8071,9 @@ impl<'a> std::fmt::Display for FunctionPrinter<'a> {
80718071 }
80728072}
80738073
8074- /// Local indices of `iseq` that the block `blockiseq` (or any iseq nested within
8075- /// it) can touch through this frame's EP — reads as well as writes.
8076- ///
8077- /// These are the locals codegen must make authoritative in memory before the
8078- /// call. A read matters as much as a write here: the block resolves this frame's
8079- /// EP through its specval chain and loads the slot directly, with no side exit
8080- /// or materialization step in between that could push a register value out.
8081- fn block_accessed_local_indices(iseq: IseqPtr, blockiseq: IseqPtr, num_locals: usize, ep_escaped: bool) -> LocalSet {
8074+ /// Local variables of `iseq` that the block `blockiseq` (or any iseq nested within
8075+ /// the block) syntactically read or write.
8076+ fn block_accessed_local_set(iseq: IseqPtr, blockiseq: IseqPtr, num_locals: usize, ep_escaped: bool) -> LocalSet {
80828077 let mut accessed = LocalSet::with_capacity(num_locals);
80838078 if ep_escaped {
80848079 accessed.insert_all();
@@ -8102,11 +8097,11 @@ pub struct FrameState {
81028097 pub pc: *const VALUE,
81038098
81048099 stack: Vec<InsnId>,
8105- locals: Vec<InsnId>,
81068100
8101+ /// Values for local variables in `rb_iseq_constant_body::local_table` order.
8102+ locals: Vec<InsnId>,
81078103 /// The subset of locals that must be in EP memory prior to a safepoint.
8108- ///
8109- /// Predominatedly used for with-block sends for locals syntatically accessed within the block.
8104+ /// Predominantly used for with-block sends for locals syntactically accessed within the block.
81108105 spilled_locals: LocalSet,
81118106
81128107 /// `InsnId` of the caller's post-send `Snapshot` for inlined frames; `None`
@@ -10043,7 +10038,7 @@ fn add_iseq_to_hir(
1004310038 fun.gen_post_send_no_ep_escape_patch_point(block, &state, insn_idx);
1004410039 }
1004510040 // Put locals accessed by the block to memory
10046- let spilled = block_accessed_local_indices (iseq, blockiseq, state.locals.len(), ep_escaped);
10041+ let spilled = block_accessed_local_set (iseq, blockiseq, state.locals.len(), ep_escaped);
1004710042 fun.set_snapshot_spilled_locals(exit_id, spilled);
1004810043 fun.reload_locals_modified_by_block(block, iseq, blockiseq, &mut state, ep_escaped);
1004910044 }
@@ -10077,7 +10072,7 @@ fn add_iseq_to_hir(
1007710072 fun.gen_post_send_no_ep_escape_patch_point(block, &state, insn_idx);
1007810073 }
1007910074 // Put locals accessed by the block to memory
10080- let spilled = block_accessed_local_indices (iseq, blockiseq, state.locals.len(), ep_escaped);
10075+ let spilled = block_accessed_local_set (iseq, blockiseq, state.locals.len(), ep_escaped);
1008110076 fun.set_snapshot_spilled_locals(exit_id, spilled);
1008210077 fun.reload_locals_modified_by_block(block, iseq, blockiseq, &mut state, ep_escaped);
1008310078 }
@@ -10108,7 +10103,7 @@ fn add_iseq_to_hir(
1010810103 fun.gen_post_send_no_ep_escape_patch_point(block, &state, insn_idx);
1010910104 }
1011010105 // Put locals accessed by the block to memory
10111- let spilled = block_accessed_local_indices (iseq, blockiseq, state.locals.len(), ep_escaped);
10106+ let spilled = block_accessed_local_set (iseq, blockiseq, state.locals.len(), ep_escaped);
1011210107 fun.set_snapshot_spilled_locals(exit_id, spilled);
1011310108 fun.reload_locals_modified_by_block(block, iseq, blockiseq, &mut state, ep_escaped);
1011410109 }
@@ -10141,7 +10136,7 @@ fn add_iseq_to_hir(
1014110136 fun.gen_post_send_no_ep_escape_patch_point(block, &state, insn_idx);
1014210137 }
1014310138 // Put locals accessed by the block to memory
10144- let spilled = block_accessed_local_indices (iseq, blockiseq, state.locals.len(), ep_escaped);
10139+ let spilled = block_accessed_local_set (iseq, blockiseq, state.locals.len(), ep_escaped);
1014510140 fun.set_snapshot_spilled_locals(exit_id, spilled);
1014610141 fun.reload_locals_modified_by_block(block, iseq, blockiseq, &mut state, ep_escaped);
1014710142 }
0 commit comments