rustc: Make unique closures use the new unique allocator
This commit is contained in:
parent
654f7e3086
commit
c6a23cddfb
@ -179,10 +179,7 @@ fn allocate_cbox(bcx: block,
|
||||
(bcx, box)
|
||||
}
|
||||
ty::ck_uniq {
|
||||
let uniq_cbox_ty = mk_tuplified_uniq_cbox_ty(tcx, cdata_ty);
|
||||
let box = uniq::alloc_uniq(bcx, uniq_cbox_ty);
|
||||
nuke_ref_count(bcx, box);
|
||||
let bcx = store_tydesc(bcx, cdata_ty, box, ti);
|
||||
let box = malloc_unique_raw(bcx, cdata_ty);
|
||||
(bcx, box)
|
||||
}
|
||||
ty::ck_block {
|
||||
@ -606,7 +603,7 @@ fn make_opaque_cbox_free_glue(
|
||||
ty::ck_box | ty::ck_uniq { /* hard cases: */ }
|
||||
}
|
||||
|
||||
let ccx = bcx.ccx(), tcx = ccx.tcx;
|
||||
let ccx = bcx.ccx();
|
||||
with_cond(bcx, IsNotNull(bcx, cbox)) {|bcx|
|
||||
// Load the type descr found in the cbox
|
||||
let lltydescty = T_ptr(ccx.tydesc_type);
|
||||
@ -628,8 +625,7 @@ fn make_opaque_cbox_free_glue(
|
||||
trans_free(bcx, cbox)
|
||||
}
|
||||
ty::ck_uniq {
|
||||
let bcx = free_ty(bcx, tydesc, ty::mk_type(tcx));
|
||||
trans_shared_free(bcx, cbox)
|
||||
trans_unique_free(bcx, cbox)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ import build::*;
|
||||
import base::*;
|
||||
import shape::llsize_of;
|
||||
|
||||
export trans_uniq, make_free_glue, autoderef, duplicate, alloc_uniq;
|
||||
export trans_uniq, make_free_glue, autoderef, duplicate;
|
||||
|
||||
fn trans_uniq(bcx: block, contents: @ast::expr,
|
||||
node_id: ast::node_id, dest: dest) -> block {
|
||||
@ -19,15 +19,6 @@ fn trans_uniq(bcx: block, contents: @ast::expr,
|
||||
ret store_in_dest(bcx, box, dest);
|
||||
}
|
||||
|
||||
fn alloc_uniq(bcx: block, uniq_ty: ty::t) -> ValueRef {
|
||||
let _icx = bcx.insn_ctxt("uniq::alloc_uniq");
|
||||
let contents_ty = content_ty(uniq_ty);
|
||||
let llty = type_of::type_of(bcx.ccx(), contents_ty);
|
||||
let llsz = llsize_of(bcx.ccx(), llty);
|
||||
let llptrty = T_ptr(llty);
|
||||
shared_malloc(bcx, llptrty, llsz)
|
||||
}
|
||||
|
||||
fn make_free_glue(bcx: block, vptr: ValueRef, t: ty::t)
|
||||
-> block {
|
||||
let _icx = bcx.insn_ctxt("uniq::make_free_glue");
|
||||
|
Loading…
x
Reference in New Issue
Block a user