@@ -26,6 +26,8 @@ use crate::ty;
26
26
/// Its public API is rather low-level, working directly with allocation offsets and a custom error
27
27
/// type to account for the lack of an AllocId on this level. The Miri/CTFE core engine `memory`
28
28
/// module provides higher-level access.
29
+ // Note: for performance reasons when interning, some of the `Allocation` fields can be partially
30
+ // hashed. (see the `Hash` impl below for more details), so the impl is not derived.
29
31
#[ derive( Clone , Debug , Eq , PartialEq , PartialOrd , Ord , TyEncodable , TyDecodable ) ]
30
32
#[ derive( HashStable ) ]
31
33
pub struct Allocation < Tag = AllocId , Extra = ( ) > {
@@ -50,13 +52,13 @@ pub struct Allocation<Tag = AllocId, Extra = ()> {
50
52
pub extra : Extra ,
51
53
}
52
54
53
- /// This is the maximum size we will hash at a time from these two structures , when interning. Note,
54
- /// we hash that amount of bytes twice: at the start, and at the end of a buffer. Used when an
55
- /// `Allocation` and its `InitMask` are large: we only partially hash the larger fields in that
55
+ /// This is the maximum size we will hash at a time, when interning an `Allocation` and its
56
+ /// `InitMask`. Note, we hash that amount of bytes twice: at the start, and at the end of a buffer.
57
+ /// Used when these two structures are large: we only partially hash the larger fields in that
56
58
/// situation. See the comment at the top of their respective `Hash` impl for more details.
57
59
const MAX_BYTES_TO_HASH : usize = 64 ;
58
60
59
- /// This is the maximum size (in bytes) for which a buffer will be fully hashed when interning.
61
+ /// This is the maximum size (in bytes) for which a buffer will be fully hashed, when interning.
60
62
/// Otherwise, it will be partially hashed in 2 slices, requiring at least 2 `MAX_BYTES_TO_HASH`
61
63
/// bytes.
62
64
const MAX_HASHED_BUFFER_LEN : usize = 2 * MAX_BYTES_TO_HASH ;
@@ -681,6 +683,8 @@ type Block = u64;
681
683
682
684
/// A bitmask where each bit refers to the byte with the same index. If the bit is `true`, the byte
683
685
/// is initialized. If it is `false` the byte is uninitialized.
686
+ // Note: for performance reasons when interning, some of the `InitMask` fields can be partially
687
+ // hashed. (see the `Hash` impl below for more details), so the impl is not derived.
684
688
#[ derive( Clone , Debug , Eq , PartialEq , PartialOrd , Ord , TyEncodable , TyDecodable ) ]
685
689
#[ derive( HashStable ) ]
686
690
pub struct InitMask {
0 commit comments