Skip to content

Commit ba52926

Browse files
committed
simplify encoding/decoding
1 parent 285adcf commit ba52926

3 files changed

Lines changed: 139 additions & 237 deletions

File tree

turbopack/crates/turbo-tasks-backend/src/backend/lazy_tail.rs

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -191,16 +191,7 @@ impl LazyTail {
191191
/// `trailing_zeros` / `count_ones` but no built-in set-bit iterator;
192192
/// `bits &= bits - 1` is the canonical equivalent.
193193
#[inline]
194-
fn sum_padded_sizes(mask: u32) -> usize {
195-
Self::sum_padded_sizes_for_bits(mask)
196-
}
197-
198-
/// Public alias of `sum_padded_sizes` so the macro-generated decode
199-
/// path can preallocate exactly enough tail capacity for the
200-
/// bitmap-prefixed wire format. The macro reads the wire bitmap, then
201-
/// asks how many tail bytes the eventual payloads will occupy.
202-
#[inline]
203-
pub(crate) fn sum_padded_sizes_for_bits(mut mask: u32) -> usize {
194+
fn sum_padded_sizes(mut mask: u32) -> usize {
204195
let mut offset = 0usize;
205196
while mask != 0 {
206197
let bit_idx = mask.trailing_zeros();

turbopack/crates/turbo-tasks-backend/src/backend/task_storage.rs

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -398,23 +398,6 @@ impl TaskStorage {
398398
target_total.min(max_total)
399399
}
400400

401-
/// Pre-grow the tail to fit `min_tail_bytes` total before a batch
402-
/// of `lazy_insert`s — used by the macro-generated decode path to
403-
/// avoid N reallocs as N payloads install. Wraps the private
404-
/// `grow_to` (which has the same contract) with a stable
405-
/// `pub(crate)` symbol so the macro doesn't have to depend on
406-
/// private impl details.
407-
///
408-
/// # Safety
409-
/// Same as [`Self::grow_to`]: no outstanding `&mut TaskStorageInner`
410-
/// reference may exist when this returns, because the realloc
411-
/// relocates the buffer.
412-
#[inline]
413-
pub(crate) unsafe fn grow_to_for_decode(&mut self, min_tail_bytes: usize) {
414-
// SAFETY: forwarded caller contract.
415-
unsafe { self.grow_to(min_tail_bytes) }
416-
}
417-
418401
/// Grow the allocation so the tail has at least `min_tail_bytes`
419402
/// capacity. Uses `mi_good_size` to pre-round to the allocator bin.
420403
///

0 commit comments

Comments
 (0)