Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
791dbaf5
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,发现更多精彩内容 >>
提交
791dbaf5
编写于
7月 26, 2017
作者:
R
Ralf Jung
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
disable validation code so that it all compiles against current nightly
上级
fdc70716
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
35 addition
and
11 deletion
+35
-11
src/librustc_mir/interpret/bin/miri.rs
src/librustc_mir/interpret/bin/miri.rs
+0
-1
src/librustc_mir/interpret/eval_context.rs
src/librustc_mir/interpret/eval_context.rs
+2
-0
src/librustc_mir/interpret/memory.rs
src/librustc_mir/interpret/memory.rs
+10
-0
src/librustc_mir/interpret/step.rs
src/librustc_mir/interpret/step.rs
+2
-9
src/librustc_mir/interpret/validation.rs
src/librustc_mir/interpret/validation.rs
+21
-1
未找到文件。
src/librustc_mir/interpret/bin/miri.rs
浏览文件 @
791dbaf5
...
...
@@ -202,7 +202,6 @@ fn main() {
// for auxilary builds in unit tests
args
.push
(
"-Zalways-encode-mir"
.to_owned
());
args
.push
(
"-Zmir-emit-validate"
.to_owned
());
rustc_driver
::
run_compiler
(
&
args
,
&
mut
MiriCompilerCalls
(
RustcDefaultCalls
),
None
,
None
);
}
src/librustc_mir/interpret/eval_context.rs
浏览文件 @
791dbaf5
...
...
@@ -31,6 +31,8 @@ pub struct EvalContext<'a, 'tcx: 'a> {
/// The virtual memory system.
pub
(
crate
)
memory
:
Memory
<
'a
,
'tcx
>
,
#[allow(dead_code)]
// FIXME(@RalfJung): validation branch
/// Lvalues that were suspended by the validation subsystem, and will be recovered later
pub
(
crate
)
suspended
:
HashMap
<
DynamicLifetime
,
Vec
<
ValidationQuery
<
'tcx
>>>
,
...
...
src/librustc_mir/interpret/memory.rs
浏览文件 @
791dbaf5
...
...
@@ -31,6 +31,8 @@ pub struct MemoryRange {
}
impl
MemoryRange
{
#[allow(dead_code)]
// FIXME(@RalfJung): validation branch
pub
fn
new
(
offset
:
u64
,
len
:
u64
)
->
MemoryRange
{
assert
!
(
len
>
0
);
MemoryRange
{
...
...
@@ -55,6 +57,8 @@ pub fn range(offset: u64, len: u64) -> ops::Range<MemoryRange> {
left
..
right
}
#[allow(dead_code)]
// FIXME(@RalfJung): validation branch
pub
fn
contained_in
(
&
self
,
offset
:
u64
,
len
:
u64
)
->
bool
{
assert
!
(
len
>
0
);
offset
<=
self
.start
&&
self
.end
<=
(
offset
+
len
)
...
...
@@ -135,6 +139,8 @@ fn iter_locks<'a>(&'a self, offset: u64, len: u64) -> impl Iterator<Item=(&'a Me
.filter
(
move
|
&
(
range
,
_
)|
range
.overlaps
(
offset
,
len
))
}
#[allow(dead_code)]
// FIXME(@RalfJung): validation branch
fn
iter_locks_mut
<
'a
>
(
&
'a
mut
self
,
offset
:
u64
,
len
:
u64
)
->
impl
Iterator
<
Item
=
(
&
'a
MemoryRange
,
&
'a
mut
LockInfo
)
>
+
'a
{
self
.locks
.range_mut
(
MemoryRange
::
range
(
offset
,
len
))
.filter
(
move
|
&
(
range
,
_
)|
range
.overlaps
(
offset
,
len
))
...
...
@@ -537,6 +543,8 @@ pub(crate) fn check_locks(&self, ptr: MemoryPointer, len: u64, access: AccessKin
.map_err
(|
lock
|
EvalError
::
MemoryLockViolation
{
ptr
,
len
,
frame
,
access
,
lock
})
}
#[allow(dead_code)]
// FIXME(@RalfJung): validation branch
/// Acquire the lock for the given lifetime
pub
(
crate
)
fn
acquire_lock
(
&
mut
self
,
ptr
:
MemoryPointer
,
len
:
u64
,
region
:
Option
<
CodeExtent
>
,
kind
:
AccessKind
)
->
EvalResult
<
'tcx
>
{
use
std
::
collections
::
btree_map
::
Entry
::
*
;
...
...
@@ -565,6 +573,8 @@ pub(crate) fn acquire_lock(&mut self, ptr: MemoryPointer, len: u64, region: Opti
Ok
(())
}
#[allow(dead_code)]
// FIXME(@RalfJung): validation branch
/// Release a write lock prematurely. If there's a read lock or someone else's lock, fail.
pub
(
crate
)
fn
release_write_lock
(
&
mut
self
,
ptr
:
MemoryPointer
,
len
:
u64
)
->
EvalResult
<
'tcx
>
{
assert
!
(
len
>
0
);
...
...
src/librustc_mir/interpret/step.rs
浏览文件 @
791dbaf5
...
...
@@ -128,15 +128,8 @@ fn statement(&mut self, stmt: &mir::Statement<'tcx>) -> EvalResult<'tcx> {
self
.deallocate_local
(
old_val
)
?
;
}
// Validity checks.
Validate
(
op
,
ref
lvalues
)
=>
{
for
operand
in
lvalues
{
self
.validation_op
(
op
,
operand
)
?
;
}
}
EndRegion
(
ce
)
=>
{
self
.end_region
(
ce
)
?
;
}
// NOPs for now.
EndRegion
(
_
ce
)
=>
{}
// Defined to do nothing. These are added by optimization passes, to avoid changing the
// size of MIR constantly.
...
...
src/librustc_mir/interpret/validation.rs
浏览文件 @
791dbaf5
// code for @RalfJung's validation branch is dead for now
#![allow(dead_code)]
use
rustc
::
hir
::
Mutability
;
use
rustc
::
hir
::
Mutability
::
*
;
use
rustc
::
mir
::{
self
,
ValidationOp
,
ValidationOperand
}
;
use
rustc
::
mir
;
use
rustc
::
ty
::{
self
,
Ty
,
TypeFoldable
};
use
rustc
::
ty
::
subst
::
Subst
;
use
rustc
::
traits
::
Reveal
;
...
...
@@ -13,6 +16,23 @@
use
value
::{
PrimVal
,
Value
};
use
lvalue
::{
Lvalue
,
LvalueExtra
};
// FIXME remove this once it lands in rustc
#[derive(Copy,
Clone,
PartialEq,
Eq)]
pub
enum
ValidationOp
{
Acquire
,
Release
,
Suspend
(
CodeExtent
),
}
#[derive(Clone,
Debug)]
pub
struct
ValidationOperand
<
'tcx
,
T
>
{
pub
lval
:
T
,
pub
ty
:
Ty
<
'tcx
>
,
pub
re
:
Option
<
CodeExtent
>
,
pub
mutbl
:
Mutability
,
}
// FIXME end
pub
type
ValidationQuery
<
'tcx
>
=
ValidationOperand
<
'tcx
,
Lvalue
<
'tcx
>>
;
#[derive(Copy,
Clone,
Debug)]
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录