Skip to content

Commit d381cc0

Browse files
committed
resurrect tps_fn() and put it to use this time.
1 parent 7694689 commit d381cc0

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/comp/middle/trans.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -937,7 +937,7 @@ fn trans_stack_local_derived_tydesc(cx: @block_ctxt, llsz: ValueRef,
937937

938938
// Objects and closures store their type parameters differently (in the object
939939
// or closure itself rather than in the type descriptor).
940-
tag ty_param_storage { tps_normal; tps_obj(uint); }
940+
tag ty_param_storage { tps_normal; tps_obj(uint); tps_fn(uint); }
941941

942942
fn get_derived_tydesc(cx: @block_ctxt, t: ty::t, escapes: bool,
943943
storage: ty_param_storage,
@@ -958,7 +958,7 @@ fn get_derived_tydesc(cx: @block_ctxt, t: ty::t, escapes: bool,
958958
let is_obj_body;
959959
alt storage {
960960
tps_normal. { is_obj_body = false; }
961-
tps_obj(_) { is_obj_body = true; }
961+
tps_obj(_) | tps_fn(_) { is_obj_body = true; }
962962
}
963963

964964
bcx_ccx(cx).stats.n_derived_tydescs += 1u;
@@ -1006,6 +1006,7 @@ fn get_derived_tydesc(cx: @block_ctxt, t: ty::t, escapes: bool,
10061006
alt storage {
10071007
tps_normal. { obj_params = 0u; }
10081008
tps_obj(np) { obj_params = np; }
1009+
tps_fn(np) { obj_params = 0x80000000u | np; }
10091010
}
10101011

10111012
let v;

src/comp/middle/trans_closure.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,9 @@ fn build_environment(bcx: @block_ctxt, lltydescs: [ValueRef],
131131
for_closure. | for_send. {
132132
let bound_tydesc = GEPi(bcx, closure, [0, abi::closure_elt_tydesc]);
133133
let ti = none;
134+
let tps = tps_fn(vec::len(lltydescs));
134135
let {result:bindings_tydesc, _} =
135-
trans::get_tydesc(bcx, bindings_ty, true, trans::tps_normal, ti);
136+
trans::get_tydesc(bcx, bindings_ty, true, tps, ti);
136137
trans::lazily_emit_tydesc_glue(bcx, abi::tydesc_field_drop_glue, ti);
137138
trans::lazily_emit_tydesc_glue(bcx, abi::tydesc_field_free_glue, ti);
138139
bcx = bindings_tydesc.bcx;

0 commit comments

Comments
 (0)