Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
f0bbf4e1
R
Rust
项目概览
int
/
Rust
接近 1 年 前同步成功
通知
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,发现更多精彩内容 >>
提交
f0bbf4e1
编写于
9月 26, 2017
作者:
M
Michael Woerister
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
incr.comp.: Re-execute queries during red/green marking in order to find out their color.
上级
6db27d9f
变更
6
展开全部
隐藏空白更改
内联
并排
Showing
6 changed file
with
397 addition
and
92 deletion
+397
-92
src/librustc/dep_graph/dep_node.rs
src/librustc/dep_graph/dep_node.rs
+3
-14
src/librustc/dep_graph/graph.rs
src/librustc/dep_graph/graph.rs
+29
-5
src/librustc/ty/maps/mod.rs
src/librustc/ty/maps/mod.rs
+1
-0
src/librustc/ty/maps/plumbing.rs
src/librustc/ty/maps/plumbing.rs
+344
-65
src/librustc_mir/transform/mod.rs
src/librustc_mir/transform/mod.rs
+7
-8
src/librustc_trans/base.rs
src/librustc_trans/base.rs
+13
-0
未找到文件。
src/librustc/dep_graph/dep_node.rs
浏览文件 @
f0bbf4e1
...
@@ -66,7 +66,6 @@
...
@@ -66,7 +66,6 @@
use
ich
::
Fingerprint
;
use
ich
::
Fingerprint
;
use
ty
::{
TyCtxt
,
Instance
,
InstanceDef
};
use
ty
::{
TyCtxt
,
Instance
,
InstanceDef
};
use
ty
::
fast_reject
::
SimplifiedType
;
use
rustc_data_structures
::
stable_hasher
::{
StableHasher
,
HashStable
};
use
rustc_data_structures
::
stable_hasher
::{
StableHasher
,
HashStable
};
use
ich
::
StableHashingContext
;
use
ich
::
StableHashingContext
;
use
std
::
fmt
;
use
std
::
fmt
;
...
@@ -430,7 +429,6 @@ pub fn fingerprint_needed_for_crate_hash(self) -> bool {
...
@@ -430,7 +429,6 @@ pub fn fingerprint_needed_for_crate_hash(self) -> bool {
[]
RegionScopeTree
(
DefId
),
[]
RegionScopeTree
(
DefId
),
[]
Coherence
,
[]
Coherence
,
[]
CoherenceInherentImplOverlapCheck
,
[]
CoherenceInherentImplOverlapCheck
,
[]
Resolve
,
[]
CoherenceCheckTrait
(
DefId
),
[]
CoherenceCheckTrait
(
DefId
),
[]
PrivacyAccessLevels
(
CrateNum
),
[]
PrivacyAccessLevels
(
CrateNum
),
...
@@ -447,10 +445,8 @@ pub fn fingerprint_needed_for_crate_hash(self) -> bool {
...
@@ -447,10 +445,8 @@ pub fn fingerprint_needed_for_crate_hash(self) -> bool {
[]
MirBorrowCheck
(
DefId
),
[]
MirBorrowCheck
(
DefId
),
[]
UnsafetyViolations
(
DefId
),
[]
UnsafetyViolations
(
DefId
),
[]
RvalueCheck
(
DefId
),
[]
Reachability
,
[]
Reachability
,
[]
MirKeys
,
[]
MirKeys
,
[]
TransWriteMetadata
,
[]
CrateVariances
,
[]
CrateVariances
,
// Nodes representing bits of computed IR in the tcx. Each shared
// Nodes representing bits of computed IR in the tcx. Each shared
...
@@ -498,18 +494,9 @@ pub fn fingerprint_needed_for_crate_hash(self) -> bool {
...
@@ -498,18 +494,9 @@ pub fn fingerprint_needed_for_crate_hash(self) -> bool {
// The set of impls for a given trait.
// The set of impls for a given trait.
[]
TraitImpls
(
DefId
),
[]
TraitImpls
(
DefId
),
[]
RelevantTraitImpls
(
DefId
,
SimplifiedType
),
[]
AllLocalTraitImpls
,
[]
AllLocalTraitImpls
,
// Nodes representing caches. To properly handle a true cache, we
// don't use a DepTrackingMap, but rather we push a task node.
// Otherwise the write into the map would be incorrectly
// attributed to the first task that happened to fill the cache,
// which would yield an overly conservative dep-graph.
[]
TraitItems
(
DefId
),
[]
ReprHints
(
DefId
),
// Trait selection cache is a little funny. Given a trait
// Trait selection cache is a little funny. Given a trait
// reference like `Foo: SomeTrait<Bar>`, there could be
// reference like `Foo: SomeTrait<Bar>`, there could be
// arbitrarily many def-ids to map on in there (e.g., `Foo`,
// arbitrarily many def-ids to map on in there (e.g., `Foo`,
...
@@ -598,7 +585,6 @@ pub fn fingerprint_needed_for_crate_hash(self) -> bool {
...
@@ -598,7 +585,6 @@ pub fn fingerprint_needed_for_crate_hash(self) -> bool {
[]
MissingLangItems
(
CrateNum
),
[]
MissingLangItems
(
CrateNum
),
[]
ExternConstBody
(
DefId
),
[]
ExternConstBody
(
DefId
),
[]
VisibleParentMap
,
[]
VisibleParentMap
,
[]
IsDirectExternCrate
(
CrateNum
),
[]
MissingExternCrateItem
(
CrateNum
),
[]
MissingExternCrateItem
(
CrateNum
),
[]
UsedCrateSource
(
CrateNum
),
[]
UsedCrateSource
(
CrateNum
),
[]
PostorderCnums
,
[]
PostorderCnums
,
...
@@ -618,6 +604,9 @@ pub fn fingerprint_needed_for_crate_hash(self) -> bool {
...
@@ -618,6 +604,9 @@ pub fn fingerprint_needed_for_crate_hash(self) -> bool {
[]
CodegenUnit
(
InternedString
),
[]
CodegenUnit
(
InternedString
),
[]
CompileCodegenUnit
(
InternedString
),
[]
CompileCodegenUnit
(
InternedString
),
[]
OutputFilenames
,
[]
OutputFilenames
,
// We use this for most things when incr. comp. is turned off.
[]
Null
,
);
);
trait
DepNodeParams
<
'a
,
'gcx
:
'tcx
+
'a
,
'tcx
:
'a
>
:
fmt
::
Debug
{
trait
DepNodeParams
<
'a
,
'gcx
:
'tcx
+
'a
,
'tcx
:
'a
>
:
fmt
::
Debug
{
...
...
src/librustc/dep_graph/graph.rs
浏览文件 @
f0bbf4e1
...
@@ -460,8 +460,9 @@ pub fn try_mark_green(&self,
...
@@ -460,8 +460,9 @@ pub fn try_mark_green(&self,
let
mut
current_deps
=
Vec
::
new
();
let
mut
current_deps
=
Vec
::
new
();
for
&
dep_dep_node
in
prev_deps
{
for
&
dep_dep_node_index
in
prev_deps
{
let
dep_dep_node
=
&
data
.previous
.index_to_node
(
dep_dep_node
);
let
dep_dep_node
=
&
data
.previous
.index_to_node
(
dep_dep_node_index
);
let
dep_dep_node_color
=
data
.colors
.borrow
()
.get
(
dep_dep_node
)
.cloned
();
let
dep_dep_node_color
=
data
.colors
.borrow
()
.get
(
dep_dep_node
)
.cloned
();
match
dep_dep_node_color
{
match
dep_dep_node_color
{
Some
(
DepNodeColor
::
Green
(
node_index
))
=>
{
Some
(
DepNodeColor
::
Green
(
node_index
))
=>
{
...
@@ -478,19 +479,42 @@ pub fn try_mark_green(&self,
...
@@ -478,19 +479,42 @@ pub fn try_mark_green(&self,
return
None
return
None
}
}
None
=>
{
None
=>
{
if
dep_dep_node
.kind
.is_input
()
{
// This input does not exist anymore.
debug_assert!
(
dep_dep_node
.extract_def_id
(
tcx
)
.is_none
());
return
None
;
}
// We don't know the state of this dependency. Let's try to
// We don't know the state of this dependency. Let's try to
// mark it green.
// mark it green.
if
let
Some
(
node_index
)
=
self
.try_mark_green
(
tcx
,
dep_dep_node
)
{
if
let
Some
(
node_index
)
=
self
.try_mark_green
(
tcx
,
dep_dep_node
)
{
current_deps
.push
(
node_index
);
current_deps
.push
(
node_index
);
}
else
{
}
else
{
// We failed to mark it green. This can have various
// We failed to mark it green, so we try to force the query.
// reasons.
if
::
ty
::
maps
::
force_from_dep_node
(
tcx
,
dep_dep_node
)
{
return
None
let
dep_dep_node_color
=
data
.colors
.borrow
()
.get
(
dep_dep_node
)
.cloned
();
match
dep_dep_node_color
{
Some
(
DepNodeColor
::
Green
(
node_index
))
=>
{
current_deps
.push
(
node_index
);
}
Some
(
DepNodeColor
::
Red
)
=>
{
return
None
}
None
=>
{
bug!
(
"try_mark_green() - Forcing the DepNode
\
should have set its color"
)
}
}
}
else
{
// The DepNode could not be forced.
return
None
}
}
}
}
}
}
}
}
}
// If we got here without hitting a `return` that means that all
// If we got here without hitting a `return` that means that all
// dependencies of this DepNode could be marked as green. Therefore we
// dependencies of this DepNode could be marked as green. Therefore we
// can also mark this DepNode as green. We do so by...
// can also mark this DepNode as green. We do so by...
...
...
src/librustc/ty/maps/mod.rs
浏览文件 @
f0bbf4e1
...
@@ -56,6 +56,7 @@
...
@@ -56,6 +56,7 @@
#[macro_use]
#[macro_use]
mod
plumbing
;
mod
plumbing
;
use
self
::
plumbing
::
*
;
use
self
::
plumbing
::
*
;
pub
use
self
::
plumbing
::
force_from_dep_node
;
mod
keys
;
mod
keys
;
pub
use
self
::
keys
::
Key
;
pub
use
self
::
keys
::
Key
;
...
...
src/librustc/ty/maps/plumbing.rs
浏览文件 @
f0bbf4e1
此差异已折叠。
点击以展开。
src/librustc_mir/transform/mod.rs
浏览文件 @
f0bbf4e1
...
@@ -13,7 +13,7 @@
...
@@ -13,7 +13,7 @@
use
rustc
::
mir
::
Mir
;
use
rustc
::
mir
::
Mir
;
use
rustc
::
mir
::
transform
::{
MirPassIndex
,
MirSuite
,
MirSource
,
use
rustc
::
mir
::
transform
::{
MirPassIndex
,
MirSuite
,
MirSource
,
MIR_CONST
,
MIR_VALIDATED
,
MIR_OPTIMIZED
};
MIR_CONST
,
MIR_VALIDATED
,
MIR_OPTIMIZED
};
use
rustc
::
ty
::
{
self
,
TyCtxt
}
;
use
rustc
::
ty
::
TyCtxt
;
use
rustc
::
ty
::
maps
::
Providers
;
use
rustc
::
ty
::
maps
::
Providers
;
use
rustc
::
ty
::
steal
::
Steal
;
use
rustc
::
ty
::
steal
::
Steal
;
use
rustc
::
hir
;
use
rustc
::
hir
;
...
@@ -21,7 +21,7 @@
...
@@ -21,7 +21,7 @@
use
rustc
::
util
::
nodemap
::
DefIdSet
;
use
rustc
::
util
::
nodemap
::
DefIdSet
;
use
std
::
rc
::
Rc
;
use
std
::
rc
::
Rc
;
use
syntax
::
ast
;
use
syntax
::
ast
;
use
syntax_pos
::
{
DUMMY_SP
,
Span
}
;
use
syntax_pos
::
Span
;
use
transform
;
use
transform
;
pub
mod
add_validation
;
pub
mod
add_validation
;
...
@@ -114,11 +114,10 @@ fn mir_validated<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> &'tcx
...
@@ -114,11 +114,10 @@ fn mir_validated<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> &'tcx
let
source
=
MirSource
::
from_local_def_id
(
tcx
,
def_id
);
let
source
=
MirSource
::
from_local_def_id
(
tcx
,
def_id
);
if
let
MirSource
::
Const
(
_
)
=
source
{
if
let
MirSource
::
Const
(
_
)
=
source
{
// Ensure that we compute the `mir_const_qualif` for constants at
// Ensure that we compute the `mir_const_qualif` for constants at
// this point, before we steal the mir-const result. We don't
// this point, before we steal the mir-const result.
// directly need the result or `mir_const_qualif`, so we can just force it.
let
_
=
tcx
.mir_const_qualif
(
def_id
);
ty
::
queries
::
mir_const_qualif
::
force
(
tcx
,
DUMMY_SP
,
def_id
);
}
}
ty
::
queries
::
unsafety_violations
::
force
(
tcx
,
DUMMY_SP
,
def_id
);
let
_
=
tcx
.unsafety_violations
(
def_id
);
let
mut
mir
=
tcx
.mir_const
(
def_id
)
.steal
();
let
mut
mir
=
tcx
.mir_const
(
def_id
)
.steal
();
transform
::
run_suite
(
tcx
,
source
,
MIR_VALIDATED
,
&
mut
mir
);
transform
::
run_suite
(
tcx
,
source
,
MIR_VALIDATED
,
&
mut
mir
);
...
@@ -128,8 +127,8 @@ fn mir_validated<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> &'tcx
...
@@ -128,8 +127,8 @@ fn mir_validated<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> &'tcx
fn
optimized_mir
<
'a
,
'tcx
>
(
tcx
:
TyCtxt
<
'a
,
'tcx
,
'tcx
>
,
def_id
:
DefId
)
->
&
'tcx
Mir
<
'tcx
>
{
fn
optimized_mir
<
'a
,
'tcx
>
(
tcx
:
TyCtxt
<
'a
,
'tcx
,
'tcx
>
,
def_id
:
DefId
)
->
&
'tcx
Mir
<
'tcx
>
{
// (Mir-)Borrowck uses `mir_validated`, so we have to force it to
// (Mir-)Borrowck uses `mir_validated`, so we have to force it to
// execute before we can steal.
// execute before we can steal.
ty
::
queries
::
mir_borrowck
::
force
(
tcx
,
DUMMY_SP
,
def_id
);
let
_
=
tcx
.mir_borrowck
(
def_id
);
ty
::
queries
::
borrowck
::
force
(
tcx
,
DUMMY_SP
,
def_id
);
let
_
=
tcx
.borrowck
(
def_id
);
let
mut
mir
=
tcx
.mir_validated
(
def_id
)
.steal
();
let
mut
mir
=
tcx
.mir_validated
(
def_id
)
.steal
();
let
source
=
MirSource
::
from_local_def_id
(
tcx
,
def_id
);
let
source
=
MirSource
::
from_local_def_id
(
tcx
,
def_id
);
...
...
src/librustc_trans/base.rs
浏览文件 @
f0bbf4e1
...
@@ -947,6 +947,19 @@ pub fn trans_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
...
@@ -947,6 +947,19 @@ pub fn trans_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
shared_ccx
.tcx
()
.collect_and_partition_translation_items
(
LOCAL_CRATE
)
.1
;
shared_ccx
.tcx
()
.collect_and_partition_translation_items
(
LOCAL_CRATE
)
.1
;
let
codegen_units
=
(
*
codegen_units
)
.clone
();
let
codegen_units
=
(
*
codegen_units
)
.clone
();
// Force all codegen_unit queries so they are already either red or green
// when compile_codegen_unit accesses them. We are not able to re-execute
// the codegen_unit query from just the DepNode, so an unknown color would
// lead to having to re-execute compile_codegen_unit, possibly
// unnecessarily.
if
tcx
.dep_graph
.is_fully_enabled
()
{
for
cgu
in
&
codegen_units
{
tcx
.codegen_unit
(
cgu
.name
()
.clone
());
}
}
assert
!
(
codegen_units
.len
()
<=
1
||
!
tcx
.sess
.lto
());
let
ongoing_translation
=
write
::
start_async_translation
(
let
ongoing_translation
=
write
::
start_async_translation
(
tcx
,
tcx
,
time_graph
.clone
(),
time_graph
.clone
(),
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录