rust/tests/fail
bors db5a2b9747 Auto merge of #2315 - saethlin:shrink-item, r=saethlin
Optimizing Stacked Borrows (part 2): Shrink Item

This moves protectors out of `Item`, storing them both in a global `HashSet` which contains all currently-protected tags as well as a `Vec<SbTag>` on each `Frame` so that when we return from a function we know which tags to remove from the protected set.

This also bit-packs the 64-bit tag and the 2-bit permission together when they are stored in memory. This means we theoretically run out of tags sooner, but I doubt that limit will ever be hit.

Together these optimizations reduce the memory footprint of Miri when executing programs which stress Stacked Borrows by ~66%. For example, running a test with isolation off which only panics currently peaks at ~19 GB, with this PR it peaks at ~6.2 GB.

To-do
- [x] Enforce the 62-bit limit
- [x] Decide if there is a better order to pack the tag and permission in
- [x] Wait for `UnsafeCell` to become infectious, or express offsets + tags in the global protector set

Benchmarks before:
```
Benchmark 1: cargo +miri miri run --manifest-path bench-cargo-miri/backtraces/Cargo.toml
  Time (mean ± σ):      8.948 s ±  0.253 s    [User: 8.752 s, System: 0.158 s]
  Range (min … max):    8.619 s …  9.279 s    5 runs

Benchmark 1: cargo +miri miri run --manifest-path bench-cargo-miri/mse/Cargo.toml
  Time (mean ± σ):      2.129 s ±  0.037 s    [User: 1.849 s, System: 0.248 s]
  Range (min … max):    2.086 s …  2.176 s    5 runs

Benchmark 1: cargo +miri miri run --manifest-path bench-cargo-miri/serde1/Cargo.toml
  Time (mean ± σ):      3.334 s ±  0.017 s    [User: 3.211 s, System: 0.103 s]
  Range (min … max):    3.315 s …  3.352 s    5 runs

Benchmark 1: cargo +miri miri run --manifest-path bench-cargo-miri/serde2/Cargo.toml
  Time (mean ± σ):      3.316 s ±  0.038 s    [User: 3.207 s, System: 0.095 s]
  Range (min … max):    3.282 s …  3.375 s    5 runs

Benchmark 1: cargo +miri miri run --manifest-path bench-cargo-miri/unicode/Cargo.toml
  Time (mean ± σ):      6.391 s ±  0.323 s    [User: 5.928 s, System: 0.412 s]
  Range (min … max):    6.090 s …  6.917 s    5 runs
 ```
 After:
 ```
Benchmark 1: cargo +miri miri run --manifest-path bench-cargo-miri/backtraces/Cargo.toml
  Time (mean ± σ):      6.955 s ±  0.051 s    [User: 6.807 s, System: 0.132 s]
  Range (min … max):    6.900 s …  7.038 s    5 runs

Benchmark 1: cargo +miri miri run --manifest-path bench-cargo-miri/mse/Cargo.toml
  Time (mean ± σ):      1.784 s ±  0.012 s    [User: 1.627 s, System: 0.156 s]
  Range (min … max):    1.772 s …  1.797 s    5 runs

Benchmark 1: cargo +miri miri run --manifest-path bench-cargo-miri/serde1/Cargo.toml
  Time (mean ± σ):      2.505 s ±  0.095 s    [User: 2.311 s, System: 0.096 s]
  Range (min … max):    2.405 s …  2.603 s    5 runs

Benchmark 1: cargo +miri miri run --manifest-path bench-cargo-miri/serde2/Cargo.toml
  Time (mean ± σ):      2.449 s ±  0.031 s    [User: 2.306 s, System: 0.100 s]
  Range (min … max):    2.395 s …  2.467 s    5 runs

Benchmark 1: cargo +miri miri run --manifest-path bench-cargo-miri/unicode/Cargo.toml
  Time (mean ± σ):      3.667 s ±  0.110 s    [User: 3.498 s, System: 0.140 s]
  Range (min … max):    3.564 s …  3.814 s    5 runs
 ```
 The decrease in system time is probably due to spending less time in the page fault handler.
