8000 Rollup of 12 pull requests by eddyb · Pull Request #35769 · rust-lang/rust · GitHub
[go: up one dir, main page]

Skip to content
8000

Rollup of 12 pull requests #35769

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 32 commits into from
Aug 18, 2016
Merged
Changes from 1 commit
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
127489a
Update compiler error 0093 to use new error format
stanislav-tkach Aug 9, 2016
1cf9caf
add mips-uclibc targets
Aug 16, 2016
f0ff2d3
E0403 update error format
circuitfox Aug 17, 2016
34f856e
Update LLVM to include 4 backported commits by @majnemer.
eddyb Aug 17, 2016
4254b31
Update minimum CMake version in README
spladug Aug 17, 2016
7675e4b
Update E0009 to new format
Aug 17, 2016
12a159a
Add 'make help' for rustbuild
SimonSapin Aug 17, 2016
feeed0b
Fixes issue #11004
GuillaumeGomez Aug 17, 2016
d01bfb1
Remove trailing white space
Aug 17, 2016
6a1efbd
Merge branch 'master' into E0403-update-error-format
circuitfox Aug 17, 2016
2179def
New output for E0407
tvladyslav Aug 16, 2016
2d36642
Properly invalidate the early exit cache
nagisa Aug 17, 2016
2c3250a
Nice graphs
nagisa Aug 17, 2016
8d78237
Add new error code tests
GuillaumeGomez Aug 17, 2016
de5aaee
Updated test for E0221
tvladyslav Aug 17, 2016
3c4ecc9
Display secondary span for E0053 for Sort TypeErrors
KiChjang Aug 10, 2016
34bc3c9
Display secondary span for E0053 for Mutability TypeErrors
KiChjang Aug 17, 2016
31d56cb
Add UI test for E0053
KiChjang Aug 17, 2016
ed54226
Fix tidy check.
tvladyslav Aug 17, 2016
612506b
Rollup merge of #35346 - DarkEld3r:e0093-formatting, r=jonathandturner
eddyb Aug 18, 2016
5e9a5b3
Rollup merge of #35734 - japaric:mips-uclibc, r=alexcrichton
eddyb Aug 18, 201 8000 6
71759ec
Rollup merge of #35739 - circuitfox:E0403-update-error-format, r=jona…
eddyb Aug 18, 2016
99e5efd
Rollup merge of #35740 - eddyb:llvm-prl-fix, r=alexcrichton
eddyb Aug 18, 2016
7a27444
Rollup merge of #35742 - spladug:readme-cmake-version, r=nikomatsakis
eddyb Aug 18, 2016
394c449
Rollup merge of #35744 - DevShep:ds/update_E0009, r=jonathandturner
eddyb Aug 18, 2016
f1861b8
Rollup merge of #35749 - GuillaumeGomez:raw_field, r=jonathandturner
eddyb Aug 18, 2016
1e13de8
Rollup merge of #35750 - SimonSapin:help, r=alexcrichton
eddyb Aug 18, 2016
64c1aef
Rollup merge of #35751 - nagisa:mir-scope-fix-again, r=eddyb
eddyb Aug 18, 2016
c3601d4
Rollup merge of #35756 - crypto-universe:E0407, r=GuillaumeGomez
eddyb Aug 18, 2016
8ccc11b
Rollup merge of #35765 - KiChjang:e0053-bonus, r=jonathandturner
eddyb Aug 18, 2016
d36b296
Rollup merge of #35768 - GuillaumeGomez:err_codes, r=jonathandturner
eddyb Aug 18, 2016
d69cd72
Rollup merge of #35770 - crypto-universe:E0221, r=jonathandturner
eddyb Aug 18, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Nice graphs
  • Loading branch information
nagisa committed Aug 17, 2016
commit 2c3250adfa4676467f9ab31201a26187a66cbe0b
60 changes: 48 additions & 12 deletions src/librustc_mir/build/scope.rs
Original file line number Diff line number Diff line change
Expand Up @@ -459,16 +459,52 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {

for scope in self.scopes.iter_mut().rev() {
let this_scope = scope.extent == extent;
// We must invalidate all the caches leading up to the scope we’re looking for, because
// the cached blocks will branch into build of scope not containing the new drop. If we
// add stuff to the currently inspected scope, then in some cases the non-unwind caches
// may become invalid, therefore we should invalidate these as well. The unwind caches
// will stay correct, because the already generated unwind blocks cannot be influenced
// by just added drop.
// When building drops, we try to cache chains of drops in such a way so these drops
// could be reused by the drops which would branch into the cached (already built)
// blocks. This, however, means that whenever we add a drop into a scope which already
// had some blocks built (and thus, cached) for it, we must invalidate all caches which
// might branch into the scope which had a drop just added to it. This is necessary,
// because otherwise some other code might use the cache to branch into already built
// chain of drops, essentially ignoring the newly added drop.
//
// If we’re scheduling cleanup for non-droppable type (i.e. DropKind::Storage), then we
// do not need to invalidate unwind branch, because DropKind::Storage does not end up
// built in the unwind branch currently.
// For example consider there’s two scopes with a drop in each. These are built and
// thus the caches are filled:
//
// +--------------------------------------------------------+
// | +---------------------------------+ |
// | | +--------+ +-------------+ | +---------------+ |
// | | | return | <-+ | drop(outer) | <-+ | drop(middle) | |
// | | +--------+ +-------------+ | +---------------+ |
// | +------------|outer_scope cache|--+ |
// +------------------------------|middle_scope cache|------+
//
// Now, a new, inner-most scope is added along with a new drop into both inner-most and
// outer-most scopes:
//
// +------------------------------------------------------------+
// | +----------------------------------+ |
// | | +--------+ +-------------+ | +---------------+ | +-------------+
// | | | return | <+ | drop(new) | <-+ | drop(middle) | <--+| drop(inner) |
// | | +--------+ | | drop(outer) | | +---------------+ | +-------------+
// | | +-+ +-------------+ | |
// | +---|invalid outer_scope cache|----+ |
// +----=----------------|invalid middle_scope cache|-----------+
//
// If, when adding `drop(new)` we do not invalidate the cached blocks for both
// outer_scope and middle_scope, then, when building drops for the inner (right-most)
// scope, the old, cached blocks, without `drop(new)` will get used, producing the
// wrong results.
//
// The cache and its invalidation for unwind branch is somewhat special. The cache is
// per-drop, rather than per scope, which has a several different implications. Adding
// a new drop into a scope will not invalidate cached blocks of the prior drops in the
// scope. That is true, because none of the already existing drops will have an edge
// into a block with the newly added drop.
//
// Note that this code iterates scopes from the inner-most to the outer-most,
// invalidating caches of each scope visited. This way bare minimum of the
// caches gets invalidated. i.e. if a new drop is added into the middle scope, the
// cache of outer scpoe stays intact.
let invalidate_unwind = needs_drop && !this_scope;
scope.invalidate_cache(invalidate_unwind);
if this_scope {
Expand Down Expand Up @@ -497,9 +533,9 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
value: &Lvalue<'tcx>,
item_ty: Ty<'tcx>) {
for scope in self.scopes.iter_mut().rev() {
// We must invalidate all the caches leading up to and including the scope we’re
// looking for, because otherwise some of the blocks in the chain will become
// incorrect and must be rebuilt.
// See the comment in schedule_drop above. The primary difference is that we invalidate
// the unwind blocks unconditionally. That’s because the box free may be considered
// outer-most cleanup within the scope.
scope.invalidate_cache(true);
if scope.extent == extent {
assert!(scope.free.is_none(), "scope already has a scheduled free!");
Expand Down
0