mirror of
https://github.com/rust-lang/rust.git
synced 2025-01-31 09:04:18 +00:00
Minor cleanup
This commit is contained in:
parent
2b46c7c906
commit
2af02abd93
@ -347,10 +347,6 @@ impl<'tcx> LayoutCx<'tcx, TyCtxt<'tcx>> {
|
|||||||
|
|
||||||
let mut inverse_memory_index: Vec<u32> = (0..fields.len() as u32).collect();
|
let mut inverse_memory_index: Vec<u32> = (0..fields.len() as u32).collect();
|
||||||
|
|
||||||
// `ReprOptions.layout_seed` is a deterministic seed that we can use to
|
|
||||||
// randomize field ordering with
|
|
||||||
let mut rng = Xoshiro128StarStar::seed_from_u64(repr.field_shuffle_seed);
|
|
||||||
|
|
||||||
let optimize = !repr.inhibit_struct_field_reordering_opt();
|
let optimize = !repr.inhibit_struct_field_reordering_opt();
|
||||||
if optimize {
|
if optimize {
|
||||||
let end =
|
let end =
|
||||||
@ -364,6 +360,10 @@ impl<'tcx> LayoutCx<'tcx, TyCtxt<'tcx>> {
|
|||||||
// the field ordering to try and catch some code making assumptions about layouts
|
// the field ordering to try and catch some code making assumptions about layouts
|
||||||
// we don't guarantee
|
// we don't guarantee
|
||||||
if repr.can_randomize_type_layout() {
|
if repr.can_randomize_type_layout() {
|
||||||
|
// `ReprOptions.layout_seed` is a deterministic seed that we can use to
|
||||||
|
// randomize field ordering with
|
||||||
|
let mut rng = Xoshiro128StarStar::seed_from_u64(repr.field_shuffle_seed);
|
||||||
|
|
||||||
// Shuffle the ordering of the fields
|
// Shuffle the ordering of the fields
|
||||||
optimizing.shuffle(&mut rng);
|
optimizing.shuffle(&mut rng);
|
||||||
|
|
||||||
|
@ -1608,9 +1608,9 @@ bitflags! {
|
|||||||
// the seed stored in `ReprOptions.layout_seed`
|
// the seed stored in `ReprOptions.layout_seed`
|
||||||
const RANDOMIZE_LAYOUT = 1 << 5;
|
const RANDOMIZE_LAYOUT = 1 << 5;
|
||||||
// Any of these flags being set prevent field reordering optimisation.
|
// Any of these flags being set prevent field reordering optimisation.
|
||||||
const IS_UNOPTIMISABLE = ReprFlags::IS_C.bits |
|
const IS_UNOPTIMISABLE = ReprFlags::IS_C.bits
|
||||||
ReprFlags::IS_SIMD.bits |
|
| ReprFlags::IS_SIMD.bits
|
||||||
ReprFlags::IS_LINEAR.bits;
|
| ReprFlags::IS_LINEAR.bits;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user