Do not depend on the stored value when trying to cache on disk.
This commit is contained in:
parent
e015ef5b26
commit
0a5666b838
6 changed files with 12 additions and 25 deletions
|
@ -27,7 +27,7 @@ pub(crate) struct QueryVtable<CTX: QueryContext, K, V> {
|
|||
pub compute: fn(CTX::DepContext, K) -> V,
|
||||
pub hash_result: Option<fn(&mut StableHashingContext<'_>, &V) -> Fingerprint>,
|
||||
pub handle_cycle_error: fn(CTX, DiagnosticBuilder<'_>) -> V,
|
||||
pub cache_on_disk: fn(CTX, &K, Option<&V>) -> bool,
|
||||
pub cache_on_disk: fn(CTX, &K) -> bool,
|
||||
pub try_load_from_disk: fn(CTX, SerializedDepNodeIndex) -> Option<V>,
|
||||
}
|
||||
|
||||
|
@ -43,8 +43,8 @@ impl<CTX: QueryContext, K, V> QueryVtable<CTX, K, V> {
|
|||
(self.compute)(tcx, key)
|
||||
}
|
||||
|
||||
pub(crate) fn cache_on_disk(&self, tcx: CTX, key: &K, value: Option<&V>) -> bool {
|
||||
(self.cache_on_disk)(tcx, key, value)
|
||||
pub(crate) fn cache_on_disk(&self, tcx: CTX, key: &K) -> bool {
|
||||
(self.cache_on_disk)(tcx, key)
|
||||
}
|
||||
|
||||
pub(crate) fn try_load_from_disk(&self, tcx: CTX, index: SerializedDepNodeIndex) -> Option<V> {
|
||||
|
@ -82,7 +82,7 @@ pub trait QueryDescription<CTX: QueryContext>: QueryAccessors<CTX> {
|
|||
fn describe(tcx: CTX, key: Self::Key) -> String;
|
||||
|
||||
#[inline]
|
||||
fn cache_on_disk(_: CTX, _: &Self::Key, _: Option<&Self::Value>) -> bool {
|
||||
fn cache_on_disk(_: CTX, _: &Self::Key) -> bool {
|
||||
false
|
||||
}
|
||||
|
||||
|
|
|
@ -512,7 +512,7 @@ where
|
|||
|
||||
// First we try to load the result from the on-disk cache.
|
||||
// Some things are never cached on disk.
|
||||
if query.cache_on_disk(tcx, key, None) {
|
||||
if query.cache_on_disk(tcx, key) {
|
||||
let prof_timer = tcx.dep_context().profiler().incr_cache_loading();
|
||||
let result = query.try_load_from_disk(tcx, prev_dep_node_index);
|
||||
prof_timer.finish_with_query_invocation_id(dep_node_index.into());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue