Skip to content

Commit 431f773

Browse files
committed
Add comments per Kokubun's suggestion
1 parent ccedacf commit 431f773

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

zjit/src/hir.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6184,7 +6184,8 @@ impl Function {
61846184
let max_params = blocks.iter().copied().map(|id| self.blocks[id].params.len()).max().unwrap_or(0);
61856185
let mut trivial_indices: Vec<usize> = Vec::with_capacity(max_params);
61866186

6187-
// Prepare the initial param_values
6187+
// Prepare the initial param_values. As trivial block params are discovered and elided during analysis,
6188+
// the number of params in each row will decrease.
61886189
for (row, block) in param_values.iter_mut().zip(&self.blocks) {
61896190
row.resize(block.params.len(), ParamValue::None);
61906191
}
@@ -6194,6 +6195,11 @@ impl Function {
61946195
while changed {
61956196
changed = false;
61966197

6198+
// When trivial params are elided, the number of params per block can shrink.
6199+
// When we reset each analysis loop, we do two things:
6200+
// 1. Reset analysis state to None (bottom of the lattice)
6201+
// 2. Shrink the number of params per row to match the params per block.
6202+
// This resizing occurs when former iterations have found and removed trivial params.
61976203
for (row, block) in param_values.iter_mut().zip(&self.blocks) {
61986204
row.truncate(block.params.len());
61996205
row.as_mut_slice().fill(ParamValue::None);

0 commit comments

Comments
 (0)