@@ -581,8 +581,10 @@ impl<'tcx, Tag, Extra> Allocation<Tag, Extra> {
581
581
/// Run-length encoding of the undef mask.
582
582
/// Used to copy parts of a mask multiple times to another allocation.
583
583
pub struct AllocationDefinedness {
584
+ /// The lengths of ranges that are run-length encoded.
584
585
ranges : smallvec:: SmallVec :: < [ u64 ; 1 ] > ,
585
- first : bool ,
586
+ /// The definedness of the first range.
587
+ initial : bool ,
586
588
}
587
589
588
590
/// Transferring the definedness mask to other allocations.
@@ -606,9 +608,9 @@ impl<Tag, Extra> Allocation<Tag, Extra> {
606
608
// where each element toggles the state
607
609
608
610
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 ) ;
610
612
let mut cur_len = 1 ;
611
- let mut cur = first ;
613
+ let mut cur = initial ;
612
614
613
615
for i in 1 ..size. bytes ( ) {
614
616
// 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> {
623
625
624
626
ranges. push ( cur_len) ;
625
627
626
- AllocationDefinedness { ranges, first , }
628
+ AllocationDefinedness { ranges, initial , }
627
629
}
628
630
629
631
/// Apply multiple instances of the run-length encoding to the undef_mask.
@@ -640,15 +642,15 @@ impl<Tag, Extra> Allocation<Tag, Extra> {
640
642
self . undef_mask . set_range_inbounds (
641
643
dest. offset ,
642
644
dest. offset + size * repeat,
643
- defined. first ,
645
+ defined. initial ,
644
646
) ;
645
647
return ;
646
648
}
647
649
648
650
for mut j in 0 ..repeat {
649
651
j *= size. bytes ( ) ;
650
652
j += dest. offset . bytes ( ) ;
651
- let mut cur = defined. first ;
653
+ let mut cur = defined. initial ;
652
654
for range in & defined. ranges {
653
655
let old_j = j;
654
656
j += range;
@@ -725,16 +727,19 @@ impl<Tag: Copy, Extra> Allocation<Tag, Extra> {
725
727
// shift offsets from source allocation to destination allocation
726
728
offset + dest_offset - src. offset ,
727
729
reloc,
728
- )
730
+ )
729
731
} )
730
- ) ;
732
+ ) ;
731
733
}
732
734
733
735
AllocationRelocations {
734
736
relative_relocations : new_relocations,
735
737
}
736
738
}
737
739
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.
738
743
pub fn mark_relocation_range (
739
744
& mut self ,
740
745
relocations : AllocationRelocations < Tag > ,
0 commit comments