Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
81b789fd
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,发现更多精彩内容 >>
提交
81b789fd
编写于
7月 26, 2017
作者:
M
Michael Woerister
提交者:
Michael Woerister
7月 31, 2017
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
async-llvm(19): Already start LLVM while still translating.
上级
7e09d1e1
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
55 addition
and
48 deletion
+55
-48
src/librustc_trans/assert_module_sources.rs
src/librustc_trans/assert_module_sources.rs
+20
-16
src/librustc_trans/back/write.rs
src/librustc_trans/back/write.rs
+4
-1
src/librustc_trans/base.rs
src/librustc_trans/base.rs
+31
-31
未找到文件。
src/librustc_trans/assert_module_sources.rs
浏览文件 @
81b789fd
...
...
@@ -37,11 +37,22 @@
const
MODULE
:
&
'static
str
=
"module"
;
const
CFG
:
&
'static
str
=
"cfg"
;
#[derive(Debug,
PartialEq)]
enum
Disposition
{
Reused
,
Translated
}
#[derive(Debug,
PartialEq,
Clone,
Copy)]
pub
enum
Disposition
{
Reused
,
Translated
}
impl
ModuleTranslation
{
pub
fn
disposition
(
&
self
)
->
(
String
,
Disposition
)
{
let
disposition
=
match
self
.source
{
ModuleSource
::
Preexisting
(
_
)
=>
Disposition
::
Reused
,
ModuleSource
::
Translated
(
_
)
=>
Disposition
::
Translated
,
};
(
self
.name
.clone
(),
disposition
)
}
}
pub
(
crate
)
fn
assert_module_sources
<
'a
,
'tcx
>
(
tcx
:
TyCtxt
<
'a
,
'tcx
,
'tcx
>
,
modules
:
&
[
ModuleTranslation
])
{
modules
:
&
[
(
String
,
Disposition
)
])
{
let
_
ignore
=
tcx
.dep_graph
.in_ignore
();
if
tcx
.sess.opts.incremental
.is_none
()
{
...
...
@@ -56,7 +67,7 @@ pub(crate) fn assert_module_sources<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
struct
AssertModuleSource
<
'a
,
'tcx
:
'a
>
{
tcx
:
TyCtxt
<
'a
,
'tcx
,
'tcx
>
,
modules
:
&
'a
[
ModuleTranslation
],
modules
:
&
'a
[
(
String
,
Disposition
)
],
}
impl
<
'a
,
'tcx
>
AssertModuleSource
<
'a
,
'tcx
>
{
...
...
@@ -75,15 +86,15 @@ fn check_attr(&self, attr: &ast::Attribute) {
}
let
mname
=
self
.field
(
attr
,
MODULE
);
let
mtrans
=
self
.modules
.iter
()
.find
(|
mtrans
|
*
mtrans
.name
==
*
mname
.as_str
());
let
mtrans
=
self
.modules
.iter
()
.find
(|
&&
(
ref
name
,
_
)|
name
==
mname
.as_str
());
let
mtrans
=
match
mtrans
{
Some
(
m
)
=>
m
,
None
=>
{
debug!
(
"module name `{}` not found amongst:"
,
mname
);
for
mtrans
in
self
.modules
{
for
&
(
ref
name
,
ref
disposition
)
in
self
.modules
{
debug!
(
"module named `{}` with disposition {:?}"
,
mtrans
.
name
,
self
.disposition
(
mtrans
)
);
name
,
disposition
);
}
self
.tcx.sess
.span_err
(
...
...
@@ -93,7 +104,7 @@ fn check_attr(&self, attr: &ast::Attribute) {
}
};
let
mtrans_disposition
=
self
.disposition
(
mtrans
)
;
let
mtrans_disposition
=
mtrans
.1
;
if
disposition
!=
mtrans_disposition
{
self
.tcx.sess
.span_err
(
attr
.span
,
...
...
@@ -104,13 +115,6 @@ fn check_attr(&self, attr: &ast::Attribute) {
}
}
fn
disposition
(
&
self
,
mtrans
:
&
ModuleTranslation
)
->
Disposition
{
match
mtrans
.source
{
ModuleSource
::
Preexisting
(
_
)
=>
Disposition
::
Reused
,
ModuleSource
::
Translated
(
_
)
=>
Disposition
::
Translated
,
}
}
fn
field
(
&
self
,
attr
:
&
ast
::
Attribute
,
name
:
&
str
)
->
ast
::
Name
{
for
item
in
attr
.meta_item_list
()
.unwrap_or_else
(
Vec
::
new
)
{
if
item
.check_name
(
name
)
{
...
...
src/librustc_trans/back/write.rs
浏览文件 @
81b789fd
...
...
@@ -678,7 +678,6 @@ pub fn run_passes(sess: &Session,
};
// Figure out what we actually need to build.
let
mut
modules_config
=
ModuleConfig
::
new
(
sess
,
sess
.opts.cg.passes
.clone
());
let
mut
metadata_config
=
ModuleConfig
::
new
(
sess
,
vec!
[]);
let
mut
allocator_config
=
ModuleConfig
::
new
(
sess
,
vec!
[]);
...
...
@@ -1615,4 +1614,8 @@ pub fn submit_translated_module_to_llvm(&self,
pub
fn
signal_translation_done
(
&
self
)
{
drop
(
self
.coordinator_send
.send
(
Message
::
TranslationDone
));
}
pub
fn
check_for_errors
(
&
self
,
sess
:
&
Session
)
{
self
.shared_emitter_main
.check
(
sess
,
false
);
}
}
src/librustc_trans/base.rs
浏览文件 @
81b789fd
...
...
@@ -1024,12 +1024,15 @@ pub fn trans_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
linker_info
,
no_integrated_as
);
ongoing_translation
.submit_translated_module_to_llvm
(
tcx
.sess
,
metadata_module
);
let
translation_items
=
Arc
::
new
(
translation_items
);
let
mut
all_stats
=
Stats
::
default
();
let
modules
:
Vec
<
ModuleTranslation
>
=
codegen_units
.into_iter
()
.map
(|
cgu
|
{
let
mut
module_dispositions
=
tcx
.sess.opts.incremental
.as_ref
()
.map
(|
_
|
Vec
::
new
());
for
cgu
in
codegen_units
.into_iter
()
{
ongoing_translation
.check_for_errors
(
tcx
.sess
);
let
dep_node
=
cgu
.work_product_dep_node
();
let
((
stats
,
module
),
_
)
=
tcx
.dep_graph
.with_task
(
dep_node
,
...
...
@@ -1039,9 +1042,16 @@ pub fn trans_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
exported_symbols
.clone
())),
module_translation
);
all_stats
.extend
(
stats
);
module
})
.collect
();
if
let
Some
(
ref
mut
module_dispositions
)
=
module_dispositions
{
module_dispositions
.push
(
module
.disposition
());
}
ongoing_translation
.submit_translated_module_to_llvm
(
tcx
.sess
,
module
);
}
if
let
Some
(
module_dispositions
)
=
module_dispositions
{
assert_module_sources
::
assert_module_sources
(
tcx
,
&
module_dispositions
);
}
fn
module_translation
<
'a
,
'tcx
>
(
scx
:
AssertDepGraphSafe
<&
SharedCrateContext
<
'a
,
'tcx
>>
,
...
...
@@ -1175,8 +1185,6 @@ fn module_translation<'a, 'tcx>(
(
lcx
.into_stats
(),
module
)
}
assert_module_sources
::
assert_module_sources
(
tcx
,
&
modules
);
symbol_names_test
::
report_symbol_names
(
tcx
);
if
shared_ccx
.sess
()
.trans_stats
()
{
...
...
@@ -1207,8 +1215,6 @@ fn module_translation<'a, 'tcx>(
}
}
let
sess
=
shared_ccx
.sess
();
// Translate an allocator shim, if any
//
// If LTO is enabled and we've got some previous LLVM module we translated
...
...
@@ -1244,23 +1250,17 @@ fn module_translation<'a, 'tcx>(
None
};
assert_and_save_dep_graph
(
tcx
,
incremental_hashes_map
,
metadata_incr_hashes
,
link_meta
);
ongoing_translation
.submit_translated_module_to_llvm
(
sess
,
metadata_module
);
for
mtrans
in
modules
{
ongoing_translation
.submit_translated_module_to_llvm
(
sess
,
mtrans
);
}
if
let
Some
(
allocator_module
)
=
allocator_module
{
ongoing_translation
.submit_translated_module_to_llvm
(
sess
,
allocator_module
);
ongoing_translation
.submit_translated_module_to_llvm
(
tcx
.
sess
,
allocator_module
);
}
ongoing_translation
.check_for_errors
(
tcx
.sess
);
ongoing_translation
.signal_translation_done
();
assert_and_save_dep_graph
(
tcx
,
incremental_hashes_map
,
metadata_incr_hashes
,
link_meta
);
ongoing_translation
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录