Skip to content

Commit c3a7ca1

Browse files
committed
move InitMask to its own module
1 parent 3477645 commit c3a7ca1

File tree

7 files changed

+582
-598
lines changed

7 files changed

+582
-598
lines changed

compiler/rustc_codegen_llvm/src/consts.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,7 @@ pub fn const_alloc_to_llvm<'ll>(cx: &CodegenCx<'ll, '_>, alloc: ConstAllocation<
3838
alloc: &'a Allocation,
3939
range: Range<usize>,
4040
) {
41-
let chunks = alloc
42-
.init_mask()
43-
.range_as_init_chunks(Size::from_bytes(range.start), Size::from_bytes(range.end));
41+
let chunks = alloc.init_mask().range_as_init_chunks(range.clone().into());
4442

4543
let chunk_to_llval = move |chunk| match chunk {
4644
InitChunk::Init(range) => {

compiler/rustc_const_eval/src/interpret/memory.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1089,7 +1089,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
10891089
.prepare_copy(src_range, dest_offset, num_copies, self)
10901090
.map_err(|e| e.to_interp_error(dest_alloc_id))?;
10911091
// Prepare a copy of the initialization mask.
1092-
let init = src_alloc.compress_uninit_range(src_range);
1092+
let init = src_alloc.init_mask().prepare_copy(src_range);
10931093

10941094
// Destination alloc preparations and access hooks.
10951095
let (dest_alloc, extra) = self.get_alloc_raw_mut(dest_alloc_id)?;
@@ -1155,8 +1155,8 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
11551155
}
11561156

11571157
// now fill in all the "init" data
1158-
dest_alloc.mark_compressed_init_range(
1159-
&init,
1158+
dest_alloc.init_mask_apply_copy(
1159+
init,
11601160
alloc_range(dest_offset, size), // just a single copy (i.e., not full `dest_range`)
11611161
num_copies,
11621162
);

0 commit comments

Comments
 (0)