resurrect tps_fn() and put it to use this time.

This commit is contained in:
Niko Matsakis 2011-12-14 21:02:47 -08:00
parent 7694689044
commit d381cc072a
2 changed files with 5 additions and 3 deletions

View File

@ -937,7 +937,7 @@ fn trans_stack_local_derived_tydesc(cx: @block_ctxt, llsz: ValueRef,
// Objects and closures store their type parameters differently (in the object
// or closure itself rather than in the type descriptor).
tag ty_param_storage { tps_normal; tps_obj(uint); }
tag ty_param_storage { tps_normal; tps_obj(uint); tps_fn(uint); }
fn get_derived_tydesc(cx: @block_ctxt, t: ty::t, escapes: bool,
storage: ty_param_storage,
@ -958,7 +958,7 @@ fn get_derived_tydesc(cx: @block_ctxt, t: ty::t, escapes: bool,
let is_obj_body;
alt storage {
tps_normal. { is_obj_body = false; }
tps_obj(_) { is_obj_body = true; }
tps_obj(_) | tps_fn(_) { is_obj_body = true; }
}
bcx_ccx(cx).stats.n_derived_tydescs += 1u;
@ -1006,6 +1006,7 @@ fn get_derived_tydesc(cx: @block_ctxt, t: ty::t, escapes: bool,
alt storage {
tps_normal. { obj_params = 0u; }
tps_obj(np) { obj_params = np; }
tps_fn(np) { obj_params = 0x80000000u | np; }
}
let v;

View File

@ -131,8 +131,9 @@ fn build_environment(bcx: @block_ctxt, lltydescs: [ValueRef],
for_closure. | for_send. {
let bound_tydesc = GEPi(bcx, closure, [0, abi::closure_elt_tydesc]);
let ti = none;
let tps = tps_fn(vec::len(lltydescs));
let {result:bindings_tydesc, _} =
trans::get_tydesc(bcx, bindings_ty, true, trans::tps_normal, ti);
trans::get_tydesc(bcx, bindings_ty, true, tps, ti);
trans::lazily_emit_tydesc_glue(bcx, abi::tydesc_field_drop_glue, ti);
trans::lazily_emit_tydesc_glue(bcx, abi::tydesc_field_free_glue, ti);
bcx = bindings_tydesc.bcx;