Skip to content

Commit 2227f55

Browse files
committed
---
yaml --- r: 13449 b: refs/heads/master c: bdd2000 h: refs/heads/master i: 13447: c99f827 v: v3
1 parent 7724986 commit 2227f55

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 920ea63f53bbbe46cdcbaead12720871b5fb00b9
2+
refs/heads/master: bdd20000665a35e14b4ec2c54f893fc80fe451ef
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 4a81779abd786ff22d71434c6d9a5917ea4cdfff
55
refs/heads/try: 2898dcc5d97da9427ac367542382b6239d9c0bbf

trunk/src/rustc/middle/trans/tvec.rs

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -69,18 +69,15 @@ fn alloc_uniq(bcx: block, unit_ty: ty::t, elts: uint) -> result {
6969

7070
fn duplicate_uniq(bcx: block, vptr: ValueRef, vec_ty: ty::t) -> result {
7171
let _icx = bcx.insn_ctxt("tvec::duplicate_uniq");
72-
let ccx = bcx.ccx();
73-
let body_ptr = get_bodyptr(bcx, vptr);
74-
let fill = get_fill(bcx, body_ptr);
75-
let size = Add(bcx, fill, llsize_of(ccx, ccx.opaque_vec_type));
7672

73+
let fill = get_fill(bcx, get_bodyptr(bcx, vptr));
7774
let unit_ty = ty::sequence_element_type(bcx.tcx(), vec_ty);
78-
let vecbodyty = ty::mk_mut_unboxed_vec(bcx.tcx(), unit_ty);
79-
let {box: newptr, body: new_body_ptr} =
80-
base::malloc_unique_dyn(bcx, vecbodyty, size);
81-
call_memmove(bcx, new_body_ptr, body_ptr, size);
75+
let {bcx, val: newptr} = alloc_uniq_raw(bcx, unit_ty, fill, fill);
76+
77+
let data_ptr = get_dataptr(bcx, get_bodyptr(bcx, vptr));
78+
let new_data_ptr = get_dataptr(bcx, get_bodyptr(bcx, newptr));
79+
call_memmove(bcx, new_data_ptr, data_ptr, fill);
8280

83-
Store(bcx, fill, GEPi(bcx, new_body_ptr, [0u, abi::vec_elt_alloc]));
8481
let bcx = if ty::type_needs_drop(bcx.tcx(), unit_ty) {
8582
iter_vec(bcx, newptr, vec_ty, base::take_ty)
8683
} else { bcx };

0 commit comments

Comments
 (0)