@@ -512,7 +512,7 @@ impl InitMaskCompressed {
512512/// Transferring the initialization mask to other allocations.
513513impl < Tag , Extra > Allocation < Tag , Extra > {
514514 /// 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 {
516516 // Since we are copying `size` bytes from `src` to `dest + i * size` (`for i in 0..repeat`),
517517 // a naive initialization mask copying algorithm would repeatedly have to read the initialization mask from
518518 // 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> {
526526 // where each element toggles the state.
527527
528528 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 ) ;
530530 let mut cur_len = 1 ;
531531 let mut cur = initial;
532532
533- for i in 1 ..size. bytes ( ) {
533+ for i in 1 ..range . size . bytes ( ) {
534534 // 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 {
536536 cur_len += 1 ;
537537 } else {
538538 ranges. push ( cur_len) ;
@@ -550,24 +550,23 @@ impl<Tag, Extra> Allocation<Tag, Extra> {
550550 pub fn mark_compressed_init_range (
551551 & mut self ,
552552 defined : & InitMaskCompressed ,
553- dest : Pointer < Tag > ,
554- size : Size ,
553+ range : AllocRange ,
555554 repeat : u64 ,
556555 ) {
557556 // An optimization where we can just overwrite an entire range of initialization
558557 // bits if they are going to be uniformly `1` or `0`.
559558 if defined. ranges . len ( ) <= 1 {
560559 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
563562 defined. initial ,
564563 ) ;
565564 return ;
566565 }
567566
568567 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 ( ) ;
571570 let mut cur = defined. initial ;
572571 for range in & defined. ranges {
573572 let old_j = j;
0 commit comments