-
Notifications
You must be signed in to change notification settings - Fork 13.4k
incr.comp.: Implement query result cache and use it to cache type checking tables. #46004
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
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
8cbc022
incr.comp.: Include header when loading cache files in order to get t…
michaelwoerister c08e03a
incr.comp.: Add position() method to TyEncoder.
michaelwoerister bc96d9d
incr.comp.: Implement UseSpecializedXXcodable for DefIndex and DefId.
michaelwoerister 9ac1026
incr.comp.: Properly use ty::codec::decode_cnum() in rustc_metadata::…
michaelwoerister 3bd333c
incr.comp.: Add CacheEncoder for encoding query results into the incr…
michaelwoerister 15db165
incr.comp.: Implement TyDecoder for on_disk_cache::CacheDecoder.
michaelwoerister bedb44c
incr.comp.: Allow for mapping from prev-session-CrateNums to current-…
michaelwoerister de0317e
incr.comp.: Encode DefPathTables for reconstructing DefIds.
michaelwoerister 2087d5e
incr.comp.: Do some verification on data decoded from incr. comp. cache.
michaelwoerister 4bfab89
incr.comp.: Store the query result index which records where query re…
michaelwoerister 0b14383
incr.comp.: Add 'tcx to QueryDescription.
michaelwoerister 2c1aedd
incr.comp.: Cache TypeckTables and add -Zincremental-queries flag.
michaelwoerister 279b6df
incr.comp.: Refactor query cache serialization to be more re-usable.
michaelwoerister 13582c6
incr.comp.: Add missing [input] annotation for DepNode::MaybeUnusedEx…
michaelwoerister 2f50e62
incr.comp.: Only save and load query result cache when -Zincremental-…
michaelwoerister 24e54dd
Introduce LocalDefId which provides a type-level guarantee that the D…
michaelwoerister 2f44ef2
incr.comp.: Encode DefIds as DefPathHashes instead of recomputing tho…
michaelwoerister 723028f
incr.comp.: Remove some code duplication around TyDecoder by factorin…
michaelwoerister cb1ff24
incr.comp.: Remove default serialization implementations for things i…
michaelwoerister 4c4f7a3
Fix some tidy errors in ty::codec.
michaelwoerister 0a1f6dd
Add doc comment for LocalDefId.
michaelwoerister File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -92,6 +92,7 @@ impl serialize::UseSpecializedDecodable for CrateNum { | |
/// don't have to care about these ranges. | ||
newtype_index!(DefIndex | ||
{ | ||
ENCODABLE = custom | ||
DEBUG_FORMAT = custom, | ||
|
||
/// The start of the "high" range of DefIndexes. | ||
|
@@ -208,13 +209,20 @@ impl fmt::Debug for DefId { | |
|
||
impl DefId { | ||
/// Make a local `DefId` with the given index. | ||
#[inline] | ||
pub fn local(index: DefIndex) -> DefId { | ||
DefId { krate: LOCAL_CRATE, index: index } | ||
} | ||
|
||
pub fn is_local(&self) -> bool { | ||
#[inline] | ||
pub fn is_local(self) -> bool { | ||
self.krate == LOCAL_CRATE | ||
} | ||
|
||
#[inline] | ||
pub fn to_local(self) -> LocalDefId { | ||
LocalDefId::from_def_id(self) | ||
} | ||
} | ||
|
||
impl serialize::UseSpecializedEncodable for DefId { | ||
|
@@ -242,3 +250,33 @@ impl serialize::UseSpecializedDecodable for DefId { | |
}) | ||
} | ||
} | ||
|
||
|
||
#[derive(Clone, Copy, Eq, PartialEq, Ord, PartialOrd, Hash)] | ||
pub struct LocalDefId(DefIndex); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've wanted to add this type for so long. But can you please add a doc-comment explaining its role and why to use it, and also why it is bad to just use a raw |
||
|
||
impl LocalDefId { | ||
|
||
#[inline] | ||
pub fn from_def_id(def_id: DefId) -> LocalDefId { | ||
assert!(def_id.is_local()); | ||
LocalDefId(def_id.index) | ||
} | ||
|
||
#[inline] | ||
pub fn to_def_id(self) -> DefId { | ||
DefId { | ||
krate: LOCAL_CRATE, | ||
index: self.0 | ||
} | ||
} | ||
} | ||
|
||
impl fmt::Debug for LocalDefId { | ||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { | ||
self.to_def_id().fmt(f) | ||
} | ||
} | ||
|
||
impl serialize::UseSpecializedEncodable for LocalDefId {} | ||
impl serialize::UseSpecializedDecodable for LocalDefId {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: extra space.