@@ -27,7 +27,7 @@ pub struct Allocation<Tag = (), Extra = ()> {
27
27
/// at the given offset.
28
28
relocations : Relocations < Tag > ,
29
29
/// Denotes which part of this allocation is initialized.
30
- undef_mask : UninitMask ,
30
+ uninit_mask : UninitMask ,
31
31
/// The size of the allocation. Currently, must always equal `bytes.len()`.
32
32
pub size : Size ,
33
33
/// The alignment of the allocation to detect unaligned reads.
@@ -94,7 +94,7 @@ impl<Tag> Allocation<Tag> {
94
94
Self {
95
95
bytes,
96
96
relocations : Relocations :: new ( ) ,
97
- undef_mask : UninitMask :: new ( size, true ) ,
97
+ uninit_mask : UninitMask :: new ( size, true ) ,
98
98
size,
99
99
align,
100
100
mutability : Mutability :: Not ,
@@ -110,7 +110,7 @@ impl<Tag> Allocation<Tag> {
110
110
Allocation {
111
111
bytes : vec ! [ 0 ; size. bytes_usize( ) ] ,
112
112
relocations : Relocations :: new ( ) ,
113
- undef_mask : UninitMask :: new ( size, false ) ,
113
+ uninit_mask : UninitMask :: new ( size, false ) ,
114
114
size,
115
115
align,
116
116
mutability : Mutability :: Mut ,
@@ -140,7 +140,7 @@ impl Allocation<(), ()> {
140
140
} )
141
141
. collect ( ) ,
142
142
) ,
143
- undef_mask : self . undef_mask ,
143
+ uninit_mask : self . uninit_mask ,
144
144
align : self . align ,
145
145
mutability : self . mutability ,
146
146
extra,
@@ -163,8 +163,8 @@ impl<Tag, Extra> Allocation<Tag, Extra> {
163
163
}
164
164
165
165
/// Returns the undef mask.
166
- pub fn undef_mask ( & self ) -> & UninitMask {
167
- & self . undef_mask
166
+ pub fn uninit_mask ( & self ) -> & UninitMask {
167
+ & self . uninit_mask
168
168
}
169
169
170
170
/// Returns the relocation list.
@@ -363,12 +363,12 @@ impl<'tcx, Tag: Copy, Extra: AllocationExtra<Tag>> Allocation<Tag, Extra> {
363
363
) -> InterpResult < ' tcx , ScalarMaybeUninit < Tag > > {
364
364
// `get_bytes_unchecked` tests relocation edges.
365
365
let bytes = self . get_bytes_with_undef_and_ptr ( cx, ptr, size) ?;
366
- // Undef check happens *after* we established that the alignment is correct.
366
+ // Uninit check happens *after* we established that the alignment is correct.
367
367
// We must not return `Ok()` for unaligned pointers!
368
368
if self . is_defined ( ptr, size) . is_err ( ) {
369
- // This inflates undefined bytes to the entire scalar, even if only a few
370
- // bytes are undefined .
371
- return Ok ( ScalarMaybeUninit :: Undef ) ;
369
+ // This inflates uninitialized bytes to the entire scalar, even if only a few
370
+ // bytes are uninitialized .
371
+ return Ok ( ScalarMaybeUninit :: Uninit ) ;
372
372
}
373
373
// Now we do the actual reading.
374
374
let bits = read_target_uint ( cx. data_layout ( ) . endian , bytes) . unwrap ( ) ;
@@ -416,7 +416,7 @@ impl<'tcx, Tag: Copy, Extra: AllocationExtra<Tag>> Allocation<Tag, Extra> {
416
416
) -> InterpResult < ' tcx > {
417
417
let val = match val {
418
418
ScalarMaybeUninit :: Scalar ( scalar) => scalar,
419
- ScalarMaybeUninit :: Undef => {
419
+ ScalarMaybeUninit :: Uninit => {
420
420
self . mark_definedness ( ptr, type_size, false ) ;
421
421
return Ok ( ( ) ) ;
422
422
}
@@ -516,10 +516,10 @@ impl<'tcx, Tag: Copy, Extra> Allocation<Tag, Extra> {
516
516
// Mark parts of the outermost relocations as undefined if they partially fall outside the
517
517
// given range.
518
518
if first < start {
519
- self . undef_mask . set_range ( first, start, false ) ;
519
+ self . uninit_mask . set_range ( first, start, false ) ;
520
520
}
521
521
if last > end {
522
- self . undef_mask . set_range ( end, last, false ) ;
522
+ self . uninit_mask . set_range ( end, last, false ) ;
523
523
}
524
524
525
525
// Forget all the relocations.
@@ -550,7 +550,7 @@ impl<'tcx, Tag: Copy, Extra> Allocation<Tag, Extra> {
550
550
/// Returns `Ok(())` if it's defined. Otherwise returns the index of the byte
551
551
/// at which the first undefined access begins.
552
552
fn is_defined ( & self , ptr : Pointer < Tag > , size : Size ) -> Result < ( ) , Size > {
553
- self . undef_mask . is_range_defined ( ptr. offset , ptr. offset + size) // `Size` addition
553
+ self . uninit_mask . is_range_defined ( ptr. offset , ptr. offset + size) // `Size` addition
554
554
}
555
555
556
556
/// Checks that a range of bytes is defined. If not, returns the `ReadUndefBytes`
@@ -564,7 +564,7 @@ impl<'tcx, Tag: Copy, Extra> Allocation<Tag, Extra> {
564
564
if size. bytes ( ) == 0 {
565
565
return ;
566
566
}
567
- self . undef_mask . set_range ( ptr. offset , ptr. offset + size, new_state) ;
567
+ self . uninit_mask . set_range ( ptr. offset , ptr. offset + size, new_state) ;
568
568
}
569
569
}
570
570
@@ -603,13 +603,13 @@ impl<Tag, Extra> Allocation<Tag, Extra> {
603
603
// where each element toggles the state.
604
604
605
605
let mut ranges = smallvec:: SmallVec :: < [ u64 ; 1 ] > :: new ( ) ;
606
- let initial = self . undef_mask . get ( src. offset ) ;
606
+ let initial = self . uninit_mask . get ( src. offset ) ;
607
607
let mut cur_len = 1 ;
608
608
let mut cur = initial;
609
609
610
610
for i in 1 ..size. bytes ( ) {
611
611
// FIXME: optimize to bitshift the current undef block's bits and read the top bit.
612
- if self . undef_mask . get ( src. offset + Size :: from_bytes ( i) ) == cur {
612
+ if self . uninit_mask . get ( src. offset + Size :: from_bytes ( i) ) == cur {
613
613
cur_len += 1 ;
614
614
} else {
615
615
ranges. push ( cur_len) ;
@@ -634,7 +634,7 @@ impl<Tag, Extra> Allocation<Tag, Extra> {
634
634
// An optimization where we can just overwrite an entire range of definedness bits if
635
635
// they are going to be uniformly `1` or `0`.
636
636
if defined. ranges . len ( ) <= 1 {
637
- self . undef_mask . set_range_inbounds (
637
+ self . uninit_mask . set_range_inbounds (
638
638
dest. offset ,
639
639
dest. offset + size * repeat, // `Size` operations
640
640
defined. initial ,
@@ -649,7 +649,7 @@ impl<Tag, Extra> Allocation<Tag, Extra> {
649
649
for range in & defined. ranges {
650
650
let old_j = j;
651
651
j += range;
652
- self . undef_mask . set_range_inbounds (
652
+ self . uninit_mask . set_range_inbounds (
653
653
Size :: from_bytes ( old_j) ,
654
654
Size :: from_bytes ( j) ,
655
655
cur,
@@ -741,7 +741,7 @@ impl<Tag: Copy, Extra> Allocation<Tag, Extra> {
741
741
type Block = u64 ;
742
742
743
743
/// A bitmask where each bit refers to the byte with the same index. If the bit is `true`, the byte
744
- /// is defined . If it is `false` the byte is undefined .
744
+ /// is initialized . If it is `false` the byte is uninitialized .
745
745
#[ derive( Clone , Debug , Eq , PartialEq , PartialOrd , Ord , Hash , RustcEncodable , RustcDecodable ) ]
746
746
#[ derive( HashStable ) ]
747
747
pub struct UninitMask {
@@ -758,10 +758,10 @@ impl UninitMask {
758
758
m
759
759
}
760
760
761
- /// Checks whether the range `start..end` (end-exclusive) is entirely defined .
761
+ /// Checks whether the range `start..end` (end-exclusive) is entirely initialized .
762
762
///
763
- /// Returns `Ok(())` if it's defined . Otherwise returns the index of the byte
764
- /// at which the first undefined access begins.
763
+ /// Returns `Ok(())` if it's initialized . Otherwise returns the index of the byte
764
+ /// at which the first uninitialized access begins.
765
765
#[ inline]
766
766
pub fn is_range_defined ( & self , start : Size , end : Size ) -> Result < ( ) , Size > {
767
767
if end > self . len {
0 commit comments