-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Avoid duplicating code for each query #69808
Merged
Merged
Changes from 1 commit
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
1b2deaf
Monomorphise force_query_with_job.
cjgillot 85704a4
Monomorphise load_from_disk_and_cache_in_memory.
cjgillot d56085c
Monomorphise try_execute_anon_query.
cjgillot 1c7376e
Monomorphise try_start.
cjgillot 8f3e96d
Monomorphise try_execute_query.
cjgillot e15383c
Move the DepNode construction to librustc_query_system.
cjgillot 49e024e
Monomorphise the interface.
cjgillot 282d72f
Inline a few things.
cjgillot e4976d0
Restrict access.
cjgillot 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 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 |
---|---|---|
|
@@ -80,6 +80,7 @@ enum QueryResult<CTX: QueryContext> { | |
} | ||
|
||
impl<CTX: QueryContext, C: QueryCache> QueryState<CTX, C> { | ||
#[inline(always)] | ||
pub fn iter_results<R>( | ||
&self, | ||
f: impl for<'a> FnOnce( | ||
|
@@ -89,6 +90,7 @@ impl<CTX: QueryContext, C: QueryCache> QueryState<CTX, C> { | |
self.cache.iter(&self.shards, |shard| &mut shard.cache, f) | ||
} | ||
|
||
#[inline(always)] | ||
pub fn all_inactive(&self) -> bool { | ||
let shards = self.shards.lock_shards(); | ||
shards.iter().all(|shard| shard.active.is_empty()) | ||
|
@@ -645,6 +647,7 @@ where | |
/// side-effects -- e.g., in order to report errors for erroneous programs. | ||
/// | ||
/// Note: The optimization is only available during incr. comp. | ||
#[inline(never)] | ||
fn ensure_query_impl<CTX, C>( | ||
tcx: CTX, | ||
state: &QueryState<CTX, C>, | ||
|
@@ -681,7 +684,8 @@ fn ensure_query_impl<CTX, C>( | |
} | ||
} | ||
|
||
fn force_query_impl<C, CTX>( | ||
#[inline(never)] | ||
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. (same as above, just wondering what prompted this use of |
||
fn force_query_impl<CTX, C>( | ||
tcx: CTX, | ||
state: &QueryState<CTX, C>, | ||
key: C::Key, | ||
|
@@ -715,6 +719,7 @@ fn force_query_impl<C, CTX>( | |
); | ||
} | ||
|
||
#[inline(always)] | ||
pub fn get_query<Q, CTX>(tcx: CTX, span: Span, key: Q::Key) -> Q::Stored | ||
where | ||
Q: QueryDescription<CTX>, | ||
|
@@ -726,6 +731,7 @@ where | |
get_query_impl(tcx, Q::query_state(tcx), span, key, &Q::VTABLE) | ||
} | ||
|
||
#[inline(always)] | ||
pub fn ensure_query<Q, CTX>(tcx: CTX, key: Q::Key) | ||
where | ||
Q: QueryDescription<CTX>, | ||
|
@@ -735,6 +741,7 @@ where | |
ensure_query_impl(tcx, Q::query_state(tcx), key, &Q::VTABLE) | ||
} | ||
|
||
#[inline(always)] | ||
pub fn force_query<Q, CTX>(tcx: CTX, key: Q::Key, span: Span, dep_node: DepNode<CTX::DepKind>) | ||
where | ||
Q: QueryDescription<CTX>, | ||
|
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.
why the
#[inline(never)]
marker here? Did you observe a need for it on some benchmark locally?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.
(no, your description says your rig is not suitable for local benchmarking, so that cannot be the answer...)
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.
I don't remember. I can remove it.