Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
ee7a9a86
R
Rust
项目概览
int
/
Rust
12 个月 前同步成功
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
Rust
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
ee7a9a86
编写于
9月 04, 2022
作者:
C
Camille GILLOT
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Expand hash check.
上级
54713813
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
28 addition
and
21 deletion
+28
-21
compiler/rustc_query_system/src/dep_graph/graph.rs
compiler/rustc_query_system/src/dep_graph/graph.rs
+10
-7
compiler/rustc_query_system/src/query/plumbing.rs
compiler/rustc_query_system/src/query/plumbing.rs
+18
-14
未找到文件。
compiler/rustc_query_system/src/dep_graph/graph.rs
浏览文件 @
ee7a9a86
...
...
@@ -513,15 +513,18 @@ pub fn with_feed_task<Ctxt: DepContext<DepKind = K>, A: Debug, R: Debug>(
hash_result
:
fn
(
&
mut
StableHashingContext
<
'_
>
,
&
R
)
->
Fingerprint
,
)
->
DepNodeIndex
{
if
let
Some
(
data
)
=
self
.data
.as_ref
()
{
// The caller query has more dependencies than the node we are creating. We may
// encounter a case where this created node is marked as green, but the caller query is
// subsequently marked as red or recomputed. In this case, we will end up feeding a
// value to an existing node.
//
// For sanity, we still check that the loaded stable hash and the new one match.
if
let
Some
(
dep_node_index
)
=
self
.dep_node_index_of_opt
(
&
node
)
{
let
_
current_fingerprint
=
crate
::
query
::
incremental_verify_ich
(
cx
,
result
,
&
node
,
Some
(
hash_result
));
#[cfg(debug_assertions)]
{
let
hashing_timer
=
cx
.profiler
()
.incr_result_hashing
();
let
current_fingerprint
=
cx
.with_stable_hashing_context
(|
mut
hcx
|
hash_result
(
&
mut
hcx
,
result
));
hashing_timer
.finish_with_query_invocation_id
(
dep_node_index
.into
());
data
.current
.record_edge
(
dep_node_index
,
node
,
current_fingerprint
);
}
data
.current
.record_edge
(
dep_node_index
,
node
,
_
current_fingerprint
);
return
dep_node_index
;
}
...
...
compiler/rustc_query_system/src/query/plumbing.rs
浏览文件 @
ee7a9a86
...
...
@@ -3,6 +3,7 @@
//! manage the caches, and so forth.
use
crate
::
dep_graph
::{
DepContext
,
DepNode
,
DepNodeIndex
,
DepNodeParams
};
use
crate
::
ich
::
StableHashingContext
;
use
crate
::
query
::
caches
::
QueryCache
;
use
crate
::
query
::
config
::
QueryVTable
;
use
crate
::
query
::
job
::{
report_cycle
,
QueryInfo
,
QueryJob
,
QueryJobId
,
QueryJobInfo
};
...
...
@@ -525,7 +526,7 @@ fn try_load_from_disk_and_cache_in_memory<Qcx, K, V>(
if
std
::
intrinsics
::
unlikely
(
try_verify
||
qcx
.dep_context
()
.sess
()
.opts.unstable_opts.incremental_verify_ich
,
)
{
incremental_verify_ich
(
*
qcx
.dep_context
(),
&
result
,
dep_node
,
query
);
incremental_verify_ich
(
*
qcx
.dep_context
(),
&
result
,
dep_node
,
query
.hash_result
);
}
return
Some
((
result
,
dep_node_index
));
...
...
@@ -558,39 +559,42 @@ fn try_load_from_disk_and_cache_in_memory<Qcx, K, V>(
//
// See issue #82920 for an example of a miscompilation that would get turned into
// an ICE by this check
incremental_verify_ich
(
*
qcx
.dep_context
(),
&
result
,
dep_node
,
query
);
incremental_verify_ich
(
*
qcx
.dep_context
(),
&
result
,
dep_node
,
query
.hash_result
);
Some
((
result
,
dep_node_index
))
}
#[instrument(skip(
qcx,
result,
query
),
level
=
"debug"
)]
fn
incremental_verify_ich
<
Qcx
,
K
,
V
:
Debug
>
(
qcx
:
Qcx
::
DepContext
,
#[instrument(skip(
tcx,
result,
hash_result
),
level
=
"debug"
)]
pub
(
crate
)
fn
incremental_verify_ich
<
Tcx
,
V
:
Debug
>
(
tcx
:
Tcx
,
result
:
&
V
,
dep_node
:
&
DepNode
<
Qcx
::
DepKind
>
,
query
:
&
QueryVTable
<
Qcx
,
K
,
V
>
,
)
where
Qcx
:
QueryContext
,
dep_node
:
&
DepNode
<
Tcx
::
DepKind
>
,
hash_result
:
Option
<
fn
(
&
mut
StableHashingContext
<
'_
>
,
&
V
)
->
Fingerprint
>
,
)
->
Fingerprint
where
Tcx
:
DepContext
,
{
assert
!
(
q
cx
.dep_graph
()
.is_green
(
dep_node
),
t
cx
.dep_graph
()
.is_green
(
dep_node
),
"fingerprint for green query instance not loaded from cache: {:?}"
,
dep_node
,
);
let
new_hash
=
query
.
hash_result
.map_or
(
Fingerprint
::
ZERO
,
|
f
|
{
q
cx
.with_stable_hashing_context
(|
mut
hcx
|
f
(
&
mut
hcx
,
result
))
let
new_hash
=
hash_result
.map_or
(
Fingerprint
::
ZERO
,
|
f
|
{
t
cx
.with_stable_hashing_context
(|
mut
hcx
|
f
(
&
mut
hcx
,
result
))
});
let
old_hash
=
q
cx
.dep_graph
()
.prev_fingerprint_of
(
dep_node
);
let
old_hash
=
t
cx
.dep_graph
()
.prev_fingerprint_of
(
dep_node
);
if
Some
(
new_hash
)
!=
old_hash
{
incremental_verify_ich_failed
(
q
cx
.sess
(),
t
cx
.sess
(),
DebugArg
::
from
(
&
dep_node
),
DebugArg
::
from
(
&
result
),
);
}
new_hash
}
// This DebugArg business is largely a mirror of std::fmt::ArgumentV1, which is
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录