Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
781c3a66
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,发现更多精彩内容 >>
提交
781c3a66
编写于
6月 11, 2016
作者:
S
Scott Olson
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Update for changes in rustc nightly.
上级
a8d0812e
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
40 addition
and
21 deletion
+40
-21
Cargo.lock
Cargo.lock
+5
-5
src/bin/miri.rs
src/bin/miri.rs
+4
-4
src/interpreter/mod.rs
src/interpreter/mod.rs
+27
-9
src/interpreter/stepper.rs
src/interpreter/stepper.rs
+3
-3
src/lib.rs
src/lib.rs
+1
-0
未找到文件。
Cargo.lock
浏览文件 @
781c3a66
...
...
@@ -3,7 +3,7 @@ name = "miri"
version = "0.1.0"
dependencies = [
"byteorder 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
"compiletest_rs 0.1.
2
(registry+https://github.com/rust-lang/crates.io-index)",
"compiletest_rs 0.1.
3
(registry+https://github.com/rust-lang/crates.io-index)",
"env_logger 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"log_settings 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
...
...
@@ -24,7 +24,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "compiletest_rs"
version = "0.1.
2
"
version = "0.1.
3
"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
...
...
@@ -55,7 +55,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "libc"
version = "0.2.1
1
"
version = "0.2.1
2
"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
...
...
@@ -76,7 +76,7 @@ name = "memchr"
version = "0.1.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"libc 0.2.1
1
(registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.1
2
(registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
...
...
@@ -102,7 +102,7 @@ version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.1
1
(registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.1
2
(registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
...
...
src/bin/miri.rs
浏览文件 @
781c3a66
...
...
@@ -90,11 +90,11 @@ fn interpret_start_points<'a, 'tcx>(
fn
report
(
tcx
:
TyCtxt
,
ecx
:
&
EvalContext
,
e
:
EvalError
)
{
let
frame
=
ecx
.stack
()
.last
()
.expect
(
"stackframe was empty"
);
let
block
=
frame
.mir
.basic_block_data
(
frame
.next_block
)
;
let
block
=
&
frame
.mir
.basic_blocks
()[
frame
.next_block
]
;
let
span
=
if
frame
.stmt
<
block
.statements
.len
()
{
block
.statements
[
frame
.stmt
]
.span
block
.statements
[
frame
.stmt
]
.s
ource_info.s
pan
}
else
{
block
.terminator
()
.span
block
.terminator
()
.s
ource_info.s
pan
};
let
mut
err
=
tcx
.sess
.struct_span_err
(
span
,
&
e
.to_string
());
for
&
Frame
{
def_id
,
substs
,
span
,
..
}
in
ecx
.stack
()
.iter
()
.rev
()
{
...
...
@@ -105,7 +105,7 @@ fn report(tcx: TyCtxt, ecx: &EvalContext, e: EvalError) {
impl
<
'tcx
>
fmt
::
Display
for
Instance
<
'tcx
>
{
fn
fmt
(
&
self
,
f
:
&
mut
fmt
::
Formatter
)
->
fmt
::
Result
{
ppaux
::
parameterized
(
f
,
self
.1
,
self
.0
,
ppaux
::
Ns
::
Value
,
&
[],
|
tcx
|
tcx
.lookup_item_type
(
self
.0
)
.generics
)
|
tcx
|
Some
(
tcx
.lookup_item_type
(
self
.0
)
.generics
)
)
}
}
err
.span_note
(
span
,
&
format!
(
"inside call to {}"
,
Instance
(
def_id
,
substs
)));
...
...
src/interpreter/mod.rs
浏览文件 @
781c3a66
...
...
@@ -8,6 +8,7 @@
use
rustc
::
ty
::
subst
::{
self
,
Subst
,
Substs
};
use
rustc
::
ty
::{
self
,
Ty
,
TyCtxt
};
use
rustc
::
util
::
nodemap
::
DefIdMap
;
use
rustc_data_structures
::
indexed_vec
::
Idx
;
use
std
::
cell
::
RefCell
;
use
std
::
ops
::
Deref
;
use
std
::
rc
::
Rc
;
...
...
@@ -118,7 +119,7 @@ struct ConstantId<'tcx> {
#[derive(Clone,
Debug,
Eq,
PartialEq,
Hash)]
enum
ConstantKind
{
Promoted
(
usize
),
Promoted
(
mir
::
Promoted
),
/// Statics, constants and associated constants
Global
,
}
...
...
@@ -485,7 +486,10 @@ fn eval_terminator(&mut self, terminator: &mir::Terminator<'tcx>)
}
let
mir
=
self
.load_mir
(
resolved_def_id
);
self
.push_stack_frame
(
def_id
,
terminator
.span
,
mir
,
resolved_substs
,
return_ptr
);
self
.push_stack_frame
(
def_id
,
terminator
.source_info.span
,
mir
,
resolved_substs
,
return_ptr
);
for
(
i
,
(
src
,
src_ty
))
in
arg_srcs
.into_iter
()
.enumerate
()
{
let
dest
=
self
.frame
()
.locals
[
i
];
...
...
@@ -501,14 +505,26 @@ fn eval_terminator(&mut self, terminator: &mir::Terminator<'tcx>)
}
}
Drop
{
ref
value
,
target
,
..
}
=>
{
let
ptr
=
self
.eval_lvalue
(
value
)
?
.to_ptr
();
let
ty
=
self
.lvalue_ty
(
value
);
Drop
{
ref
location
,
target
,
..
}
=>
{
let
ptr
=
self
.eval_lvalue
(
location
)
?
.to_ptr
();
let
ty
=
self
.lvalue_ty
(
location
);
self
.drop
(
ptr
,
ty
)
?
;
self
.frame_mut
()
.next_block
=
target
;
}
Assert
{
ref
cond
,
expected
,
ref
msg
,
target
,
cleanup
}
=>
{
let
actual_ptr
=
self
.eval_operand
(
cond
)
?
;
let
actual
=
self
.memory
.read_bool
(
actual_ptr
)
?
;
if
actual
==
expected
{
self
.frame_mut
()
.next_block
=
target
;
}
else
{
panic!
(
"unimplemented: jump to {:?} and print {:?}"
,
cleanup
,
msg
);
}
}
DropAndReplace
{
..
}
=>
unimplemented!
(),
Resume
=>
unimplemented!
(),
Unreachable
=>
unimplemented!
(),
}
Ok
(())
...
...
@@ -845,6 +861,8 @@ fn eval_assignment(&mut self, lvalue: &mir::Lvalue<'tcx>, rvalue: &mir::Rvalue<'
self
.memory
.write_primval
(
dest
,
val
)
?
;
}
CheckedBinaryOp
(
..
)
=>
unimplemented!
(),
UnaryOp
(
un_op
,
ref
operand
)
=>
{
let
ptr
=
self
.eval_operand
(
operand
)
?
;
let
ty
=
self
.operand_ty
(
operand
);
...
...
@@ -1018,7 +1036,6 @@ fn eval_assignment(&mut self, lvalue: &mir::Lvalue<'tcx>, rvalue: &mir::Rvalue<'
}
}
Slice
{
..
}
=>
unimplemented!
(),
InlineAsm
{
..
}
=>
unimplemented!
(),
}
...
...
@@ -1130,9 +1147,9 @@ fn eval_lvalue(&mut self, lvalue: &mir::Lvalue<'tcx>) -> EvalResult<Lvalue> {
let
ptr
=
match
*
lvalue
{
ReturnPointer
=>
self
.frame
()
.return_ptr
.expect
(
"ReturnPointer used in a function with no return value"
),
Arg
(
i
)
=>
self
.frame
()
.locals
[
i
as
usize
],
Var
(
i
)
=>
self
.frame
()
.locals
[
self
.frame
()
.var_offset
+
i
as
usize
],
Temp
(
i
)
=>
self
.frame
()
.locals
[
self
.frame
()
.temp_offset
+
i
as
usize
],
Arg
(
i
)
=>
self
.frame
()
.locals
[
i
.index
()
],
Var
(
i
)
=>
self
.frame
()
.locals
[
self
.frame
()
.var_offset
+
i
.index
()
],
Temp
(
i
)
=>
self
.frame
()
.locals
[
self
.frame
()
.temp_offset
+
i
.index
()
],
Static
(
def_id
)
=>
{
let
substs
=
self
.tcx
.mk_substs
(
subst
::
Substs
::
empty
());
...
...
@@ -1217,6 +1234,7 @@ fn eval_lvalue(&mut self, lvalue: &mir::Lvalue<'tcx>) -> EvalResult<Lvalue> {
}
ConstantIndex
{
..
}
=>
unimplemented!
(),
Subslice
{
..
}
=>
unimplemented!
(),
}
}
};
...
...
src/interpreter/stepper.rs
浏览文件 @
781c3a66
...
...
@@ -51,12 +51,12 @@ pub(super) fn step(&mut self) -> EvalResult<bool> {
let
block
=
self
.ecx
.frame
()
.next_block
;
let
stmt
=
self
.ecx
.frame
()
.stmt
;
let
mir
=
self
.ecx
.mir
();
let
basic_block
=
mir
.basic_block_data
(
block
)
;
let
basic_block
=
&
mir
.basic_blocks
()[
block
]
;
if
let
Some
(
ref
stmt
)
=
basic_block
.statements
.get
(
stmt
)
{
let
current_stack
=
self
.ecx.stack
.len
();
ConstantExtractor
{
span
:
stmt
.span
,
span
:
stmt
.s
ource_info.s
pan
,
substs
:
self
.ecx
.substs
(),
def_id
:
self
.ecx
.frame
()
.def_id
,
ecx
:
self
.ecx
,
...
...
@@ -75,7 +75,7 @@ pub(super) fn step(&mut self) -> EvalResult<bool> {
let
terminator
=
basic_block
.terminator
();
let
current_stack
=
self
.ecx.stack
.len
();
ConstantExtractor
{
span
:
terminator
.span
,
span
:
terminator
.s
ource_info.s
pan
,
substs
:
self
.ecx
.substs
(),
def_id
:
self
.ecx
.frame
()
.def_id
,
ecx
:
self
.ecx
,
...
...
src/lib.rs
浏览文件 @
781c3a66
...
...
@@ -11,6 +11,7 @@
// From rustc.
#[macro_use]
extern
crate
rustc
;
extern
crate
rustc_data_structures
;
extern
crate
rustc_mir
;
extern
crate
syntax
;
#[macro_use]
extern
crate
log
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录