Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
3fc09365
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,发现更多精彩内容 >>
提交
3fc09365
编写于
4月 24, 2019
作者:
N
Nicholas Nethercote
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Don't generate unnecessary rmeta files.
上级
4eff8526
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
37 addition
and
23 deletion
+37
-23
src/librustc_codegen_ssa/back/link.rs
src/librustc_codegen_ssa/back/link.rs
+12
-7
src/librustc_codegen_ssa/back/write.rs
src/librustc_codegen_ssa/back/write.rs
+5
-6
src/librustc_codegen_ssa/base.rs
src/librustc_codegen_ssa/base.rs
+19
-9
src/librustc_codegen_ssa/lib.rs
src/librustc_codegen_ssa/lib.rs
+1
-1
未找到文件。
src/librustc_codegen_ssa/back/link.rs
浏览文件 @
3fc09365
...
...
@@ -83,14 +83,16 @@ pub fn link_binary<'a, B: ArchiveBuilder<'a>>(sess: &'a Session,
for
obj
in
codegen_results
.modules
.iter
()
.filter_map
(|
m
|
m
.bytecode_compressed
.as_ref
())
{
remove
(
sess
,
obj
);
}
if
let
Some
(
ref
obj
)
=
codegen_results
.metadata_module.object
{
remove
(
sess
,
obj
);
}
if
let
Some
(
ref
allocator
)
=
codegen_results
.allocator_module
{
if
let
Some
(
ref
obj
)
=
allocator
.object
{
if
let
Some
(
ref
metadata_module
)
=
codegen_results
.metadata_module
{
if
let
Some
(
ref
obj
)
=
metadata_module
.object
{
remove
(
sess
,
obj
);
}
}
if
let
Some
(
ref
allocator_module
)
=
codegen_results
.allocator_module
{
if
let
Some
(
ref
obj
)
=
allocator_module
.object
{
remove
(
sess
,
obj
);
}
if
let
Some
(
ref
bc
)
=
allocator
.bytecode_compressed
{
if
let
Some
(
ref
bc
)
=
allocator
_module
.bytecode_compressed
{
remove
(
sess
,
bc
);
}
}
...
...
@@ -1067,7 +1069,10 @@ fn link_args<'a, B: ArchiveBuilder<'a>>(cmd: &mut dyn Linker,
// object file, so we link that in here.
if
crate_type
==
config
::
CrateType
::
Dylib
||
crate_type
==
config
::
CrateType
::
ProcMacro
{
if
let
Some
(
obj
)
=
codegen_results
.metadata_module.object
.as_ref
()
{
let
obj
=
codegen_results
.metadata_module
.as_ref
()
.and_then
(|
m
|
m
.object
.as_ref
());
if
let
Some
(
obj
)
=
obj
{
cmd
.add_object
(
obj
);
}
}
...
...
src/librustc_codegen_ssa/back/write.rs
浏览文件 @
3fc09365
...
...
@@ -350,7 +350,7 @@ fn generate_lto_work<B: ExtraBackendMethods>(
pub
struct
CompiledModules
{
pub
modules
:
Vec
<
CompiledModule
>
,
pub
metadata_module
:
CompiledModule
,
pub
metadata_module
:
Option
<
CompiledModule
>
,
pub
allocator_module
:
Option
<
CompiledModule
>
,
}
...
...
@@ -682,8 +682,10 @@ fn produce_final_output_artifacts(sess: &Session,
}
if
!
user_wants_bitcode
{
if
let
Some
(
ref
path
)
=
compiled_modules
.metadata_module.bytecode
{
remove
(
sess
,
&
path
);
if
let
Some
(
ref
metadata_module
)
=
compiled_modules
.metadata_module
{
if
let
Some
(
ref
path
)
=
metadata_module
.bytecode
{
remove
(
sess
,
&
path
);
}
}
if
let
Some
(
ref
allocator_module
)
=
compiled_modules
.allocator_module
{
...
...
@@ -1564,9 +1566,6 @@ fn start_executing_work<B: ExtraBackendMethods>(
// out deterministic results.
compiled_modules
.sort_by
(|
a
,
b
|
a
.name
.cmp
(
&
b
.name
));
let
compiled_metadata_module
=
compiled_metadata_module
.expect
(
"Metadata module not compiled?"
);
Ok
(
CompiledModules
{
modules
:
compiled_modules
,
metadata_module
:
compiled_metadata_module
,
...
...
src/librustc_codegen_ssa/base.rs
浏览文件 @
3fc09365
...
...
@@ -25,7 +25,7 @@
use
rustc
::
ty
::
query
::
Providers
;
use
rustc
::
middle
::
cstore
::{
self
,
LinkagePreference
};
use
rustc
::
util
::
common
::{
time
,
print_time_passes_entry
};
use
rustc
::
session
::
config
::{
self
,
EntryFnType
,
Lto
};
use
rustc
::
session
::
config
::{
self
,
CrateType
,
EntryFnType
,
Lto
};
use
rustc
::
session
::
Session
;
use
rustc_mir
::
monomorphize
::
item
::
DefPathBasedNames
;
use
rustc_mir
::
monomorphize
::
Instance
;
...
...
@@ -550,12 +550,6 @@ pub fn codegen_crate<B: ExtraBackendMethods>(
});
tcx
.sess
.profiler
(|
p
|
p
.end_activity
(
"codegen crate metadata"
));
let
metadata_module
=
ModuleCodegen
{
name
:
metadata_cgu_name
,
module_llvm
:
metadata_llvm_module
,
kind
:
ModuleKind
::
Metadata
,
};
// Skip crate items and just output metadata in -Z no-codegen mode.
if
tcx
.sess.opts.debugging_opts.no_codegen
||
!
tcx
.sess.opts.output_types
.should_codegen
()
{
...
...
@@ -566,7 +560,6 @@ pub fn codegen_crate<B: ExtraBackendMethods>(
rx
,
1
);
ongoing_codegen
.submit_pre_codegened_module_to_llvm
(
tcx
,
metadata_module
);
ongoing_codegen
.codegen_finished
(
tcx
);
assert_and_save_dep_graph
(
tcx
);
...
...
@@ -639,7 +632,24 @@ pub fn codegen_crate<B: ExtraBackendMethods>(
ongoing_codegen
.submit_pre_codegened_module_to_llvm
(
tcx
,
allocator_module
);
}
ongoing_codegen
.submit_pre_codegened_module_to_llvm
(
tcx
,
metadata_module
);
let
needs_metadata_module
=
tcx
.sess.crate_types
.borrow
()
.iter
()
.any
(|
ct
|
{
match
*
ct
{
CrateType
::
Dylib
|
CrateType
::
ProcMacro
=>
true
,
CrateType
::
Executable
|
CrateType
::
Rlib
|
CrateType
::
Staticlib
|
CrateType
::
Cdylib
=>
false
,
}
});
if
needs_metadata_module
{
let
metadata_module
=
ModuleCodegen
{
name
:
metadata_cgu_name
,
module_llvm
:
metadata_llvm_module
,
kind
:
ModuleKind
::
Metadata
,
};
ongoing_codegen
.submit_pre_codegened_module_to_llvm
(
tcx
,
metadata_module
);
}
// We sort the codegen units by size. This way we can schedule work for LLVM
// a bit more efficiently.
...
...
src/librustc_codegen_ssa/lib.rs
浏览文件 @
3fc09365
...
...
@@ -154,7 +154,7 @@ pub struct CodegenResults {
pub
crate_name
:
Symbol
,
pub
modules
:
Vec
<
CompiledModule
>
,
pub
allocator_module
:
Option
<
CompiledModule
>
,
pub
metadata_module
:
CompiledModule
,
pub
metadata_module
:
Option
<
CompiledModule
>
,
pub
crate_hash
:
Svh
,
pub
metadata
:
rustc
::
middle
::
cstore
::
EncodedMetadata
,
pub
windows_subsystem
:
Option
<
String
>
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录