afa1dddcf9
Previously, Item was a struct of a NonZeroU64, an Option which was usually unset or irrelevant, and a 4-variant enum. So collectively, the size of an Item was 24 bytes, but only 8 bytes were used for the most part. So this takes advantage of the fact that it is probably impossible to exhaust the total space of SbTags, and steals 3 bits from it to pack the whole struct into a single u64. This bit-packing means that we reduce peak memory usage when Miri goes memory-bound by ~3x. We also get CPU performance improvements of varying size, because not only are we simply accessing less memory, we can now compare a Vec<Item> using a memcmp because it does not have any padding.
39 lines
2.2 KiB
Plaintext
39 lines
2.2 KiB
Plaintext
error: Undefined Behavior: deallocating while item is protected: [SharedReadWrite for <TAG>] (call ID)
|
|
--> RUSTLIB/alloc/src/alloc.rs:LL:CC
|
|
|
|
|
LL | unsafe { __rust_dealloc(ptr, layout.size(), layout.align()) }
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ deallocating while item is protected: [SharedReadWrite for <TAG>] (call ID)
|
|
|
|
|
= help: this indicates a potential bug in the program: it performed an invalid operation, but the Stacked Borrows rules it violated are still experimental
|
|
= help: see https://github.com/rust-lang/unsafe-code-guidelines/blob/master/wip/stacked-borrows.md for further information
|
|
= note: backtrace:
|
|
= note: inside `std::alloc::dealloc` at RUSTLIB/alloc/src/alloc.rs:LL:CC
|
|
= note: inside `<std::alloc::Global as std::alloc::Allocator>::deallocate` at RUSTLIB/alloc/src/alloc.rs:LL:CC
|
|
= note: inside `alloc::alloc::box_free::<NotUnpin, std::alloc::Global>` at RUSTLIB/alloc/src/alloc.rs:LL:CC
|
|
= note: inside `std::ptr::drop_in_place::<std::boxed::Box<NotUnpin>> - shim(Some(std::boxed::Box<NotUnpin>))` at RUSTLIB/core/src/ptr/mod.rs:LL:CC
|
|
= note: inside `std::mem::drop::<std::boxed::Box<NotUnpin>>` at RUSTLIB/core/src/mem/mod.rs:LL:CC
|
|
note: inside closure at $DIR/deallocate_against_barrier2.rs:LL:CC
|
|
--> $DIR/deallocate_against_barrier2.rs:LL:CC
|
|
|
|
|
LL | drop(unsafe { Box::from_raw(raw) });
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
= note: inside `<[closure@$DIR/deallocate_against_barrier2.rs:LL:CC] as std::ops::FnOnce<(&mut NotUnpin,)>>::call_once - shim` at RUSTLIB/core/src/ops/function.rs:LL:CC
|
|
note: inside `inner` at $DIR/deallocate_against_barrier2.rs:LL:CC
|
|
--> $DIR/deallocate_against_barrier2.rs:LL:CC
|
|
|
|
|
LL | f(x)
|
|
| ^^^^
|
|
note: inside `main` at $DIR/deallocate_against_barrier2.rs:LL:CC
|
|
--> $DIR/deallocate_against_barrier2.rs:LL:CC
|
|
|
|
|
LL | / inner(Box::leak(Box::new(NotUnpin(0, PhantomPinned))), |x| {
|
|
LL | | let raw = x as *mut _;
|
|
LL | | drop(unsafe { Box::from_raw(raw) });
|
|
LL | | });
|
|
| |______^
|
|
|
|
note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace
|
|
|
|
error: aborting due to previous error
|
|
|