Make zst accesses in allocations take the regular path.
Speeding up zst accesses should be done on a higher level.
This commit is contained in:
parent
3a0e8254b0
commit
a835555474
1 changed files with 0 additions and 21 deletions
|
|
@ -116,12 +116,7 @@ impl<'tcx, Tag: Copy, Extra: AllocationExtra<Tag>> Allocation<Tag, Extra> {
|
|||
size: Size,
|
||||
allow_ptr_and_undef: bool,
|
||||
) -> EvalResult<'tcx> {
|
||||
// Empty accesses don't need to be valid pointers, but they should still be non-NULL
|
||||
let align = Align::from_bytes(1).unwrap();
|
||||
if size.bytes() == 0 {
|
||||
self.check_align(ptr, align)?;
|
||||
return Ok(());
|
||||
}
|
||||
// Check bounds, align and relocations on the edges
|
||||
self.get_bytes_with_undef_and_ptr(cx, ptr, size, align)?;
|
||||
// Check undef and ptr
|
||||
|
|
@ -138,12 +133,7 @@ impl<'tcx, Tag: Copy, Extra: AllocationExtra<Tag>> Allocation<Tag, Extra> {
|
|||
ptr: Pointer<Tag>,
|
||||
size: Size,
|
||||
) -> EvalResult<'tcx, &[u8]> {
|
||||
// Empty accesses don't need to be valid pointers, but they should still be non-NULL
|
||||
let align = Align::from_bytes(1).unwrap();
|
||||
if size.bytes() == 0 {
|
||||
self.check_align(ptr, align)?;
|
||||
return Ok(&[]);
|
||||
}
|
||||
self.get_bytes(cx, ptr, size, align)
|
||||
}
|
||||
|
||||
|
|
@ -153,12 +143,7 @@ impl<'tcx, Tag: Copy, Extra: AllocationExtra<Tag>> Allocation<Tag, Extra> {
|
|||
ptr: Pointer<Tag>,
|
||||
src: &[u8],
|
||||
) -> EvalResult<'tcx> {
|
||||
// Empty accesses don't need to be valid pointers, but they should still be non-NULL
|
||||
let align = Align::from_bytes(1).unwrap();
|
||||
if src.is_empty() {
|
||||
self.check_align(ptr, align)?;
|
||||
return Ok(());
|
||||
}
|
||||
let bytes = self.get_bytes_mut(
|
||||
cx, ptr, Size::from_bytes(src.len() as u64), align,
|
||||
)?;
|
||||
|
|
@ -173,12 +158,7 @@ impl<'tcx, Tag: Copy, Extra: AllocationExtra<Tag>> Allocation<Tag, Extra> {
|
|||
val: u8,
|
||||
count: Size
|
||||
) -> EvalResult<'tcx> {
|
||||
// Empty accesses don't need to be valid pointers, but they should still be non-NULL
|
||||
let align = Align::from_bytes(1).unwrap();
|
||||
if count.bytes() == 0 {
|
||||
self.check_align(ptr, align)?;
|
||||
return Ok(());
|
||||
}
|
||||
let bytes = self.get_bytes_mut(cx, ptr, count, align)?;
|
||||
for b in bytes {
|
||||
*b = val;
|
||||
|
|
@ -329,7 +309,6 @@ impl<'tcx, Tag: Copy, Extra: AllocationExtra<Tag>> Allocation<Tag, Extra> {
|
|||
align: Align,
|
||||
check_defined_and_ptr: bool,
|
||||
) -> EvalResult<'tcx, &[u8]> {
|
||||
assert_ne!(size.bytes(), 0, "0-sized accesses should never even get a `Pointer`");
|
||||
self.check_align(ptr.into(), align)?;
|
||||
self.check_bounds(cx, ptr, size)?;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue