Skip to content
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

incr.comp.: Make sure we don't lose unused green results from the query cache. #46111

Merged
merged 1 commit into from Nov 25, 2017

Conversation

Projects
None yet
4 participants
@michaelwoerister
Copy link
Contributor

michaelwoerister commented Nov 20, 2017

In its current implementation, the query result cache works by bulk-writing the results of all cacheable queries into a monolithic binary file on disk. Prior to this PR, we would potentially lose query results during this process because only results that had already been loaded into memory were serialized. In contrast, results that were not needed during the given compilation session were not serialized again.

This PR will do one pass over all green DepNodes that represent a cacheable query and execute the corresponding query in order to make sure that the query result gets loaded into memory before cache serialization.

In the future we might want to look into a serialization format the can be updated in-place so that we don't have to load unchanged results just for immediately storing them again.

r? @nikomatsakis

@nikomatsakis
Copy link
Contributor

nikomatsakis left a comment

r=me presuming my understanding is correct

// above `cache_on_disk` methods returns true.
// Also, as a sanity check, it expects that the corresponding query
// invocation has been marked as green already.
pub fn load_from_on_disk_cache(&self, tcx: TyCtxt) {

This comment has been minimized.

@nikomatsakis

nikomatsakis Nov 20, 2017

Contributor

I must be confused, but in what sense does this load from the on-disk cache? It appears to re-execute the query.

This comment has been minimized.

@nikomatsakis

nikomatsakis Nov 20, 2017

Contributor

Oh, I guess the point is that it will re-execute the query, which will force us to load. The reason this wrapper exists, then, is to do the assertions? Wouldn't there otherwise be some existing method we could use?

This comment has been minimized.

@michaelwoerister

michaelwoerister Nov 20, 2017

Author Contributor

Oh, I guess the point is that it will re-execute the query, which will force us to load.

Yes

The reason this wrapper exists, then, is to do the assertions?

No, it maps from DepNode to query. There's also force_from_dep_node, which also maps from DepNode to query, but it assumes that the thing being forced has not been seen yet.

This comment has been minimized.

@nikomatsakis

nikomatsakis Nov 20, 2017

Contributor

OK, that sounds roughly like what I meant.

@nikomatsakis

This comment has been minimized.

Copy link
Contributor

nikomatsakis commented Nov 20, 2017

@bors r+

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Nov 20, 2017

📌 Commit 0ea4b47 has been approved by nikomatsakis

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Nov 24, 2017

⌛️ Testing commit 0ea4b47 with merge a550f2d...

bors added a commit that referenced this pull request Nov 24, 2017

Auto merge of #46111 - michaelwoerister:promote-green, r=nikomatsakis
incr.comp.: Make sure we don't lose unused green results from the query cache.

In its current implementation, the query result cache works by bulk-writing the results of all cacheable queries into a monolithic binary file on disk. Prior to this PR, we would potentially lose query results during this process because only results that had already been loaded into memory were serialized. In contrast, results that were not needed during the given compilation session were not serialized again.

This PR will do one pass over all green `DepNodes` that represent a cacheable query and execute the corresponding query in order to make sure that the query result gets loaded into memory before cache serialization.

In the future we might want to look into a serialization format the can be updated in-place so that we don't have to load unchanged results just for immediately storing them again.

r? @nikomatsakis
@bors

This comment has been minimized.

Copy link
Contributor

bors commented Nov 25, 2017

☀️ Test successful - status-appveyor, status-travis
Approved by: nikomatsakis
Pushing a550f2d to master...

@bors bors merged commit 0ea4b47 into rust-lang:master Nov 25, 2017

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
homu Test successful
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.