@@ -581,8 +581,10 @@ impl<'tcx, Tag, Extra> Allocation<Tag, Extra> {
581581/// Run-length encoding of the undef mask.
582582/// Used to copy parts of a mask multiple times to another allocation.
583583pub struct AllocationDefinedness {
584+ /// The lengths of ranges that are run-length encoded.
584585 ranges : smallvec:: SmallVec :: < [ u64 ; 1 ] > ,
585- first : bool ,
586+ /// The definedness of the first range.
587+ initial : bool ,
586588}
587589
588590/// Transferring the definedness mask to other allocations.
@@ -606,9 +608,9 @@ impl<Tag, Extra> Allocation<Tag, Extra> {
606608 // where each element toggles the state
607609
608610 let mut ranges = smallvec:: SmallVec :: < [ u64 ; 1 ] > :: new ( ) ;
609- let first = self . undef_mask . get ( src. offset ) ;
611+ let initial = self . undef_mask . get ( src. offset ) ;
610612 let mut cur_len = 1 ;
611- let mut cur = first ;
613+ let mut cur = initial ;
612614
613615 for i in 1 ..size. bytes ( ) {
614616 // FIXME: optimize to bitshift the current undef block's bits and read the top bit
@@ -623,7 +625,7 @@ impl<Tag, Extra> Allocation<Tag, Extra> {
623625
624626 ranges. push ( cur_len) ;
625627
626- AllocationDefinedness { ranges, first , }
628+ AllocationDefinedness { ranges, initial , }
627629 }
628630
629631 /// Apply multiple instances of the run-length encoding to the undef_mask.
@@ -640,15 +642,15 @@ impl<Tag, Extra> Allocation<Tag, Extra> {
640642 self . undef_mask . set_range_inbounds (
641643 dest. offset ,
642644 dest. offset + size * repeat,
643- defined. first ,
645+ defined. initial ,
644646 ) ;
645647 return ;
646648 }
647649
648650 for mut j in 0 ..repeat {
649651 j *= size. bytes ( ) ;
650652 j += dest. offset . bytes ( ) ;
651- let mut cur = defined. first ;
653+ let mut cur = defined. initial ;
652654 for range in & defined. ranges {
653655 let old_j = j;
654656 j += range;
@@ -725,16 +727,19 @@ impl<Tag: Copy, Extra> Allocation<Tag, Extra> {
725727 // shift offsets from source allocation to destination allocation
726728 offset + dest_offset - src. offset ,
727729 reloc,
728- )
730+ )
729731 } )
730- ) ;
732+ ) ;
731733 }
732734
733735 AllocationRelocations {
734736 relative_relocations : new_relocations,
735737 }
736738 }
737739
740+ /// Apply a relocation copy.
741+ /// The affected range, as defined in the parameters to `prepare_relocation_copy` is expected
742+ /// to be clear of relocations.
738743 pub fn mark_relocation_range (
739744 & mut self ,
740745 relocations : AllocationRelocations < Tag > ,
0 commit comments