Skip to content

Fix the invalidation of the MIR early exit cache - #35751

Merged
bors merged 2 commits into
rust-lang:masterfrom
nagisa:mir-scope-fix-again
Aug 18, 2016
Merged

Fix the invalidation of the MIR early exit cache#35751
bors merged 2 commits into
rust-lang:masterfrom
nagisa:mir-scope-fix-again

Conversation

@nagisa

@nagisanagisa commented Aug 17, 2016

Copy link
Copy Markdown
Member

The #34307 introduced a cache for early exits in order to help with O(n*m) explosion of cleanup blocks but the cache is invalidated incorrectly and I can’t seem to figure out why (caching is hard!)

Remove the cache for now to fix the immediate correctness issue and worry about the performance later.

Cache invalidation got fixed.

Fixes#35737

r? @nikomatsakis

@eddyb

Copy link
Copy Markdown
Contributor

I'm not seeing any invalidation at all for cached_exits, seems that it's just missing?

@nagisa

Copy link
Copy Markdown
MemberAuthor

@eddyb it was here

@eddyb

Copy link
Copy Markdown
Contributor

@nagisa Oops, I see. I would've expected .clear() instead of throwing it away.

@arielb1

Copy link
Copy Markdown
Contributor

@bors r+

@bors

bors commented Aug 17, 2016

Copy link
Copy Markdown
Collaborator

📌 Commit e1749af has been approved by arielb1

@arielb1

Copy link
Copy Markdown
Contributor

I would prefer to keep the cache through.

@nagisa
nagisaforce-pushed the mir-scope-fix-again branch 2 times, most recently from 85c4e5d to 44955c7CompareAugust 17, 2016 16:05
@nagisa

Copy link
Copy Markdown
MemberAuthor

Cache invalidation fixed.

@eddybeddyb changed the title Remove the early exit cacheFix the invalidation of the MIR early exit cacheAug 17, 2016
Comment threadsrc/librustc_mir/build/scope.rs Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will invalidate the unwind cache in cases other than DropKind::Value, which is undesirable (as StorageDead doesn't end up on the unwind path at all).

@eddybeddyb added the beta-nominated Nominated for backporting to the compiler in the beta channel. label Aug 17, 2016
@nagisa
nagisaforce-pushed the mir-scope-fix-again branch 3 times, most recently from 112a3e1 to 9983aefCompareAugust 17, 2016 16:21
Comment threadsrc/librustc_mir/build/scope.rs Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to be &&, not ||.

@nagisa
nagisaforce-pushed the mir-scope-fix-again branch from 9983aef to 2d36642CompareAugust 17, 2016 18:09
@eddyb

Copy link
Copy Markdown
Contributor

@bors r+

@bors

bors commented Aug 17, 2016

Copy link
Copy Markdown
Collaborator

📌 Commit 2d36642 has been approved by eddyb

Comment threadsrc/librustc_mir/build/scope.rs Outdated
if scope.extent == extent {
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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a hard time following this comment, I'm afraid. Ideal would be a diagram, but maybe we can just tweak the wording...I don't quite know how since I don't understand it yet :)

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’ll try to draw something up.

@nagisa
nagisaforce-pushed the mir-scope-fix-again branch from e08d0cd to 2c3250aCompareAugust 17, 2016 21:42
@eddyb

Copy link
Copy Markdown
Contributor

@bors r+

@bors

bors commented Aug 17, 2016

Copy link
Copy Markdown
Collaborator

📌 Commit 2c3250a has been approved by eddyb

@eddybeddyb mentioned this pull request Aug 17, 2016
eddyb added a commit to eddyb/rust that referenced this pull request Aug 18, 2016
Fix the invalidation of the MIR early exit cache
~~The rust-lang#34307 introduced a cache for early exits in order to help with O(n*m) explosion of cleanup blocks but the cache is invalidated incorrectly and I can’t seem to figure out why (caching is hard!)~~
~~Remove the cache for now to fix the immediate correctness issue and worry about the performance later.~~
Cache invalidation got fixed.
Fixesrust-lang#35737
r? @nikomatsakis
bors added a commit that referenced this pull request Aug 18, 2016
Rollup of 12 pull requests
- Successful merges: #35346, #35734, #35739, #35740, #35742, #35744, #35749, #35750, #35751, #35756, #35766, #35768
- Failed merges:
@bors
bors merged commit 2c3250a into rust-lang:masterAug 18, 2016
@nikomatsakisnikomatsakis added the beta-accepted Accepted for backporting to the compiler in the beta channel. label Aug 18, 2016
@nikomatsakis

Copy link
Copy Markdown
Contributor

Accepting for beta: this was a serious correctness regression.

@alexcrichtonalexcrichton mentioned this pull request Aug 23, 2016
@brsonbrson removed the beta-nominated Nominated for backporting to the compiler in the beta channel. label Aug 24, 2016
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

beta-acceptedAccepted for backporting to the compiler in the beta channel.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

drop not always behaving since nightly-2016-08-03-x86_64-unknown-linux-gnu

6 participants

@nagisa@eddyb@arielb1@bors@nikomatsakis@brson