Skip to content

Commit f1390eb

Browse files
committed
---
yaml --- r: 141268 b: refs/heads/try2 c: 58d6864 h: refs/heads/master v: v3
1 parent 5265624 commit f1390eb

File tree

5 files changed

+12
-15
lines changed

5 files changed

+12
-15
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: f6023a01d43557b45dda550ef50d689877b87226
8+
refs/heads/try2: 58d6864ad700d9972b57824eed758c9b71e465d8
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/src/librustc/middle/trans/base.rs

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ use middle::trans::foreign;
5252
use middle::trans::glue;
5353
use middle::trans::inline;
5454
use middle::trans::machine;
55-
use middle::trans::machine::llsize_of;
55+
use middle::trans::machine::{llalign_of_min, llsize_of};
5656
use middle::trans::meth;
5757
use middle::trans::monomorphize;
5858
use middle::trans::reachable;
@@ -1442,12 +1442,7 @@ pub fn with_cond(bcx: block, val: ValueRef, f: &fn(block) -> block) -> block {
14421442
next_cx
14431443
}
14441444

1445-
pub fn call_memcpy(cx: block, dst: ValueRef, src: ValueRef,
1446-
n_bytes: ValueRef) {
1447-
// FIXME (Related to #1645, I think?): Provide LLVM with better
1448-
// alignment information when the alignment is statically known (it must
1449-
// be nothing more than a constant int, or LLVM complains -- not even a
1450-
// constant element of a tydesc works).
1445+
pub fn call_memcpy(cx: block, dst: ValueRef, src: ValueRef, n_bytes: ValueRef, align: u32) {
14511446
let _icx = cx.insn_ctxt("call_memcpy");
14521447
let ccx = cx.ccx();
14531448
let key = match ccx.sess.targ_cfg.arch {
@@ -1462,7 +1457,7 @@ pub fn call_memcpy(cx: block, dst: ValueRef, src: ValueRef,
14621457
let src_ptr = PointerCast(cx, src, T_ptr(T_i8()));
14631458
let dst_ptr = PointerCast(cx, dst, T_ptr(T_i8()));
14641459
let size = IntCast(cx, n_bytes, ccx.int_type);
1465-
let align = C_i32(1i32);
1460+
let align = C_i32(align as i32);
14661461
let volatile = C_i1(false);
14671462
Call(cx, memcpy, [dst_ptr, src_ptr, size, align, volatile]);
14681463
}
@@ -1471,8 +1466,10 @@ pub fn memcpy_ty(bcx: block, dst: ValueRef, src: ValueRef, t: ty::t) {
14711466
let _icx = bcx.insn_ctxt("memcpy_ty");
14721467
let ccx = bcx.ccx();
14731468
if ty::type_is_structural(t) {
1474-
let llsz = llsize_of(ccx, type_of::type_of(ccx, t));
1475-
call_memcpy(bcx, dst, src, llsz);
1469+
let llty = type_of::type_of(ccx, t);
1470+
let llsz = llsize_of(ccx, llty);
1471+
let llalign = llalign_of_min(ccx, llty);
1472+
call_memcpy(bcx, dst, src, llsz, llalign as u32);
14761473
} else {
14771474
Store(bcx, Load(bcx, src), dst);
14781475
}

branches/try2/src/librustc/middle/trans/closure.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -521,7 +521,7 @@ pub fn make_opaque_cbox_take_glue(
521521
[opaque_tydesc, sz],
522522
expr::SaveIn(rval));
523523
let cbox_out = PointerCast(bcx, Load(bcx, rval), llopaquecboxty);
524-
call_memcpy(bcx, cbox_out, cbox_in, sz);
524+
call_memcpy(bcx, cbox_out, cbox_in, sz, 1);
525525
Store(bcx, cbox_out, cboxptr);
526526

527527
// Take the (deeply cloned) type descriptor

branches/try2/src/librustc/middle/trans/foreign.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -787,7 +787,7 @@ pub fn trans_intrinsic(ccx: @CrateContext,
787787
let llsrcptr = PointerCast(bcx, llsrcptr, T_ptr(T_i8()));
788788

789789
let llsize = llsize_of(ccx, llintype);
790-
call_memcpy(bcx, lldestptr, llsrcptr, llsize);
790+
call_memcpy(bcx, lldestptr, llsrcptr, llsize, 1);
791791
}
792792
}
793793
~"needs_drop" => {

branches/try2/src/librustc/middle/trans/tvec.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ pub fn duplicate_uniq(bcx: block, vptr: ValueRef, vec_ty: ty::t) -> Result {
125125

126126
let data_ptr = get_dataptr(bcx, get_bodyptr(bcx, vptr));
127127
let new_data_ptr = get_dataptr(bcx, get_bodyptr(bcx, newptr));
128-
base::call_memcpy(bcx, new_data_ptr, data_ptr, fill);
128+
base::call_memcpy(bcx, new_data_ptr, data_ptr, fill, 1);
129129

130130
let bcx = if ty::type_needs_drop(bcx.tcx(), unit_ty) {
131131
iter_vec_raw(bcx, new_data_ptr, vec_ty, fill, glue::take_ty)
@@ -370,7 +370,7 @@ pub fn write_content(bcx: block,
370370
let bytes = s.len() + 1; // copy null-terminator too
371371
let llbytes = C_uint(bcx.ccx(), bytes);
372372
let llcstr = C_cstr(bcx.ccx(), s);
373-
base::call_memcpy(bcx, lldest, llcstr, llbytes);
373+
base::call_memcpy(bcx, lldest, llcstr, llbytes, 1);
374374
return bcx;
375375
}
376376
}

0 commit comments

Comments
 (0)