summary refs log tree commit diff
path: root/src/librustc_mir/dataflow/impls
AgeCommit message (Collapse)AuthorLines
2018-09-15Make rustc::middle::region::Scope's fields publicMarshall Bowers-1/+4
2018-09-15Auto merge of #54177 - nnethercote:streamline-bit-stuff, r=Mark-Simulacrumbors-2/+2
Remove bitslice.rs As the comment in `bitslice.rs` says: > FIXME: merge with `bitvec`
2018-09-13Remove bitslice.rs.Nicholas Nethercote-2/+2
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-09-10add the `AscribeUserType` statement kindNiko Matsakis-1/+1
Make it have the semantics of subtype.
2018-09-08Auto merge of #53909 - mikhail-m1:53643, r=nikomatsakisbors-2/+8
Skip a shared borrow of a immutable local variables issue #53643 r? @nikomatsakis
2018-09-08Rollup merge of #53942 - nnethercote:faster-precompute, r=nikomatsakiskennytm-41/+79
Rewrite `precompute_borrows_out_of_scope` for fewer hash table lookups. It now does one hash table lookup per basic block, instead of one per statement. This is worthwhile because this function is hot for NLL builds of `ucd`. I haven't measured the effect of this yet because I'm having trouble doing optimized builds of rustc that are suitable for profiling (#53916). I will do an online perf run instead. r? @nikomatsakis
2018-09-06Skip a shared borrow of a immutable local variablesMikhail Modin-2/+8
issue #53643
2018-09-05A few cleanups and minor improvements to mir/dataflowljedrz-3/+1
2018-09-04Rewrite `precompute_borrows_out_of_scope` for fewer hash table lookups.Nicholas Nethercote-41/+79
It now does one hash table lookup per basic block, instead of one per statement. This is worthwhile because this function is hot for NLL builds of `ucd`.
2018-08-30Make move out computation lazySantiago Pastorino-127/+2
2018-08-18Use the new Entry::or_default method where possible.Eduard-Mihai Burtescu-1/+1
2018-08-08optimize redundant borrowsNiko Matsakis-1/+1
2018-07-31Don't count MIR locals as borrowed after StorageDead when finding locals ↵John Kåre Alsaker-4/+12
live across a yield terminator
2018-07-24Auto merge of #52597 - oli-obk:promotion_simplify, r=nagisabors-0/+2
Promoteds are statics and statics have a place, not just a value r? @eddyb This makes everything around promoteds a little simpler
2018-07-23Let mir reference lifetime be inferredSantiago Pastorino-2/+2
2018-07-23Promoteds are statics and statics have a place, not just a valueOliver Schneider-0/+2
2018-07-17Auto merge of #52335 - nnethercote:BitSlice-fixes, r=nikomatsakisbors-10/+10
`BitSlice` fixes `propagate_bits_into_entry_set_for` and `BitSlice::bitwise` are hot for some benchmarks under NLL. I tried and failed to speed them up. (Increasing the size of `bit_slice::Word` from `usize` to `u128` caused a slowdown, even though decreasing the size of `bitvec::Word` from `u128` to `u64` also caused a slowdown. Weird.) Anyway, along the way I fixed up several problems in and around the `BitSlice` code. r? @nikomatsakis
2018-07-13compute region values using SCCs not iterative flowNiko Matsakis-1/+1
The strategy is this: - we compute SCCs once all outlives constraints are known - we allocate a set of values **per region** for storing liveness - we allocate a set of values **per SCC** for storing the final values - when we add a liveness constraint to the region R, we also add it to the final value of the SCC to which R belongs - then we can apply the constraints by just walking the DAG for the SCCs and union'ing the children (which have their liveness constraints within) There are a few intermediate refactorings that I really ought to have broken out into their own commits: - reverse the constraint graph so that `R1: R2` means `R1 -> R2` and not `R2 -> R1`. This fits better with the SCC computation and new style of inference (`->` now means "take value from" and not "push value into") - this does affect some of the UI tests, since they traverse the graph, but mostly the artificial ones and they don't necessarily seem worse - put some things (constraint set, etc) into `Rc`. This lets us root them to permit mutation and iteration. It also guarantees they don't change, which is critical to the correctness of the algorithm. - Generalize various helpers that previously operated only on points to work on any sort of region element.
2018-07-13Make BitSlice's `Word` properly generic.Nicholas Nethercote-10/+10
Currently `Word` is `usize`, and there are various places in the code that assume this. This patch mostly just changes `usize` occurrences to `Word`. Most of the changes were found as compile errors when I changed `Word` to a type other than `usize`, but there was one non-obvious case in librustc_mir/dataflow/mod.rs that caused bounds check failures before I fixed it.
2018-05-30Auto merge of #51106 - davidtwco:issue-50934, r=nikomatsakisbors-13/+77
Optimize the way that loans are killed in borrowck dataflow Fixes #50934. r? @nikomatsakis
2018-05-29rust-lang/rust#27282: Add `StatementKind::ReadForMatch` to MIR.Felix S. Klock II-0/+1
(This is just the data structure changes and some boilerplate match code that followed from it; the actual emission of these statements comes in a follow-up commit.)
2018-05-29fix off by one errorNiko Matsakis-1/+1
2018-05-29tweak debug output some moreNiko Matsakis-2/+7
2018-05-29Ensure that all statements in block are visited not just successors of a block.David Wood-8/+18
2018-05-29add some debugging statementsNiko Matsakis-0/+3
2018-05-29Refactored DFS to be much cleaner. Added continue after noting that borrow ↵David Wood-99/+27
is out of scope at location.
2018-05-27Ensure that depth first search does not get stuck in cycles.David Wood-12/+28
2018-05-27Ensure that we don't skip the last statement.David Wood-2/+2
2018-05-27Use precomputed DFS of borrows that out of scope at a location.David Wood-14/+116
2018-05-19Remove extra calls to kill_loans_out_of_scope_at_location - keep only ↵David Wood-5/+0
before_statement_effect and before_terminator_effect.
2018-05-03Instrument `statement_effect_on_borrows` for the `lhs = &place` case.Felix S. Klock II-0/+6
2018-04-15remove -Znll -- borrowck=mir implies nll nowNiko Matsakis-31/+20
2018-04-15stop using `borrows` for anything but iterating over live dataNiko Matsakis-26/+1
2018-04-15thread borrow-set around moreNiko Matsakis-3/+3
2018-04-15remove `ReserveOrActivateIndex`Niko Matsakis-59/+20
2018-04-15use the `activations_at_location` map to check activationsNiko Matsakis-0/+7
Not gen bits
2018-04-15construct the `BorrowSet` outside of `borrows`Niko Matsakis-8/+8
2018-04-15extract code to build borrow-set into `borrow_check::borrow_set`Niko Matsakis-404/+12
Also: - Extract common helper functions into a helper trait. - Kill a bit of dead code.
2018-04-15relocate `BorrowData` etc into `borrow_check::borrow_set`Niko Matsakis-76/+25
2018-04-15gather activation locations for 2-phase borrows in 1 passNiko Matsakis-98/+139
2018-04-15remove `assigned_map` (appears to be dead code)Niko Matsakis-9/+0
2018-04-07Auto merge of #49678 - bobtwinkles:fix_multiple_activations, r=nikomatsakisbors-14/+8
two-phase borrows: support multiple activations in one statement The need for this has arisen since the introduction of two-phase borrows on method autorefs in #49348. r'ing @pnkfelix to keep things off Niko's plate so he can make this redundant, and @pnkfelix is familiar with the code. Fixes #49635 Fixes #49662 r? @pnkfelix
2018-04-04two-phase borrows: support multiple activations in one statementbobtwinkles-14/+8
The need for this has arisen since the introduction of two-phase borrows on method autorefs. Fixes 49635 Fixes 49662
2018-04-02avoid IdxSets containing garbage above the universe lengthAriel Ben-Yehuda-2/+2
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-22Added UserAssertTy statement.David Wood-0/+1
2018-03-09Remove some commented out codebobtwinkles-12/+0
Left over from prior experimentation, no longer required.
2018-03-09Check for two_phase_borrows in the right placebobtwinkles-1/+1
Fix a small compilation issue after I missed a critical change after rebasing yesterday (ref c933440)
2018-03-09Fix tests after two-phase borrow rewritebobtwinkles-17/+10
2018-03-09Remove unused field on BorrowDatabobtwinkles-3/+1
2018-03-09Complete re-implementation of 2-phase borrowsbobtwinkles-32/+32
See #48431 for discussion as to why this was necessary and what we hoped to accomplish. A brief summary: - the first implementation of 2-phase borrows was hard to limit in the way we wanted. That is, it was too good at accepting all 2-phase borrows rather than just autorefs =) - Numerous diagnostic regressions were introduced by 2-phase borrow support which were difficult to fix