Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
5c0110f4
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,发现更多精彩内容 >>
提交
5c0110f4
编写于
7月 16, 2018
作者:
M
Michael Woerister
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Revert "Persist ThinLTO import data in incr. comp. session directory."
This reverts commit
8dc7ddb9
.
上级
6064efe9
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
4 addition
and
107 deletion
+4
-107
src/librustc_codegen_llvm/back/lto.rs
src/librustc_codegen_llvm/back/lto.rs
+2
-81
src/librustc_codegen_llvm/base.rs
src/librustc_codegen_llvm/base.rs
+1
-23
src/librustc_codegen_llvm/lib.rs
src/librustc_codegen_llvm/lib.rs
+1
-1
src/librustc_incremental/lib.rs
src/librustc_incremental/lib.rs
+0
-1
src/librustc_incremental/persist/mod.rs
src/librustc_incremental/persist/mod.rs
+0
-1
未找到文件。
src/librustc_codegen_llvm/back/lto.rs
浏览文件 @
5c0110f4
...
...
@@ -27,16 +27,10 @@
use
libc
;
use
std
::
ffi
::{
CString
,
CStr
};
use
std
::
fs
::
File
;
use
std
::
io
;
use
std
::
mem
;
use
std
::
path
::
Path
;
use
std
::
ptr
;
use
std
::
slice
;
use
std
::
sync
::
Arc
;
pub
const
THIN_LTO_IMPORTS_INCR_COMP_FILE_NAME
:
&
str
=
"thin-lto-imports.bin"
;
pub
fn
crate_type_allows_lto
(
crate_type
:
config
::
CrateType
)
->
bool
{
match
crate_type
{
config
::
CrateTypeExecutable
|
...
...
@@ -200,7 +194,7 @@ pub(crate) fn run(cgcx: &CodegenContext,
}
Lto
::
Thin
|
Lto
::
ThinLocal
=>
{
thin_lto
(
cgcx
,
&
diag_handler
,
modules
,
upstream_modules
,
&
arr
,
timeline
)
thin_lto
(
&
diag_handler
,
modules
,
upstream_modules
,
&
arr
,
timeline
)
}
Lto
::
No
=>
unreachable!
(),
}
...
...
@@ -353,8 +347,7 @@ fn drop(&mut self) {
/// calculating the *index* for ThinLTO. This index will then be shared amongst
/// all of the `LtoModuleCodegen` units returned below and destroyed once
/// they all go out of scope.
fn
thin_lto
(
cgcx
:
&
CodegenContext
,
diag_handler
:
&
Handler
,
fn
thin_lto
(
diag_handler
:
&
Handler
,
modules
:
Vec
<
ModuleCodegen
>
,
serialized_modules
:
Vec
<
(
SerializedModule
,
CString
)
>
,
symbol_white_list
:
&
[
*
const
libc
::
c_char
],
...
...
@@ -432,18 +425,6 @@ fn thin_lto(cgcx: &CodegenContext,
let
msg
=
format!
(
"failed to prepare thin LTO context"
);
return
Err
(
write
::
llvm_err
(
&
diag_handler
,
msg
))
}
// Save the ThinLTO import information for incremental compilation.
if
let
Some
(
ref
incr_comp_session_dir
)
=
cgcx
.incr_comp_session_dir
{
let
path
=
incr_comp_session_dir
.join
(
THIN_LTO_IMPORTS_INCR_COMP_FILE_NAME
);
let
imports
=
ThinLTOImports
::
from_thin_lto_data
(
data
);
if
let
Err
(
err
)
=
imports
.save_to_file
(
&
path
)
{
let
msg
=
format!
(
"Error while writing ThinLTO import data: {}"
,
err
);
return
Err
(
write
::
llvm_err
(
&
diag_handler
,
msg
));
}
}
let
data
=
ThinData
(
data
);
info!
(
"thin LTO data created"
);
timeline
.record
(
"data"
);
...
...
@@ -806,12 +787,6 @@ pub struct ThinLTOImports {
impl
ThinLTOImports
{
pub
fn
new_empty
()
->
ThinLTOImports
{
ThinLTOImports
{
imports
:
FxHashMap
(),
}
}
/// Load the ThinLTO import map from ThinLTOData.
unsafe
fn
from_thin_lto_data
(
data
:
*
const
llvm
::
ThinLTOData
)
->
ThinLTOImports
{
let
raw_data
:
*
const
llvm
::
ThinLTOModuleImports
=
...
...
@@ -867,58 +842,4 @@ unsafe fn from_thin_lto_data(data: *const llvm::ThinLTOData) -> ThinLTOImports {
imports
}
}
pub
fn
save_to_file
(
&
self
,
path
:
&
Path
)
->
io
::
Result
<
()
>
{
use
std
::
io
::
Write
;
let
file
=
File
::
create
(
path
)
?
;
let
mut
writer
=
io
::
BufWriter
::
new
(
file
);
for
(
importing_module_name
,
imported_modules
)
in
&
self
.imports
{
writeln!
(
writer
,
"{}"
,
importing_module_name
)
?
;
for
imported_module
in
imported_modules
{
writeln!
(
writer
,
" {}"
,
imported_module
)
?
;
}
writeln!
(
writer
)
?
;
}
Ok
(())
}
pub
fn
load_from_file
(
path
:
&
Path
)
->
io
::
Result
<
ThinLTOImports
>
{
use
std
::
io
::
BufRead
;
let
mut
imports
=
FxHashMap
();
let
mut
current_module
=
None
;
let
mut
current_imports
=
vec!
[];
let
file
=
File
::
open
(
path
)
?
;
for
line
in
io
::
BufReader
::
new
(
file
)
.lines
()
{
let
line
=
line
?
;
if
line
.is_empty
()
{
let
importing_module
=
current_module
.take
()
.expect
(
"Importing module not set"
);
imports
.insert
(
importing_module
,
mem
::
replace
(
&
mut
current_imports
,
vec!
[]));
}
else
if
line
.starts_with
(
" "
)
{
// This is an imported module
assert_ne!
(
current_module
,
None
);
current_imports
.push
(
line
.trim
()
.to_string
());
}
else
{
// This is the beginning of a new module
assert_eq!
(
current_module
,
None
);
current_module
=
Some
(
line
.trim
()
.to_string
());
}
}
Ok
(
ThinLTOImports
{
imports
})
}
}
src/librustc_codegen_llvm/base.rs
浏览文件 @
5c0110f4
...
...
@@ -29,7 +29,7 @@
use
super
::
ModuleKind
;
use
abi
;
use
back
::
{
link
,
lto
}
;
use
back
::
link
;
use
back
::
write
::{
self
,
OngoingCodegen
,
create_target_machine
};
use
llvm
::{
ContextRef
,
ModuleRef
,
ValueRef
,
Vector
,
get_param
};
use
llvm
;
...
...
@@ -1370,27 +1370,6 @@ fn hash_stable<W: StableHasherResult>(&self,
}
}
#[allow(unused)]
fn
load_thin_lto_imports
(
sess
:
&
Session
)
->
lto
::
ThinLTOImports
{
let
path
=
rustc_incremental
::
in_incr_comp_dir_sess
(
sess
,
lto
::
THIN_LTO_IMPORTS_INCR_COMP_FILE_NAME
);
if
!
path
.exists
()
{
return
lto
::
ThinLTOImports
::
new_empty
();
}
match
lto
::
ThinLTOImports
::
load_from_file
(
&
path
)
{
Ok
(
imports
)
=>
imports
,
Err
(
e
)
=>
{
let
msg
=
format!
(
"Error while trying to load ThinLTO import data
\
for incremental compilation: {}"
,
e
);
sess
.fatal
(
&
msg
)
}
}
}
pub
fn
define_custom_section
(
cx
:
&
CodegenCx
,
def_id
:
DefId
)
{
use
rustc
::
mir
::
interpret
::
GlobalId
;
...
...
@@ -1429,4 +1408,3 @@ pub fn define_custom_section(cx: &CodegenCx, def_id: DefId) {
);
}
}
src/librustc_codegen_llvm/lib.rs
浏览文件 @
5c0110f4
...
...
@@ -90,7 +90,7 @@ mod back {
mod
command
;
pub
mod
linker
;
pub
mod
link
;
pub
mod
lto
;
mod
lto
;
pub
mod
symbol_export
;
pub
mod
write
;
mod
rpath
;
...
...
src/librustc_incremental/lib.rs
浏览文件 @
5c0110f4
...
...
@@ -44,7 +44,6 @@
pub
use
persist
::
save_dep_graph
;
pub
use
persist
::
save_work_product_index
;
pub
use
persist
::
in_incr_comp_dir
;
pub
use
persist
::
in_incr_comp_dir_sess
;
pub
use
persist
::
prepare_session_directory
;
pub
use
persist
::
finalize_session_directory
;
pub
use
persist
::
delete_workproduct_files
;
...
...
src/librustc_incremental/persist/mod.rs
浏览文件 @
5c0110f4
...
...
@@ -23,7 +23,6 @@
pub
use
self
::
fs
::
finalize_session_directory
;
pub
use
self
::
fs
::
garbage_collect_session_directories
;
pub
use
self
::
fs
::
in_incr_comp_dir
;
pub
use
self
::
fs
::
in_incr_comp_dir_sess
;
pub
use
self
::
fs
::
prepare_session_directory
;
pub
use
self
::
load
::
dep_graph_tcx_init
;
pub
use
self
::
load
::
load_dep_graph
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录