summary refs log tree commit diff
path: root/src/librustc_mir/dataflow/impls
AgeCommit message (Collapse)AuthorLines
2019-02-10rustc: doc commentsAlexander Regueiro-7/+0
2019-02-08librustc_mir => 2018Taiki Endo-31/+31
2019-01-30Pass correct arguments to places_conflictMatthew Jasper-1/+1
The borrow place *must* be a place that we track borrows for, otherwise we will likely ICE.
2018-12-28Remove unnecessary borrow generationMatthew Jasper-14/+0
2018-12-25Remove licensesMark Rousskov-40/+0
2018-12-20Auto merge of #56741 - RalfJung:retag-to-raw, r=oli-obkbors-1/+0
treat ref-to-raw cast like a reborrow: do a special kind of retag r? @oli-obk Cc @nikomatsakis
2018-12-20Auto merge of #56649 - davidtwco:issue-46589, r=pnkfelixbors-74/+106
MIR borrowck doesn't accept the example of iterating and updating a mutable reference Fixes #46589. r? @pnkfelix or @nikomatsakis
2018-12-18treat ref-to-raw cast like a reborrow: do a special kind of retagRalf Jung-1/+0
2018-12-17Add required lifetime parameter to BitDenotation.David Wood-64/+65
This avoids all sorts of confusing issues with using both `dest_place` and `self` in the `propagate_call_return` function in the `BitDenotation` implementation for `Borrows`.
2018-12-17Kill borrows from a projection after assignment.David Wood-23/+54
This commit extends previous work to kill borrows from a local after assignment into that local to kill borrows from a projection after assignment into a prefix of that place.
2018-12-07Various minor/cosmetic improvements to codeAlexander Regueiro-2/+2
2018-11-30Remove the `region_map` field from `BorrowSet`Matthew Jasper-8/+1
2018-11-18Only handle ReVar regions in NLL borrowckMatthew Jasper-82/+9
Now that lexical MIR borrowck is gone, there's no need to store Regions unnecessarily.
2018-11-18Remove mir::StatementKind::EndRegionMatthew Jasper-5/+1
Since lexical MIR borrow check is gone, and validation no longer uses these, they can be removed.
2018-11-15Auto merge of #55716 - RalfJung:escape-to-raw, r=oli-obkbors-0/+1
Add escape-to-raw MIR statement Add a new MIR "ghost state statement": Escaping a ptr to permit raw accesses. ~~This includes #55549, [click here](https://github.com/RalfJung/rust/compare/miri-visitor...RalfJung:escape-to-raw) for just the new commits.~~
2018-11-07no more action on ref or cast, but add new MIR statement for escaping a ptr ↵Ralf Jung-0/+1
to raw
2018-11-07Rollup merge of #55734 - teresy:shorthand-fields, r=davidtwcokennytm-2/+2
refactor: use shorthand fields refactor: use shorthand for single fields everywhere (excluding tests).
2018-11-06refactor: use shorthand fieldsteresy-2/+2
2018-10-29Emit Retag statements, kill Validate statementsRalf Jung-1/+1
Also "rename" -Zmir-emit-validate to -Zmir-emit-retag, which is just a boolean (yes or no).
2018-10-22Replace the `run_passes!` macro with a regular functionWesley Wiser-1/+0
As suggested in the feedback for #55244. When I replaced the macro with a function, rustc started complaining that there were two unused functions so I also removed those.
2018-10-19Deprecate the `FxHashMap()` and `FxHashSet()` constructor function hackOliver Scherer-2/+2
2018-09-24Shrink StatementKind::Assign.Nicholas Nethercote-1/+1
This shrinks StatementKind from 80 bytes to 64 bytes on 64-bit.
2018-09-22Auto merge of #54188 - lqd:fallout-53695, r=nikomatsakisbors-1/+1
NLL: disallow creation of immediately unusable variables Fix #53695 Original description follows ---- This WIP PR is for discussing the impact of fixing #53695 by injecting a fake read in let patterns. (Travis will fail, at least the `mir-opt` suite is failing in its current state)
2018-09-20Improve handling of type bounds in `bit_set.rs`.Nicholas Nethercote-1/+2
Currently, `BitSet` doesn't actually know its own domain size; it just knows how many words it contains. To improve things, this commit makes the following changes. - It changes `BitSet` and `SparseBitSet` to store their own domain size, and do more precise bounds and same-size checks with it. It also changes the signature of `BitSet::to_string()` (and puts it within `impl ToString`) now that the domain size need not be passed in from outside. - It uses `derive(RustcDecodable, RustcEncodable)` for `BitSet`. This required adding code to handle `PhantomData` in `libserialize`. - As a result, it removes the domain size from `HybridBitSet`, making a lot of that code nicer. - Both set_up_to() and clear_above() were overly general, working with arbitrary sizes when they are only needed for the domain size. The commit removes the former, degeneralizes the latter, and removes the (overly general) tests. - Changes `GrowableBitSet::grow()` to `ensure()`, fixing a bug where a (1-based) domain size was confused with a (0-based) element index. - Changes `BitMatrix` to store its row count, and do more precise bounds checks with it. - Changes `ty_params` in `select.rs` from a `BitSet` to a `GrowableBitSet` because it repeatedly failed the new, more precise bounds checks. (Changing the type was simpler than computing an accurate domain size.) - Various other minor improvements.
2018-09-18Refactor 'ReadForMatch' into 'FakeRead' and add the cause of the fake readRemy Rakic-1/+1
2018-09-18Auto merge of #54286 - nnethercote:BitSet, r=pnkfelixbors-62/+60
Merge `bitvec.rs` and `indexed_set.rs` Because it's not good to have two separate implementations. Also, I will combine the best parts of each to improve NLL memory usage on some benchmarks significantly.
2018-09-18Eliminate `BitwiseOperator`.Nicholas Nethercote-24/+24
`BitwiseOperator` is an unnecessarily low-level thing. This commit replaces it with `BitSetOperator`, which works on `BitSet`s instead of words. Within `bit_set.rs`, the commit eliminates `Intersect`, `Union`, and `Subtract` by instead passing a function to `bitwise()`.
2018-09-18Merge indexed_set.rs into bitvec.rs, and rename it bit_set.rs.Nicholas Nethercote-40/+38
Currently we have two files implementing bitsets (and 2D bit matrices). This commit combines them into one, taking the best features from each. This involves renaming a lot of things. The high level changes are as follows. - bitvec.rs --> bit_set.rs - indexed_set.rs --> (removed) - BitArray + IdxSet --> BitSet (merged, see below) - BitVector --> GrowableBitSet - {,Sparse,Hybrid}IdxSet --> {,Sparse,Hybrid}BitSet - BitMatrix --> BitMatrix - SparseBitMatrix --> SparseBitMatrix The changes within the bitset types themselves are as follows. ``` OLD OLD NEW BitArray<C> IdxSet<T> BitSet<T> -------- ------ ------ grow - grow new - (remove) new_empty new_empty new_empty new_filled new_filled new_filled - to_hybrid to_hybrid clear clear clear set_up_to set_up_to set_up_to clear_above - clear_above count - count contains(T) contains(&T) contains(T) contains_all - superset is_empty - is_empty insert(T) add(&T) insert(T) insert_all - insert_all() remove(T) remove(&T) remove(T) words words words words_mut words_mut words_mut - overwrite overwrite merge union union - subtract subtract - intersect intersect iter iter iter ``` In general, when choosing names I went with: - names that are more obvious (e.g. `BitSet` over `IdxSet`). - names that are more like the Rust libraries (e.g. `T` over `C`, `insert` over `add`); - names that are more set-like (e.g. `union` over `merge`, `superset` over `contains_all`, `domain_size` over `num_bits`). Also, using `T` for index arguments seems more sensible than `&T` -- even though the latter is standard in Rust collection types -- because indices are always copyable. It also results in fewer `&` and `*` sigils in practice.
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