Skip to content

Commit 27b4c3f

Browse files
committed
Whitespace cleanup, and copy target into closure.
1 parent fb8eff9 commit 27b4c3f

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

src/comp/middle/trans.rs

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1990,8 +1990,7 @@ impure fn trans_bind(@block_ctxt cx, @ast.expr f,
19901990

19911991
// Synthesize a closure type.
19921992
let @ty.t bindings_ty = ty.plain_ty(ty.ty_tup(bound_tys));
1993-
let TypeRef llbindings_ty = type_of(bcx.fcx.ccx,
1994-
bindings_ty);
1993+
let TypeRef llbindings_ty = type_of(bcx.fcx.ccx, bindings_ty);
19951994
let TypeRef llclosure_ty =
19961995
T_ptr(T_box(T_struct(vec(T_ptr(T_tydesc()),
19971996
type_of(bcx.fcx.ccx,
@@ -2013,23 +2012,27 @@ impure fn trans_bind(@block_ctxt cx, @ast.expr f,
20132012
C_int(abi.box_rc_field_body)));
20142013
bcx.build.Store(C_int(1), rc);
20152014

2016-
20172015
// Store bindings tydesc.
20182016
auto bound_tydesc =
20192017
bcx.build.GEP(closure,
20202018
vec(C_int(0),
20212019
C_int(abi.closure_elt_tydesc)));
2022-
20232020
auto bindings_tydesc = get_tydesc(bcx, bindings_ty);
20242021
bcx.build.Store(bindings_tydesc, bound_tydesc);
20252022

2026-
// Copy args into body fields.
2027-
auto bindings =
2023+
// Store thunk-target.
2024+
auto bound_target =
20282025
bcx.build.GEP(closure,
20292026
vec(C_int(0),
2030-
C_int(abi.closure_elt_bindings)));
2027+
C_int(abi.closure_elt_target)));
2028+
bcx.build.Store(bcx.build.Load(f_res.res.val), bound_target);
20312029

2030+
// Copy expr values into boxed bindings.
20322031
let int i = 0;
2032+
auto bindings =
2033+
bcx.build.GEP(closure,
2034+
vec(C_int(0),
2035+
C_int(abi.closure_elt_bindings)));
20332036
for (ValueRef v in bound_vals) {
20342037
auto bound = bcx.build.GEP(bindings,
20352038
vec(C_int(0),C_int(i)));

0 commit comments

Comments
 (0)