2022-07-13 01:44:01 +00:00
..
alloc require level and colon in //~ style comments 2022-07-11 11:48:56 +00:00
backtrace require level and colon in //~ style comments 2022-07-11 11:48:56 +00:00
concurrency require level and colon in //~ style comments 2022-07-11 11:48:56 +00:00
dangling_pointers require level and colon in //~ style comments 2022-07-11 11:48:56 +00:00
data_race require level and colon in //~ style comments 2022-07-11 11:48:56 +00:00
fs require level and colon in //~ style comments 2022-07-11 11:48:56 +00:00
function_calls Fix annotation filtering with revisions 2022-07-11 17:19:10 +00:00
function_pointers require level and colon in //~ style comments 2022-07-11 11:48:56 +00:00
intrinsics require level and colon in //~ style comments 2022-07-11 11:48:56 +00:00
panic require level and colon in //~ style comments 2022-07-11 11:48:56 +00:00
provenance require level and colon in //~ style comments 2022-07-11 11:48:56 +00:00
should-pass Replace all //error-pattern comments with strict syntax and fix other comments in the same files 2022-07-08 15:55:37 +00:00
stacked_borrows Auto merge of #2315 - saethlin:shrink-item, r=saethlin 2022-07-13 01:44:01 +00:00
sync require level and colon in //~ style comments 2022-07-11 11:48:56 +00:00
unaligned_pointers require level and colon in //~ style comments 2022-07-11 11:48:56 +00:00
validity test that we also find bad uses of mem::uninitialized 2022-07-12 09:55:28 -04:00
weak_memory make more tests deterministic 2022-07-10 20:21:19 -04:00
abort-terminator.rs Manual adjustments 2022-06-23 13:08:52 -07:00
abort-terminator.stderr Bless stderr files after rustfmt 2022-06-23 13:08:52 -07:00
box-cell-alias.rs require level and colon in //~ style comments 2022-07-11 11:48:56 +00:00
box-cell-alias.stderr pointer tag tracking: on creation, log the offsets it is created for 2022-07-02 11:33:29 -04:00
branchless-select-i128-pointer.rs require level and colon in //~ style comments 2022-07-11 11:48:56 +00:00
branchless-select-i128-pointer.stderr pointer tag tracking: on creation, log the offsets it is created for 2022-07-02 11:33:29 -04:00
breakpoint.rs require level and colon in //~ style comments 2022-07-11 11:48:56 +00:00
breakpoint.stderr rename test suite directories 2022-06-01 10:53:38 -04:00
environ-gets-deallocated.rs require level and colon in //~ style comments 2022-07-11 11:48:56 +00:00
environ-gets-deallocated.stderr pointer tag tracking: on creation, log the offsets it is created for 2022-07-02 11:33:29 -04:00
erroneous_const.rs require level and colon in //~ style comments 2022-07-11 11:48:56 +00:00
erroneous_const.stderr rustup 2022-06-16 11:18:09 -07:00
erroneous_const2.rs require level and colon in //~ style comments 2022-07-11 11:48:56 +00:00
erroneous_const2.stderr rustup 2022-07-02 08:38:07 -04:00
extern_static.rs require level and colon in //~ style comments 2022-07-11 11:48:56 +00:00
extern_static.stderr pointer tag tracking: on creation, log the offsets it is created for 2022-07-02 11:33:29 -04:00
extern_static_in_const.rs require level and colon in //~ style comments 2022-07-11 11:48:56 +00:00
extern_static_in_const.stderr pointer tag tracking: on creation, log the offsets it is created for 2022-07-02 11:33:29 -04:00
fast_math_both.rs require level and colon in //~ style comments 2022-07-11 11:48:56 +00:00
fast_math_both.stderr pointer tag tracking: on creation, log the offsets it is created for 2022-07-02 11:33:29 -04:00
fast_math_first.rs require level and colon in //~ style comments 2022-07-11 11:48:56 +00:00
fast_math_first.stderr pointer tag tracking: on creation, log the offsets it is created for 2022-07-02 11:33:29 -04:00
fast_math_second.rs require level and colon in //~ style comments 2022-07-11 11:48:56 +00:00
fast_math_second.stderr pointer tag tracking: on creation, log the offsets it is created for 2022-07-02 11:33:29 -04:00
generator-pinned-moved.rs require level and colon in //~ style comments 2022-07-11 11:48:56 +00:00
generator-pinned-moved.stderr pointer tag tracking: on creation, log the offsets it is created for 2022-07-02 11:33:29 -04:00
invalid_bool.rs require level and colon in //~ style comments 2022-07-11 11:48:56 +00:00
invalid_bool.stderr pointer tag tracking: on creation, log the offsets it is created for 2022-07-02 11:33:29 -04:00
invalid_char.rs require level and colon in //~ style comments 2022-07-11 11:48:56 +00:00
invalid_char.stderr pointer tag tracking: on creation, log the offsets it is created for 2022-07-02 11:33:29 -04:00
invalid_enum_tag.rs Replace all //error-pattern comments with strict syntax and fix other comments in the same files 2022-07-08 15:55:37 +00:00
invalid_enum_tag.stderr pointer tag tracking: on creation, log the offsets it is created for 2022-07-02 11:33:29 -04:00
invalid_int.rs require level and colon in //~ style comments 2022-07-11 11:48:56 +00:00
invalid_int.stderr pointer tag tracking: on creation, log the offsets it is created for 2022-07-02 11:33:29 -04:00
issue-miri-1112.rs require level and colon in //~ style comments 2022-07-11 11:48:56 +00:00
issue-miri-1112.stderr pointer tag tracking: on creation, log the offsets it is created for 2022-07-02 11:33:29 -04:00
memleak.rs Replace all //error-pattern comments with strict syntax and fix other comments in the same files 2022-07-08 15:55:37 +00:00
memleak.stderr rename test suite directories 2022-06-01 10:53:38 -04:00
memleak_rc.32bit.stderr rename test suite directories 2022-06-01 10:53:38 -04:00
memleak_rc.64bit.stderr rename test suite directories 2022-06-01 10:53:38 -04:00
memleak_rc.rs Replace all //error-pattern comments with strict syntax and fix other comments in the same files 2022-07-08 15:55:37 +00:00
memleak_rc.stderr Replace all //error-pattern comments with strict syntax and fix other comments in the same files 2022-07-08 15:55:37 +00:00
modifying_constants.rs require level and colon in //~ style comments 2022-07-11 11:48:56 +00:00
modifying_constants.stderr pointer tag tracking: on creation, log the offsets it is created for 2022-07-02 11:33:29 -04:00
never_say_never.rs require level and colon in //~ style comments 2022-07-11 11:48:56 +00:00
never_say_never.stderr pointer tag tracking: on creation, log the offsets it is created for 2022-07-02 11:33:29 -04:00
never_transmute_humans.rs require level and colon in //~ style comments 2022-07-11 11:48:56 +00:00
never_transmute_humans.stderr pointer tag tracking: on creation, log the offsets it is created for 2022-07-02 11:33:29 -04:00
never_transmute_void.rs require level and colon in //~ style comments 2022-07-11 11:48:56 +00:00
never_transmute_void.stderr pointer tag tracking: on creation, log the offsets it is created for 2022-07-02 11:33:29 -04:00
no_main.rs Replace all //error-pattern comments with strict syntax and fix other comments in the same files 2022-07-08 15:55:37 +00:00
no_main.stderr rename test suite directories 2022-06-01 10:53:38 -04:00
pointer_partial_overwrite.rs require level and colon in //~ style comments 2022-07-11 11:48:56 +00:00
pointer_partial_overwrite.stderr pointer tag tracking: on creation, log the offsets it is created for 2022-07-02 11:33:29 -04:00
rc_as_ptr.rs require level and colon in //~ style comments 2022-07-11 11:48:56 +00:00
rc_as_ptr.stderr pointer tag tracking: on creation, log the offsets it is created for 2022-07-02 11:33:29 -04:00
reading_half_a_pointer.rs require level and colon in //~ style comments 2022-07-11 11:48:56 +00:00
reading_half_a_pointer.stderr pointer tag tracking: on creation, log the offsets it is created for 2022-07-02 11:33:29 -04:00
rustc-error.rs require level and colon in //~ style comments 2022-07-11 11:48:56 +00:00
rustc-error.stderr rename test suite directories 2022-06-01 10:53:38 -04:00
shim_arg_size.32bit.stderr pointer tag tracking: on creation, log the offsets it is created for 2022-07-02 11:33:29 -04:00
shim_arg_size.64bit.stderr pointer tag tracking: on creation, log the offsets it is created for 2022-07-02 11:33:29 -04:00
shim_arg_size.rs require level and colon in //~ style comments 2022-07-11 11:48:56 +00:00
static_memory_modification1.rs require level and colon in //~ style comments 2022-07-11 11:48:56 +00:00
static_memory_modification1.stderr pointer tag tracking: on creation, log the offsets it is created for 2022-07-02 11:33:29 -04:00
static_memory_modification2.rs require level and colon in //~ style comments 2022-07-11 11:48:56 +00:00
static_memory_modification2.stderr pointer tag tracking: on creation, log the offsets it is created for 2022-07-02 11:33:29 -04:00
static_memory_modification3.rs require level and colon in //~ style comments 2022-07-11 11:48:56 +00:00
static_memory_modification3.stderr pointer tag tracking: on creation, log the offsets it is created for 2022-07-02 11:33:29 -04:00
transmute-pair-uninit.rs require level and colon in //~ style comments 2022-07-11 11:48:56 +00:00
transmute-pair-uninit.stderr pointer tag tracking: on creation, log the offsets it is created for 2022-07-02 11:33:29 -04:00
transmute_fat1.rs rustup 2022-06-29 21:31:27 -04:00
transmute_fat1.stderr pointer tag tracking: on creation, log the offsets it is created for 2022-07-02 11:33:29 -04:00
type-too-large.rs require level and colon in //~ style comments 2022-07-11 11:48:56 +00:00
type-too-large.stderr Bless stderr files after rustfmt 2022-06-21 23:21:37 -07:00
uninit_buffer.rs Replace all //error-pattern comments with strict syntax and fix other comments in the same files 2022-07-08 15:55:37 +00:00
uninit_buffer.stderr rustup 2022-07-07 20:12:30 -04:00
uninit_byte_read.rs require level and colon in //~ style comments 2022-07-11 11:48:56 +00:00
uninit_byte_read.stderr pointer tag tracking: on creation, log the offsets it is created for 2022-07-02 11:33:29 -04:00
uninit_raw_ptr.rs require level and colon in //~ style comments 2022-07-11 11:48:56 +00:00
uninit_raw_ptr.stderr pointer tag tracking: on creation, log the offsets it is created for 2022-07-02 11:33:29 -04:00
unreachable.rs Replace all //error-pattern comments with strict syntax and fix other comments in the same files 2022-07-08 15:55:37 +00:00
unreachable.stderr pointer tag tracking: on creation, log the offsets it is created for 2022-07-02 11:33:29 -04:00
unsized-local.rs require level and colon in //~ style comments 2022-07-11 11:48:56 +00:00
unsized-local.stderr adjust tests for removal of unsized_locals 2022-07-06 21:40:31 -04:00
unsupported_foreign_function.rs require level and colon in //~ style comments 2022-07-11 11:48:56 +00:00
unsupported_foreign_function.stderr pointer tag tracking: on creation, log the offsets it is created for 2022-07-02 11:33:29 -04:00
unsupported_signal.rs require level and colon in //~ style comments 2022-07-11 11:48:56 +00:00
unsupported_signal.stderr pointer tag tracking: on creation, log the offsets it is created for 2022-07-02 11:33:29 -04:00
zst1.rs require level and colon in //~ style comments 2022-07-11 11:48:56 +00:00
zst1.stderr pointer tag tracking: on creation, log the offsets it is created for 2022-07-02 11:33:29 -04:00
zst2.rs require level and colon in //~ style comments 2022-07-11 11:48:56 +00:00
zst2.stderr pointer tag tracking: on creation, log the offsets it is created for 2022-07-02 11:33:29 -04:00
zst3.rs require level and colon in //~ style comments 2022-07-11 11:48:56 +00:00
zst3.stderr pointer tag tracking: on creation, log the offsets it is created for 2022-07-02 11:33:29 -04:00