Skip to content

Commit aa88d00

Browse files
committed
---
yaml --- r: 4877 b: refs/heads/master c: c930af7 h: refs/heads/master i: 4875: a06a05b v: v3
1 parent 8172669 commit aa88d00

File tree

2 files changed

+41
-2
lines changed

2 files changed

+41
-2
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: cd5e4c21ee1355603bea8c6b478678a51b45b277
2+
refs/heads/master: c930af74d5ad02cee4a540b0d0a91b12b3d6e58c

trunk/src/comp/middle/trans.rs

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1186,7 +1186,7 @@ fn make_generic_glue_inner(cx: &@local_ctxt, sp: &span, t: &ty::t,
11861186
helper(bcx, llval0, t);
11871187
}
11881188
copy_helper(helper) {
1189-
let llrawptr1 = llvm::LLVMGetParam(llfn, 4u);
1189+
let llrawptr1 = llvm::LLVMGetParam(llfn, 5u);
11901190
let llval1 = bcx.build.BitCast(llrawptr1, llty);
11911191
helper(bcx, llval0, llval1, t);
11921192
}
@@ -2178,6 +2178,45 @@ fn call_cmp_glue(cx: &@block_ctxt, lhs: ValueRef, rhs: ValueRef, t: &ty::t,
21782178
ret rslt(r.bcx, r.bcx.build.Load(llcmpresultptr));
21792179
}
21802180

2181+
fn call_copy_glue(cx: &@block_ctxt, dst: ValueRef, src: ValueRef, t: &ty::t,
2182+
take: bool) -> @block_ctxt {
2183+
// You can't call this on immediate types. Those are simply copied with
2184+
// Load/Store.
2185+
assert !type_is_immediate(bcx_ccx(cx), t);
2186+
let srcptr = cx.build.BitCast(src, T_ptr(T_i8()));
2187+
let dstptr = cx.build.BitCast(dst, T_ptr(T_i8()));
2188+
let ti = none;
2189+
let {bcx, val: lltydesc} = get_tydesc(cx, t, false, ti).result;
2190+
lazily_emit_tydesc_glue(cx, abi::tydesc_field_copy_glue, ti);
2191+
let lltydescs = bcx.build.GEP
2192+
(lltydesc, [C_int(0), C_int(abi::tydesc_field_first_param)]);
2193+
lltydescs = bcx.build.Load(lltydescs);
2194+
2195+
let llfn = alt ti {
2196+
none. {
2197+
bcx.build.Load(bcx.build.GEP
2198+
(lltydesc, [C_int(0), C_int(abi::tydesc_field_copy_glue)]))
2199+
}
2200+
some(sti) { option::get(sti.copy_glue) }
2201+
};
2202+
bcx.build.Call(llfn, [C_null(T_ptr(T_nil())), bcx.fcx.lltaskptr,
2203+
C_null(T_ptr(T_nil())), lltydescs, srcptr, dstptr]);
2204+
if take {
2205+
lazily_emit_tydesc_glue(cx, abi::tydesc_field_take_glue, ti);
2206+
llfn = alt ti {
2207+
none. {
2208+
bcx.build.Load(bcx.build.GEP
2209+
(lltydesc, [C_int(0), C_int(abi::tydesc_field_take_glue)]))
2210+
}
2211+
some(sti) { option::get(sti.take_glue) }
2212+
};
2213+
bcx.build.Call(llfn, [C_null(T_ptr(T_nil())), bcx.fcx.lltaskptr,
2214+
C_null(T_ptr(T_nil())), lltydescs, dstptr]);
2215+
}
2216+
ret bcx;
2217+
}
2218+
2219+
21812220
// Compares two values. Performs the simple scalar comparison if the types are
21822221
// scalar and calls to comparison glue otherwise.
21832222
fn compare(cx: &@block_ctxt, lhs: ValueRef, rhs: ValueRef, t: &ty::t,

0 commit comments

Comments
 (0)