Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
24be49f7
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,发现更多精彩内容 >>
未验证
提交
24be49f7
编写于
10月 21, 2016
作者:
O
Oliver Schneider
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add a 'tcx lifetime to Lvalue in preparation for statics
上级
ed679c3d
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
17 addition
and
17 deletion
+17
-17
src/interpreter/mod.rs
src/interpreter/mod.rs
+14
-14
src/interpreter/terminator/intrinsics.rs
src/interpreter/terminator/intrinsics.rs
+1
-1
src/interpreter/terminator/mod.rs
src/interpreter/terminator/mod.rs
+2
-2
未找到文件。
src/interpreter/mod.rs
浏览文件 @
24be49f7
...
@@ -77,7 +77,7 @@ pub struct Frame<'a, 'tcx: 'a> {
...
@@ -77,7 +77,7 @@ pub struct Frame<'a, 'tcx: 'a> {
pub
return_to_block
:
StackPopCleanup
,
pub
return_to_block
:
StackPopCleanup
,
/// The location where the result of the current stack frame should be written to.
/// The location where the result of the current stack frame should be written to.
pub
return_lvalue
:
Lvalue
,
pub
return_lvalue
:
Lvalue
<
'tcx
>
,
/// The list of locals for this stack frame, stored in order as
/// The list of locals for this stack frame, stored in order as
/// `[arguments..., variables..., temporaries...]`. The locals are stored as `Value`s, which
/// `[arguments..., variables..., temporaries...]`. The locals are stored as `Value`s, which
...
@@ -99,7 +99,7 @@ pub struct Frame<'a, 'tcx: 'a> {
...
@@ -99,7 +99,7 @@ pub struct Frame<'a, 'tcx: 'a> {
}
}
#[derive(Copy,
Clone,
Debug,
Eq,
PartialEq)]
#[derive(Copy,
Clone,
Debug,
Eq,
PartialEq)]
pub
enum
Lvalue
{
pub
enum
Lvalue
<
'tcx
>
{
/// An lvalue referring to a value allocated in the `Memory` system.
/// An lvalue referring to a value allocated in the `Memory` system.
Ptr
{
Ptr
{
ptr
:
Pointer
,
ptr
:
Pointer
,
...
@@ -347,7 +347,7 @@ pub fn push_stack_frame(
...
@@ -347,7 +347,7 @@ pub fn push_stack_frame(
span
:
codemap
::
Span
,
span
:
codemap
::
Span
,
mir
:
CachedMir
<
'a
,
'tcx
>
,
mir
:
CachedMir
<
'a
,
'tcx
>
,
substs
:
&
'tcx
Substs
<
'tcx
>
,
substs
:
&
'tcx
Substs
<
'tcx
>
,
return_lvalue
:
Lvalue
,
return_lvalue
:
Lvalue
<
'tcx
>
,
return_to_block
:
StackPopCleanup
,
return_to_block
:
StackPopCleanup
,
)
->
EvalResult
<
'tcx
,
()
>
{
)
->
EvalResult
<
'tcx
,
()
>
{
::
log_settings
::
settings
()
.indentation
+=
1
;
::
log_settings
::
settings
()
.indentation
+=
1
;
...
@@ -406,7 +406,7 @@ fn intrinsic_with_overflow(
...
@@ -406,7 +406,7 @@ fn intrinsic_with_overflow(
op
:
mir
::
BinOp
,
op
:
mir
::
BinOp
,
left
:
&
mir
::
Operand
<
'tcx
>
,
left
:
&
mir
::
Operand
<
'tcx
>
,
right
:
&
mir
::
Operand
<
'tcx
>
,
right
:
&
mir
::
Operand
<
'tcx
>
,
dest
:
Lvalue
,
dest
:
Lvalue
<
'tcx
>
,
dest_ty
:
Ty
<
'tcx
>
,
dest_ty
:
Ty
<
'tcx
>
,
)
->
EvalResult
<
'tcx
,
()
>
{
)
->
EvalResult
<
'tcx
,
()
>
{
let
(
val
,
overflowed
)
=
self
.binop_with_overflow
(
op
,
left
,
right
)
?
;
let
(
val
,
overflowed
)
=
self
.binop_with_overflow
(
op
,
left
,
right
)
?
;
...
@@ -421,7 +421,7 @@ fn intrinsic_overflowing(
...
@@ -421,7 +421,7 @@ fn intrinsic_overflowing(
op
:
mir
::
BinOp
,
op
:
mir
::
BinOp
,
left
:
&
mir
::
Operand
<
'tcx
>
,
left
:
&
mir
::
Operand
<
'tcx
>
,
right
:
&
mir
::
Operand
<
'tcx
>
,
right
:
&
mir
::
Operand
<
'tcx
>
,
dest
:
Lvalue
,
dest
:
Lvalue
<
'tcx
>
,
)
->
EvalResult
<
'tcx
,
bool
>
{
)
->
EvalResult
<
'tcx
,
bool
>
{
let
(
val
,
overflowed
)
=
self
.binop_with_overflow
(
op
,
left
,
right
)
?
;
let
(
val
,
overflowed
)
=
self
.binop_with_overflow
(
op
,
left
,
right
)
?
;
self
.write_primval
(
dest
,
val
)
?
;
self
.write_primval
(
dest
,
val
)
?
;
...
@@ -430,7 +430,7 @@ fn intrinsic_overflowing(
...
@@ -430,7 +430,7 @@ fn intrinsic_overflowing(
fn
assign_fields
<
I
:
IntoIterator
<
Item
=
u64
>>
(
fn
assign_fields
<
I
:
IntoIterator
<
Item
=
u64
>>
(
&
mut
self
,
&
mut
self
,
dest
:
Lvalue
,
dest
:
Lvalue
<
'tcx
>
,
offsets
:
I
,
offsets
:
I
,
operands
:
&
[
mir
::
Operand
<
'tcx
>
],
operands
:
&
[
mir
::
Operand
<
'tcx
>
],
)
->
EvalResult
<
'tcx
,
()
>
{
)
->
EvalResult
<
'tcx
,
()
>
{
...
@@ -863,7 +863,7 @@ fn eval_and_read_lvalue(&mut self, lvalue: &mir::Lvalue<'tcx>) -> EvalResult<'tc
...
@@ -863,7 +863,7 @@ fn eval_and_read_lvalue(&mut self, lvalue: &mir::Lvalue<'tcx>) -> EvalResult<'tc
}
}
}
}
fn
eval_lvalue
(
&
mut
self
,
mir_lvalue
:
&
mir
::
Lvalue
<
'tcx
>
)
->
EvalResult
<
'tcx
,
Lvalue
>
{
fn
eval_lvalue
(
&
mut
self
,
mir_lvalue
:
&
mir
::
Lvalue
<
'tcx
>
)
->
EvalResult
<
'tcx
,
Lvalue
<
'tcx
>
>
{
use
rustc
::
mir
::
repr
::
Lvalue
::
*
;
use
rustc
::
mir
::
repr
::
Lvalue
::
*
;
let
lvalue
=
match
*
mir_lvalue
{
let
lvalue
=
match
*
mir_lvalue
{
Local
(
mir
::
RETURN_POINTER
)
=>
self
.frame
()
.return_lvalue
,
Local
(
mir
::
RETURN_POINTER
)
=>
self
.frame
()
.return_lvalue
,
...
@@ -900,7 +900,7 @@ fn eval_lvalue(&mut self, mir_lvalue: &mir::Lvalue<'tcx>) -> EvalResult<'tcx, Lv
...
@@ -900,7 +900,7 @@ fn eval_lvalue(&mut self, mir_lvalue: &mir::Lvalue<'tcx>) -> EvalResult<'tcx, Lv
fn
eval_lvalue_projection
(
fn
eval_lvalue_projection
(
&
mut
self
,
&
mut
self
,
proj
:
&
mir
::
LvalueProjection
<
'tcx
>
,
proj
:
&
mir
::
LvalueProjection
<
'tcx
>
,
)
->
EvalResult
<
'tcx
,
Lvalue
>
{
)
->
EvalResult
<
'tcx
,
Lvalue
<
'tcx
>
>
{
let
base
=
self
.eval_lvalue
(
&
proj
.base
)
?
;
let
base
=
self
.eval_lvalue
(
&
proj
.base
)
?
;
let
base_ty
=
self
.lvalue_ty
(
&
proj
.base
);
let
base_ty
=
self
.lvalue_ty
(
&
proj
.base
);
let
base_layout
=
self
.type_layout
(
base_ty
);
let
base_layout
=
self
.type_layout
(
base_ty
);
...
@@ -1071,7 +1071,7 @@ fn copy(&mut self, src: Pointer, dest: Pointer, ty: Ty<'tcx>) -> EvalResult<'tcx
...
@@ -1071,7 +1071,7 @@ fn copy(&mut self, src: Pointer, dest: Pointer, ty: Ty<'tcx>) -> EvalResult<'tcx
Ok
(())
Ok
(())
}
}
fn
force_allocation
(
&
mut
self
,
lvalue
:
Lvalue
)
->
EvalResult
<
'tcx
,
Lvalue
>
{
fn
force_allocation
(
&
mut
self
,
lvalue
:
Lvalue
<
'tcx
>
)
->
EvalResult
<
'tcx
,
Lvalue
<
'tcx
>
>
{
let
new_lvalue
=
match
lvalue
{
let
new_lvalue
=
match
lvalue
{
Lvalue
::
Local
{
frame
,
local
}
=>
{
Lvalue
::
Local
{
frame
,
local
}
=>
{
let
ptr
=
match
self
.stack
[
frame
]
.get_local
(
local
)
{
let
ptr
=
match
self
.stack
[
frame
]
.get_local
(
local
)
{
...
@@ -1157,7 +1157,7 @@ fn value_to_primval(&mut self, value: Value, ty: Ty<'tcx>) -> EvalResult<'tcx, P
...
@@ -1157,7 +1157,7 @@ fn value_to_primval(&mut self, value: Value, ty: Ty<'tcx>) -> EvalResult<'tcx, P
fn
write_primval
(
fn
write_primval
(
&
mut
self
,
&
mut
self
,
dest
:
Lvalue
,
dest
:
Lvalue
<
'tcx
>
,
val
:
PrimVal
,
val
:
PrimVal
,
)
->
EvalResult
<
'tcx
,
()
>
{
)
->
EvalResult
<
'tcx
,
()
>
{
match
dest
{
match
dest
{
...
@@ -1175,7 +1175,7 @@ fn write_primval(
...
@@ -1175,7 +1175,7 @@ fn write_primval(
fn
write_value
(
fn
write_value
(
&
mut
self
,
&
mut
self
,
src_val
:
Value
,
src_val
:
Value
,
dest
:
Lvalue
,
dest
:
Lvalue
<
'tcx
>
,
dest_ty
:
Ty
<
'tcx
>
,
dest_ty
:
Ty
<
'tcx
>
,
)
->
EvalResult
<
'tcx
,
()
>
{
)
->
EvalResult
<
'tcx
,
()
>
{
match
dest
{
match
dest
{
...
@@ -1441,7 +1441,7 @@ fn unsize_into(
...
@@ -1441,7 +1441,7 @@ fn unsize_into(
Ok
(())
Ok
(())
}
}
fn
dump_local
(
&
self
,
lvalue
:
Lvalue
)
{
fn
dump_local
(
&
self
,
lvalue
:
Lvalue
<
'tcx
>
)
{
if
let
Lvalue
::
Local
{
frame
,
local
}
=
lvalue
{
if
let
Lvalue
::
Local
{
frame
,
local
}
=
lvalue
{
if
let
Some
(
val
)
=
self
.stack
[
frame
]
.get_local
(
local
)
{
if
let
Some
(
val
)
=
self
.stack
[
frame
]
.get_local
(
local
)
{
match
val
{
match
val
{
...
@@ -1473,7 +1473,7 @@ fn set_local(&mut self, local: mir::Local, value: Value) {
...
@@ -1473,7 +1473,7 @@ fn set_local(&mut self, local: mir::Local, value: Value) {
}
}
}
}
impl
Lvalue
{
impl
<
'tcx
>
Lvalue
<
'tcx
>
{
pub
fn
from_ptr
(
ptr
:
Pointer
)
->
Self
{
pub
fn
from_ptr
(
ptr
:
Pointer
)
->
Self
{
Lvalue
::
Ptr
{
ptr
:
ptr
,
extra
:
LvalueExtra
::
None
}
Lvalue
::
Ptr
{
ptr
:
ptr
,
extra
:
LvalueExtra
::
None
}
}
}
...
@@ -1492,7 +1492,7 @@ fn to_ptr(self) -> Pointer {
...
@@ -1492,7 +1492,7 @@ fn to_ptr(self) -> Pointer {
ptr
ptr
}
}
fn
elem_ty_and_len
<
'tcx
>
(
self
,
ty
:
Ty
<
'tcx
>
)
->
(
Ty
<
'tcx
>
,
u64
)
{
fn
elem_ty_and_len
(
self
,
ty
:
Ty
<
'tcx
>
)
->
(
Ty
<
'tcx
>
,
u64
)
{
match
ty
.sty
{
match
ty
.sty
{
ty
::
TyArray
(
elem
,
n
)
=>
(
elem
,
n
as
u64
),
ty
::
TyArray
(
elem
,
n
)
=>
(
elem
,
n
as
u64
),
...
...
src/interpreter/terminator/intrinsics.rs
浏览文件 @
24be49f7
...
@@ -15,7 +15,7 @@ pub(super) fn call_intrinsic(
...
@@ -15,7 +15,7 @@ pub(super) fn call_intrinsic(
def_id
:
DefId
,
def_id
:
DefId
,
substs
:
&
'tcx
Substs
<
'tcx
>
,
substs
:
&
'tcx
Substs
<
'tcx
>
,
args
:
&
[
mir
::
Operand
<
'tcx
>
],
args
:
&
[
mir
::
Operand
<
'tcx
>
],
dest
:
Lvalue
,
dest
:
Lvalue
<
'tcx
>
,
dest_ty
:
Ty
<
'tcx
>
,
dest_ty
:
Ty
<
'tcx
>
,
dest_layout
:
&
'tcx
Layout
,
dest_layout
:
&
'tcx
Layout
,
)
->
EvalResult
<
'tcx
,
()
>
{
)
->
EvalResult
<
'tcx
,
()
>
{
...
...
src/interpreter/terminator/mod.rs
浏览文件 @
24be49f7
...
@@ -150,7 +150,7 @@ fn eval_fn_call(
...
@@ -150,7 +150,7 @@ fn eval_fn_call(
def_id
:
DefId
,
def_id
:
DefId
,
substs
:
&
'tcx
Substs
<
'tcx
>
,
substs
:
&
'tcx
Substs
<
'tcx
>
,
fn_ty
:
&
'tcx
BareFnTy
,
fn_ty
:
&
'tcx
BareFnTy
,
destination
:
Option
<
(
Lvalue
,
mir
::
BasicBlock
)
>
,
destination
:
Option
<
(
Lvalue
<
'tcx
>
,
mir
::
BasicBlock
)
>
,
arg_operands
:
&
[
mir
::
Operand
<
'tcx
>
],
arg_operands
:
&
[
mir
::
Operand
<
'tcx
>
],
span
:
Span
,
span
:
Span
,
)
->
EvalResult
<
'tcx
,
()
>
{
)
->
EvalResult
<
'tcx
,
()
>
{
...
@@ -264,7 +264,7 @@ fn call_c_abi(
...
@@ -264,7 +264,7 @@ fn call_c_abi(
&
mut
self
,
&
mut
self
,
def_id
:
DefId
,
def_id
:
DefId
,
args
:
&
[
mir
::
Operand
<
'tcx
>
],
args
:
&
[
mir
::
Operand
<
'tcx
>
],
dest
:
Lvalue
,
dest
:
Lvalue
<
'tcx
>
,
dest_size
:
usize
,
dest_size
:
usize
,
)
->
EvalResult
<
'tcx
,
()
>
{
)
->
EvalResult
<
'tcx
,
()
>
{
let
name
=
self
.tcx
.item_name
(
def_id
);
let
name
=
self
.tcx
.item_name
(
def_id
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录