@@ -512,7 +512,7 @@ impl InitMaskCompressed {
512
512
/// Transferring the initialization mask to other allocations.
513
513
impl<Tag, Extra> Allocation<Tag, Extra> {
514
514
/// Creates a run-length encoding of the initialization mask.
515
- pub fn compress_uninit_range(&self, src: Pointer<Tag>, size: Size ) -> InitMaskCompressed {
515
+ pub fn compress_uninit_range(&self, range: AllocRange ) -> InitMaskCompressed {
516
516
// Since we are copying `size` bytes from `src` to `dest + i * size` (`for i in 0..repeat`),
517
517
// a naive initialization mask copying algorithm would repeatedly have to read the initialization mask from
518
518
// the source and write it to the destination. Even if we optimized the memory accesses,
@@ -526,13 +526,13 @@ impl<Tag, Extra> Allocation<Tag, Extra> {
526
526
// where each element toggles the state.
527
527
528
528
let mut ranges = smallvec::SmallVec::<[u64; 1]>::new();
529
- let initial = self.init_mask.get(src.offset );
529
+ let initial = self.init_mask.get(range.start );
530
530
let mut cur_len = 1;
531
531
let mut cur = initial;
532
532
533
- for i in 1..size.bytes() {
533
+ for i in 1..range. size.bytes() {
534
534
// FIXME: optimize to bitshift the current uninitialized block's bits and read the top bit.
535
- if self.init_mask.get(src.offset + Size::from_bytes(i)) == cur {
535
+ if self.init_mask.get(range.start + Size::from_bytes(i)) == cur {
536
536
cur_len += 1;
537
537
} else {
538
538
ranges.push(cur_len);
@@ -550,24 +550,23 @@ impl<Tag, Extra> Allocation<Tag, Extra> {
550
550
pub fn mark_compressed_init_range(
551
551
&mut self,
552
552
defined: &InitMaskCompressed,
553
- dest: Pointer<Tag>,
554
- size: Size,
553
+ range: AllocRange,
555
554
repeat: u64,
556
555
) {
557
556
// An optimization where we can just overwrite an entire range of initialization
558
557
// bits if they are going to be uniformly `1` or `0`.
559
558
if defined.ranges.len() <= 1 {
560
559
self.init_mask.set_range_inbounds(
561
- dest.offset ,
562
- dest.offset + size * repeat, // `Size` operations
560
+ range.start ,
561
+ range.start + range. size * repeat, // `Size` operations
563
562
defined.initial,
564
563
);
565
564
return;
566
565
}
567
566
568
567
for mut j in 0..repeat {
569
- j *= size.bytes();
570
- j += dest.offset .bytes();
568
+ j *= range. size.bytes();
569
+ j += range.start .bytes();
571
570
let mut cur = defined.initial;
572
571
for range in &defined.ranges {
573
572
let old_j = j;
0 commit comments