Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
ab8d91dc
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,发现更多精彩内容 >>
提交
ab8d91dc
编写于
7月 26, 2011
作者:
M
Michael Sullivan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Make trand_bind_1 use create_real_fn_pair.
上级
73e8e498
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
11 addition
and
21 deletion
+11
-21
src/comp/middle/trans.rs
src/comp/middle/trans.rs
+11
-21
未找到文件。
src/comp/middle/trans.rs
浏览文件 @
ab8d91dc
...
...
@@ -4350,7 +4350,7 @@ fn t_kind(tcx: &ty::ctxt, t: ty::t) -> kind {
fn
trans_bind_thunk
(
cx
:
&@
local_ctxt
,
sp
:
&
span
,
incoming_fty
:
&
ty
::
t
,
outgoing_fty
:
&
ty
::
t
,
args
:
&
(
option
::
t
[
@
ast
::
expr
])[],
closure_ty
:
&
ty
::
t
,
bound_tys
:
&
ty
::
t
[],
ty_param_count
:
uint
)
->
ValueRef
{
ty_param_count
:
uint
)
->
{
val
:
ValueRef
,
ty
:
TypeRef
}
{
// Here we're not necessarily constructing a thunk in the sense of
// "function with no arguments". The result of compiling 'bind f(foo,
...
...
@@ -4520,7 +4520,7 @@ fn trans_bind_thunk(cx: &@local_ctxt, sp: &span, incoming_fty: &ty::t,
bcx
.build
.FastCall
(
lltargetfn
,
llargs
);
bcx
.build
.RetVoid
();
finish_fn
(
fcx
,
lltop
);
ret
llthunk
;
ret
{
val
:
llthunk
,
ty
:
llthunk_ty
}
;
}
fn
trans_bind
(
cx
:
&@
block_ctxt
,
f
:
&@
ast
::
expr
,
...
...
@@ -4552,15 +4552,13 @@ fn trans_bind_1(cx: &@block_ctxt, f: &@ast::expr, f_res: &lval_result,
lltydescs
=
ginfo
.tydescs
;
}
}
let
ty_param_count
=
std
::
ivec
::
len
[
ValueRef
](
lltydescs
);
if
std
::
ivec
::
len
[
@
ast
::
expr
](
bound
)
==
0u
&&
ty_param_count
==
0u
{
let
ty_param_count
=
std
::
ivec
::
len
(
lltydescs
);
if
std
::
ivec
::
len
(
bound
)
==
0u
&&
ty_param_count
==
0u
{
// Trivial 'binding': just return the static pair-ptr.
ret
f_res
.res
;
}
let
bcx
=
f_res
.res.bcx
;
let
pair_t
=
node_type
(
bcx_ccx
(
cx
),
cx
.sp
,
id
);
let
pair_v
=
alloca
(
bcx
,
pair_t
);
// Translate the bound expressions.
let
bound_tys
:
ty
::
t
[]
=
~
[];
...
...
@@ -4675,23 +4673,15 @@ fn trans_bind_1(cx: &@block_ctxt, f: &@ast::expr, f_res: &lval_result,
}
}
// Make thunk and store thunk-ptr in outer pair's code slot.
let
pair_code
=
bcx
.build
.GEP
(
pair_v
,
~
[
C_int
(
0
),
C_int
(
abi
::
fn_field_code
)]);
// Make thunk
// The type of the entire bind expression.
let
pair_ty
:
ty
::
t
=
node_id_type
(
bcx_ccx
(
cx
),
id
);
let
pair_ty
=
node_id_type
(
bcx_ccx
(
cx
),
id
);
let
llthunk
=
trans_bind_thunk
(
cx
.fcx.lcx
,
cx
.sp
,
pair_ty
,
outgoing_fty
,
args
,
closure_ty
,
bound_tys
,
ty_param_count
);
let
llthunk
:
ValueRef
=
trans_bind_thunk
(
cx
.fcx.lcx
,
cx
.sp
,
pair_ty
,
outgoing_fty
,
args
,
closure_ty
,
bound_tys
,
ty_param_count
);
bcx
.build
.Store
(
llthunk
,
pair_code
);
// Store box ptr in outer pair's box slot.
let
ccx
=
*
bcx_ccx
(
bcx
);
let
pair_box
=
bcx
.build
.GEP
(
pair_v
,
~
[
C_int
(
0
),
C_int
(
abi
::
fn_field_box
)]);
bcx
.build
.Store
(
bcx
.build
.PointerCast
(
box
,
T_opaque_closure_ptr
(
ccx
)),
pair_box
);
// Construct the function pair
let
pair_v
=
create_real_fn_pair
(
bcx
,
llthunk
.ty
,
llthunk
.val
,
box
);
add_clean_temp
(
cx
,
pair_v
,
pair_ty
);
ret
rslt
(
bcx
,
pair_v
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录