Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
14b16dcf
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,发现更多精彩内容 >>
提交
14b16dcf
编写于
5月 26, 2017
作者:
R
Ralf Jung
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
use proper span for TLS dtors; fix some nits
上级
a66f359d
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
9 addition
and
11 deletion
+9
-11
src/memory.rs
src/memory.rs
+0
-1
src/step.rs
src/step.rs
+3
-4
src/terminator/mod.rs
src/terminator/mod.rs
+6
-6
未找到文件。
src/memory.rs
浏览文件 @
14b16dcf
...
...
@@ -100,7 +100,6 @@ pub fn never_ptr() -> Self {
}
pub
fn
is_null_ptr
(
&
self
)
->
bool
{
// FIXME: Is this the right way?
return
*
self
==
Pointer
::
from_int
(
0
)
}
}
...
...
src/step.rs
浏览文件 @
14b16dcf
...
...
@@ -14,7 +14,7 @@
use
lvalue
::{
Global
,
GlobalId
,
Lvalue
};
use
value
::{
Value
,
PrimVal
};
use
memory
::
Pointer
;
use
syntax
::
codemap
::
{
Span
,
DUMMY_SP
}
;
use
syntax
::
codemap
::
Span
;
impl
<
'a
,
'tcx
>
EvalContext
<
'a
,
'tcx
>
{
pub
fn
inc_step_counter_and_check_limit
(
&
mut
self
,
n
:
u64
)
->
EvalResult
<
'tcx
>
{
...
...
@@ -36,10 +36,9 @@ pub fn step(&mut self) -> EvalResult<'tcx, bool> {
trace!
(
"Running TLS dtor {:?} on {:?}"
,
instance
,
ptr
);
// TODO: Potientiually, this has to support all the other possible instances? See eval_fn_call in terminator/mod.rs
let
mir
=
self
.load_mir
(
instance
.def
)
?
;
// FIXME: Are these the right dummy values?
self
.push_stack_frame
(
instance
,
DUMMY_SP
,
mir
.span
,
mir
,
Lvalue
::
from_ptr
(
Pointer
::
zst_ptr
()),
StackPopCleanup
::
None
,
...
...
@@ -51,7 +50,7 @@ pub fn step(&mut self) -> EvalResult<'tcx, bool> {
}
else
{
return
Err
(
EvalError
::
AbiViolation
(
"TLS dtor does not take enough arguments."
.to_owned
()));
}
return
Ok
(
true
);
}
return
Ok
(
false
);
...
...
src/terminator/mod.rs
浏览文件 @
14b16dcf
use
rustc
::
hir
::
def_id
::
DefId
;
use
rustc
::
mir
;
use
rustc
::
ty
::{
self
,
TypeVariants
,
Ty
,
Ty
S
,
Ty
peAndMut
};
use
rustc
::
ty
::{
self
,
TypeVariants
,
Ty
,
TypeAndMut
};
use
rustc
::
ty
::
layout
::
Layout
;
use
syntax
::
codemap
::
Span
;
use
syntax
::
attr
;
...
...
@@ -600,19 +600,19 @@ fn call_c_abi(
let
key_ptr
=
args
[
0
]
.read_ptr
(
&
self
.memory
)
?
;
// Extract the function type out of the signature (that seems easier than constructing it ourselves...)
// FIXME: Or should we instead construct the type we expect it to have?
let
dtor_fn_ty
=
match
self
.operand_ty
(
&
arg_operands
[
1
])
{
&
TyS
{
sty
:
TypeVariants
::
TyAdt
(
_
,
ref
substs
),
..
}
=>
{
let
dtor_fn_ty
=
match
self
.operand_ty
(
&
arg_operands
[
1
])
.sty
{
TypeVariants
::
TyAdt
(
_
,
ref
substs
)
=>
{
substs
.type_at
(
0
)
}
_
=>
return
Err
(
EvalError
::
AbiViolation
(
"Wrong signature used for pthread_key_create: Second argument must be option of a function pointer."
.to_owned
()))
};
let
dtor_ptr
=
self
.value_to_primval
(
args
[
1
],
dtor_fn_ty
)
?
.to_ptr
()
?
;
// TODO: The null-pointer case here is entirely untested
let
dtor
=
if
dtor_ptr
.is_null_ptr
()
{
None
}
else
{
Some
(
self
.memory
.get_fn
(
dtor_ptr
.alloc_id
)
?
)
};
// Figure out how large a pthread TLS key actually is. This is libc::pthread_key_t.
let
key_size
=
match
self
.operand_ty
(
&
arg_operands
[
0
])
{
&
TyS
{
sty
:
TypeVariants
::
TyRawPtr
(
TypeAndMut
{
ty
,
..
}),
..
}
=>
{
let
key_size
=
match
self
.operand_ty
(
&
arg_operands
[
0
])
.sty
{
TypeVariants
::
TyRawPtr
(
TypeAndMut
{
ty
,
..
})
=>
{
let
layout
=
self
.type_layout
(
ty
)
?
;
layout
.size
(
&
self
.tcx.data_layout
)
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录