1
Fork 0

deduplicate a lot of code

This commit is contained in:
b-naber 2022-04-21 19:35:06 +02:00
parent 28af967bb9
commit bc698c73e9
6 changed files with 119 additions and 244 deletions

View file

@ -433,7 +433,6 @@ impl<Tag: Provenance, Extra> Allocation<Tag, Extra> {
return self.write_uninit(cx, range);
}
};
debug!(?val);
// `to_bits_or_ptr_internal` is the right method because we just want to store this data
// as-is into memory.
@ -444,16 +443,13 @@ impl<Tag: Provenance, Extra> Allocation<Tag, Extra> {
}
Ok(data) => (data, None),
};
debug!(?bytes, ?provenance);
let endian = cx.data_layout().endian;
let dst = self.get_bytes_mut(cx, range)?;
debug!(?dst);
write_target_uint(endian, dst, bytes).unwrap();
// See if we have to also write a relocation.
if let Some(provenance) = provenance {
debug!("insert relocation for {:?}", provenance);
self.relocations.0.insert(range.start, provenance);
}