Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
032be94d
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,发现更多精彩内容 >>
提交
032be94d
编写于
4月 10, 2020
作者:
D
Dylan MacKenzie
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Rename `live_locals` -> `live_locals_at_any_suspension_point`
上级
d0086166
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
12 addition
and
11 deletion
+12
-11
src/librustc_mir/transform/generator.rs
src/librustc_mir/transform/generator.rs
+12
-11
未找到文件。
src/librustc_mir/transform/generator.rs
浏览文件 @
032be94d
...
@@ -467,12 +467,13 @@ fn locals_live_across_suspend_points(
...
@@ -467,12 +467,13 @@ fn locals_live_across_suspend_points(
dataflow
::
ResultsCursor
::
new
(
body_ref
,
&
requires_storage_results
);
dataflow
::
ResultsCursor
::
new
(
body_ref
,
&
requires_storage_results
);
// Calculate the liveness of MIR locals ignoring borrows.
// Calculate the liveness of MIR locals ignoring borrows.
let
mut
live_locals
=
liveness
::
LiveVarSet
::
new_empty
(
body
.local_decls
.len
());
let
mut
liveness
=
liveness
::
liveness_of_locals
(
body
);
let
mut
liveness
=
liveness
::
liveness_of_locals
(
body
);
liveness
::
dump_mir
(
tcx
,
"generator_liveness"
,
source
,
body_ref
,
&
liveness
);
liveness
::
dump_mir
(
tcx
,
"generator_liveness"
,
source
,
body_ref
,
&
liveness
);
let
mut
storage_liveness_map
=
IndexVec
::
from_elem
(
None
,
body
.basic_blocks
());
let
mut
storage_liveness_map
=
IndexVec
::
from_elem
(
None
,
body
.basic_blocks
());
let
mut
live_locals_at_suspension_points
=
Vec
::
new
();
let
mut
live_locals_at_suspension_points
=
Vec
::
new
();
let
mut
live_locals_at_any_suspension_point
=
liveness
::
LiveVarSet
::
new_empty
(
body
.local_decls
.len
());
for
(
block
,
data
)
in
body
.basic_blocks
()
.iter_enumerated
()
{
for
(
block
,
data
)
in
body
.basic_blocks
()
.iter_enumerated
()
{
if
let
TerminatorKind
::
Yield
{
..
}
=
data
.terminator
()
.kind
{
if
let
TerminatorKind
::
Yield
{
..
}
=
data
.terminator
()
.kind
{
...
@@ -509,39 +510,39 @@ fn locals_live_across_suspend_points(
...
@@ -509,39 +510,39 @@ fn locals_live_across_suspend_points(
// Locals live are live at this point only if they are used across
// Locals live are live at this point only if they are used across
// suspension points (the `liveness` variable)
// suspension points (the `liveness` variable)
// and their storage is required (the `storage_required` variable)
// and their storage is required (the `storage_required` variable)
let
mut
live_locals
_here
=
storage_required
;
let
mut
live_locals
=
storage_required
;
live_locals
_here
.intersect
(
&
liveness
.outs
[
block
]);
live_locals
.intersect
(
&
liveness
.outs
[
block
]);
// The generator argument is ignored.
// The generator argument is ignored.
live_locals
_here
.remove
(
SELF_ARG
);
live_locals
.remove
(
SELF_ARG
);
debug!
(
"loc = {:?}, live_locals
_here = {:?}"
,
loc
,
live_locals_here
);
debug!
(
"loc = {:?}, live_locals
= {:?}"
,
loc
,
live_locals
);
// Add the locals live at this suspension point to the set of locals which live across
// Add the locals live at this suspension point to the set of locals which live across
// any suspension points
// any suspension points
live_locals
.union
(
&
live_locals_here
);
live_locals
_at_any_suspension_point
.union
(
&
live_locals
);
live_locals_at_suspension_points
.push
(
live_locals
_here
);
live_locals_at_suspension_points
.push
(
live_locals
);
}
}
}
}
debug!
(
"live_locals
= {:?}"
,
live_locals
);
debug!
(
"live_locals
_anywhere = {:?}"
,
live_locals_at_any_suspension_point
);
// Renumber our liveness_map bitsets to include only the locals we are
// Renumber our liveness_map bitsets to include only the locals we are
// saving.
// saving.
let
live_locals_at_suspension_points
=
live_locals_at_suspension_points
let
live_locals_at_suspension_points
=
live_locals_at_suspension_points
.iter
()
.iter
()
.map
(|
live_here
|
renumber_bitset
(
&
live_here
,
&
live_locals
))
.map
(|
live_here
|
renumber_bitset
(
&
live_here
,
&
live_locals
_at_any_suspension_point
))
.collect
();
.collect
();
let
storage_conflicts
=
compute_storage_conflicts
(
let
storage_conflicts
=
compute_storage_conflicts
(
body_ref
,
body_ref
,
&
live_locals
,
&
live_locals
_at_any_suspension_point
,
always_live_locals
.clone
(),
always_live_locals
.clone
(),
requires_storage_results
,
requires_storage_results
,
);
);
LivenessInfo
{
LivenessInfo
{
live_locals
,
live_locals
:
live_locals_at_any_suspension_point
,
live_locals_at_suspension_points
,
live_locals_at_suspension_points
,
storage_conflicts
,
storage_conflicts
,
storage_liveness
:
storage_liveness_map
,
storage_liveness
:
storage_liveness_map
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录