Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
c7bd3f69
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,发现更多精彩内容 >>
提交
c7bd3f69
编写于
9月 02, 2011
作者:
T
Tim Chevalier
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'graydon/master'
上级
07691e72
b5f90534
变更
7
展开全部
隐藏空白更改
内联
并排
Showing
7 changed file
with
248 addition
and
120 deletion
+248
-120
src/comp/middle/shape.rs
src/comp/middle/shape.rs
+9
-0
src/comp/middle/trans.rs
src/comp/middle/trans.rs
+196
-112
src/comp/middle/trans_alt.rs
src/comp/middle/trans_alt.rs
+3
-0
src/comp/middle/trans_common.rs
src/comp/middle/trans_common.rs
+4
-0
src/comp/middle/trans_objects.rs
src/comp/middle/trans_objects.rs
+6
-1
src/comp/middle/tstate/states.rs
src/comp/middle/tstate/states.rs
+17
-4
src/comp/middle/ty.rs
src/comp/middle/ty.rs
+13
-3
未找到文件。
src/comp/middle/shape.rs
浏览文件 @
c7bd3f69
...
...
@@ -126,6 +126,11 @@ fn largest_variants(ccx: &@crate_ctxt, tag_id: &ast::def_id) -> [uint] {
// when in fact it has minimum size sizeof(int).
bounded
=
false
;
}
else
{
// Could avoid this check: the constraint should
// follow from how elem_t doesn't contain params.
// (Could add a postcondition to type_contains_params,
// once we implement Issue #586.)
check
trans_common
::
type_has_static_size
(
ccx
,
elem_t
);
let
llty
=
trans
::
type_of
(
ccx
,
dummy_sp
(),
elem_t
);
min_size
+=
trans
::
llsize_of_real
(
ccx
,
llty
);
min_align
+=
trans
::
llalign_of_real
(
ccx
,
llty
);
...
...
@@ -201,6 +206,10 @@ fn compute_static_tag_size(ccx: &@crate_ctxt, largest_variants: &[uint],
// We increment a "virtual data pointer" to compute the size.
let
lltys
=
[];
for
typ
:
ty
::
t
in
variants
[
vid
]
.args
{
// FIXME: there should really be a postcondition
// on tag_variants that would obviate the need for
// this check. (Issue #586)
check
trans_common
::
type_has_static_size
(
ccx
,
typ
);
lltys
+=
[
trans
::
type_of
(
ccx
,
dummy_sp
(),
typ
)];
}
...
...
src/comp/middle/trans.rs
浏览文件 @
c7bd3f69
此差异已折叠。
点击以展开。
src/comp/middle/trans_alt.rs
浏览文件 @
c7bd3f69
...
...
@@ -563,6 +563,9 @@ fn bind_irrefutable_pat(bcx: @block_ctxt, pat: &@ast::pat, val: ValueRef,
ast
::
pat_bind
(
_
)
{
if
make_copy
{
let
ty
=
ty
::
node_id_to_monotype
(
ccx
.tcx
,
pat
.id
);
// FIXME: Could constrain pat_bind to make this
// check unnecessary.
check
type_has_static_size
(
ccx
,
ty
);
let
llty
=
trans
::
type_of
(
ccx
,
pat
.span
,
ty
);
let
alloc
=
trans
::
alloca
(
bcx
,
llty
);
bcx
=
trans
::
copy_val
(
bcx
,
trans
::
INIT
,
alloc
,
...
...
src/comp/middle/trans_common.rs
浏览文件 @
c7bd3f69
...
...
@@ -858,6 +858,10 @@ fn C_shape(ccx: &@crate_ctxt, bytes: &[u8]) -> ValueRef {
}
}
pure
fn
type_has_static_size
(
cx
:
&@
crate_ctxt
,
t
:
ty
::
t
)
->
bool
{
!
ty
::
type_has_dynamic_size
(
cx
.tcx
,
t
)
}
//
// Local Variables:
// mode: rust
...
...
src/comp/middle/trans_objects.rs
浏览文件 @
c7bd3f69
...
...
@@ -791,9 +791,14 @@ fn process_fwding_mthd(cx: @local_ctxt, sp: &span, m: @ty::method,
create_object_body_type
(
cx
.ccx.tcx
,
additional_field_tys
,
[],
some
(
inner_obj_ty
));
// And cast to that type.
// create_object_body_type maybe should have a postcondition...
let
cx_ccx
=
cx
.ccx
;
check
type_has_static_size
(
cx_ccx
,
body_ty
);
llself_obj_body
=
PointerCast
(
bcx
,
llself_obj_body
,
T_ptr
(
type_of
(
cx
.
ccx
,
sp
,
body_ty
)));
T_ptr
(
type_of
(
cx
_
ccx
,
sp
,
body_ty
)));
// Now, reach into the body and grab the inner_obj.
let
llinner_obj
=
...
...
src/comp/middle/tstate/states.rs
浏览文件 @
c7bd3f69
...
...
@@ -264,12 +264,25 @@ fn join_then_else(fcx: &fn_ctxt, antec: &@expr, conseq: &blk,
alt
maybe_alt
{
none
.
{
changed
|
=
find_pre_post_state_block
(
fcx
,
expr_poststate
(
fcx
.ccx
,
antec
),
conseq
)
|
alt
chk
{
if_check
.
{
let
c
:
sp_constr
=
expr_to_constr
(
fcx
.ccx.tcx
,
antec
);
let
conseq_prestate
=
tritv_clone
(
expr_poststate
(
fcx
.ccx
,
antec
));
tritv_set
(
bit_num
(
fcx
,
c
.node
),
conseq_prestate
,
ttrue
);
changed
|
=
find_pre_post_state_block
(
fcx
,
conseq_prestate
,
conseq
)
|
set_poststate_ann
(
fcx
.ccx
,
id
,
expr_poststate
(
fcx
.ccx
,
antec
));
}
}
_
{
changed
|
=
find_pre_post_state_block
(
fcx
,
expr_poststate
(
fcx
.ccx
,
antec
),
conseq
)
|
set_poststate_ann
(
fcx
.ccx
,
id
,
expr_poststate
(
fcx
.ccx
,
antec
));
}
}
}
some
(
altern
)
{
changed
|
=
find_pre_post_state_expr
(
fcx
,
expr_poststate
(
fcx
.ccx
,
antec
),
...
...
src/comp/middle/ty.rs
浏览文件 @
c7bd3f69
...
...
@@ -1132,13 +1132,23 @@ fn type_structurally_contains(cx: &ctxt, ty: t,
}
}
fn
type_has_dynamic_size
(
cx
:
&
ctxt
,
ty
:
t
)
->
bool
{
ret
type_structurally_contains
(
cx
,
ty
,
fn
(
sty
:
&
sty
)
->
bool
{
pure
fn
type_has_dynamic_size
(
cx
:
&
ctxt
,
ty
:
t
)
->
bool
{
/* type_structurally_contains can't be declared pure
because it takes a function argument. But it should be
referentially transparent, since a given type's size should
never change once it's created.
(It would be interesting to think about how to make such properties
actually checkable. It seems to me like a lot of properties
that the type context tracks about types should be immutable.)
*/
unchecked
{
type_structurally_contains
(
cx
,
ty
,
fn
(
sty
:
&
sty
)
->
bool
{
ret
alt
sty
{
ty_param
(
_
,
_
)
{
true
}
_
{
false
}
};
});
})
}
}
fn
type_is_integral
(
cx
:
&
ctxt
,
ty
:
t
)
->
bool
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录