summary refs log tree commit diff
path: root/src/librustc_data_structures/indexed_set.rs
AgeCommit message (Collapse)AuthorLines
2018-09-14Remove `Iter` and `SparseIter` in indexed_set.rs.Nicholas Nethercote-35/+7
Because they're just thin wrappers around `BitIter` and `slice::Iter`.
2018-09-13Remove bitslice.rs.Nicholas Nethercote-133/+21
This requires the following changes. - It moves parts of bitslice.rs into bitvec.rs: `bitwise()`, `BitwiseOperator`, `bits_to_string()`. - It changes `IdxSet` to just be a wrapper around `BitArray`. - It changes `BitArray` and `BitVec` to use `usize` words instead of `u128` words. (`BitSlice` and `IdxSet` already use `usize`.) Local profiling showed `usize` was better. - It moves some operations from `IdxSet` into `BitArray`: `new_filled()`, `clear()`, `set_up_to()`, `trim_to()` (renamed `clear_above()`), `words()` and `words_mut()`, `encode()` and `decode(). The `IdxSet` operations now just call the `BitArray` operations. - It replaces `BitArray`'s iterator implementation with `IdxSet`'s, because the latter is more concise. It also removes the buggy `size_hint` function from `BitArray`'s iterator, which counted the number of *words* rather than the number of *bits*. `IdxSet`'s iterator is now just a thin wrapper around `BitArray`'s iterator. - It moves some unit tests from `indexed_set.rs` to `bitvec.rs`.
2018-08-24Introduce `UnionIntoIdxSet` and `SubtractFromIdxSet` traits.Nicholas Nethercote-38/+68
They let `union()`, `union_sparse()` and `union_hybrid()` be merged. Likewise for subtract()`, `subtract_sparse()` and `subtract_hybrid()`.
2018-08-24Rename `universe_size` as `domain_size`.Nicholas Nethercote-36/+32
Because `domain` is a more obvious term than `universe` for this concept.
2018-08-20Remove IdxSet typedef and Rename {,Hybrid}IdxSetBuf as {,Hybrid}IdxSet.Nicholas Nethercote-61/+58
Now that the `Buf` vs. non-`Buf` distinction has been removed, it makes sense to drop the `Buf` suffix and use the shorter names everywhere.
2018-08-20Merge `IdxSet` and `IdxSetBuf`.Nicholas Nethercote-88/+5
The `Buf` vs. non-`Buf` distinction is no longer necessary, and the nastiest code in this file can be removed. To minimize this patch, `IdxSet` is made a typedef of `IdxSetBuf`. The next patch will remove this typedef.
2018-08-17Auto merge of #53383 - nnethercote:HybridIdxSetBuf, r=nikomatsakisbors-10/+237
Speed up NLL with HybridIdxSetBuf. It's a sparse-when-small but dense-when-large index set that is very efficient for sets that (a) have few elements, (b) have large universe_size values, and (c) are cleared frequently. Which makes it perfect for the `gen_set` and `kill_set` sets used by the new borrow checker. This patch reduces `tuple-stress`'s NLL-check time by 40%, and up to 12% for several other benchmarks. And it halves the max-rss for `keccak`, and has smaller wins for `inflate` and `clap-rs`.
2018-08-16Speed up NLL with `HybridIdxSetBuf`.Nicholas Nethercote-10/+237
`HybridIdxSetBuf` is a sparse-when-small but dense-when-large index set that is very efficient for sets that (a) have few elements, (b) have large `universe_size` values, and (c) are cleared frequently. Which makes it perfect for the `gen_set` and `kill_set` sets used by the new borrow checker. This patch reduces the execution time of the five slowest NLL benchmarks by 55%, 21%, 16%, 10% and 9%. It also reduces the max-rss of three benchmarks by 53%, 33%, and 9%.
2018-08-12Rollup merge of #53230 - memoryruins:nll_bootstrap_4, r=nikomatsakisGuillaume Gomez-1/+1
[nll] enable feature(nll) on various crates for bootstrap: part 4 #53172 r? @nikomatsakis
2018-08-09[nll] librustc_data_structures: remove unused mut annotation in testmemoryruins-1/+1
2018-08-09A few cleanups for rustc_data_structuresljedrz-0/+1
2018-08-09Change transmute()s in IdxSet::{from_slice, from_slice_mut} to castsljedrz-6/+2
2018-07-02improve commentsNiko Matsakis-0/+6
2018-06-29Rename `IdxSet::clone_from`.Nicholas Nethercote-1/+3
The current situation is something of a mess. - `IdxSetBuf` derefs to `IdxSet`. - `IdxSetBuf` implements `Clone`, and therefore has a provided `clone_from` method, which does allocation and so is expensive. - `IdxSet` has a `clone_from` method that is non-allocating and therefore cheap, but this method is not from the `Clone` trait. As a result, if you have an `IdxSetBuf` called `b`, if you call `b.clone_from(b2)` you'll get the expensive `IdxSetBuf` method, but if you call `(*b).clone_from(b2)` you'll get the cheap `IdxSetBuf` method. `liveness_of_locals()` does the former, presumably unintentionally, and therefore does lots of unnecessary allocations. Having a `clone_from` method that isn't from the `Clone` trait is a bad idea in general, so this patch renames it as `overwrite`. This avoids the unnecessary allocations in `liveness_of_locals()`, speeding up most NLL benchmarks, the best by 1.5%. It also means that calls of the form `(*b).clone_from(b2)` can be rewritten as `b.overwrite(b2)`.
2018-04-02avoid IdxSets containing garbage above the universe lengthAriel Ben-Yehuda-1/+73
This makes sure that all bits in each IdxSet between the universe length and the end of the word are all zero instead of being in an indeterminate state. This fixes a crash with RUST_LOG=rustc_mir, and is probably a good idea anyway.
2018-03-06Remove IdxSet::elemsvarkor-26/+0
2018-03-06Remove IdxSet::each_bitvarkor-33/+0
2018-03-06Remove IdxSet::reset_to_emptyvarkor-5/+0
2017-12-13Implement Borrow/BorrowMut/ToOwned relationships betweed IdxSetBuf and IdxSet.Felix S. Klock II-0/+20
2017-12-09Use Try syntax for Option in place of macros or matchMatt Brubeck-4/+2
2017-11-28incr.comp.: Make a bunch of query results encodable.Michael Woerister-0/+21
2017-10-31introduce liveness constraints into NLL codeNiko Matsakis-2/+10
And do a bunch of gratuitious refactoring that I did not bother to separate into nice commits.
2017-09-13Analyse storage liveness and preserve it during generator transformationJohn Kåre Alsaker-1/+5
2017-08-16Merge remote-tracking branch 'origin/master' into genAlex Crichton-0/+64
2017-08-16MIR based borrow check (opt-in).Felix S. Klock II-0/+30
One can either use `-Z borrowck-mir` or add the `#[rustc_mir_borrowck]` attribute to opt into MIR based borrow checking. Note that regardless of whether one opts in or not, AST-based borrow check will still run as well. The errors emitted from AST-based borrow check will include a "(Ast)" suffix in their error message, while the errors emitted from MIR-based borrow check will include a "(Mir)" suffix. post-rebase: removed check for intra-statement mutual conflict; replaced with assertion checking that at most one borrow is generated per statement. post-rebase: removed dead code: `IdxSet::pairs` and supporting stuff.
2017-08-16Move `DataFlowState::{each_bit,interpret_set}` method definitions to parent ↵Felix S. Klock II-0/+34
module. Refactored `each_bit`, which traverses a `IdxSet`, so that the bulk of its implementation lives in `rustc_data_structures`.
2017-08-09Fix iterator over indexed setsAlex Crichton-3/+3
2017-08-09Initial pass review commentsAlex Crichton-0/+39
2017-07-28Generator literal supportJohn Kåre Alsaker-0/+8
2017-03-27Fix various useless derefs and slicingsOliver Schneider-4/+4
2016-10-10Move IdxSetBuf and BitSlice to rustc_data_structuresWesley Wiser-0/+156
Resolves a FIXME