Skip to content

Commit 5149b40

Browse files
committed
---
yaml --- r: 60757 b: refs/heads/auto c: 56a2e5d h: refs/heads/master i: 60755: 8594ffe v: v3
1 parent b137203 commit 5149b40

File tree

12 files changed

+97
-238
lines changed

12 files changed

+97
-238
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0
1414
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
1515
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1616
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
17-
refs/heads/auto: 2061ce9affd01d2dfb3d1e5836cfda4006ea8290
17+
refs/heads/auto: 56a2e5dc22bfd0791b5e71dc89dde48fd3034e03
1818
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
1919
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c

branches/auto/configure

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -555,11 +555,11 @@ then
555555
CFG_CLANG_VERSION=$("$CFG_CLANG" \
556556
--version \
557557
| grep version \
558-
| sed 's/.*\(version .*\)/\1/; s/.*based on \(LLVM .*\))/\1/' \
558+
| sed 's/.*\(version .*\)/\1/' \
559559
| cut -d ' ' -f 2)
560560

561561
case $CFG_CLANG_VERSION in
562-
(3.0svn | 3.0 | 3.1* | 3.2* | 3.3*)
562+
(3.0svn | 3.0 | 3.1* | 3.2* | 3.3* | 4.0* | 4.1* | 4.2*)
563563
step_msg "found ok version of CLANG: $CFG_CLANG_VERSION"
564564
CFG_C_COMPILER="clang"
565565
;;

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

Lines changed: 15 additions & 9 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::{llalign_of_min, llsize_of};
55+
use middle::trans::machine::llsize_of;
5656
use middle::trans::meth;
5757
use middle::trans::monomorphize;
5858
use middle::trans::reachable;
@@ -1442,7 +1442,12 @@ 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, n_bytes: ValueRef, align: u32) {
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).
14461451
let _icx = cx.insn_ctxt("call_memcpy");
14471452
let ccx = cx.ccx();
14481453
let key = match ccx.sess.targ_cfg.arch {
@@ -1457,7 +1462,7 @@ pub fn call_memcpy(cx: block, dst: ValueRef, src: ValueRef, n_bytes: ValueRef, a
14571462
let src_ptr = PointerCast(cx, src, T_ptr(T_i8()));
14581463
let dst_ptr = PointerCast(cx, dst, T_ptr(T_i8()));
14591464
let size = IntCast(cx, n_bytes, ccx.int_type);
1460-
let align = C_i32(align as i32);
1465+
let align = C_i32(1i32);
14611466
let volatile = C_i1(false);
14621467
Call(cx, memcpy, [dst_ptr, src_ptr, size, align, volatile]);
14631468
}
@@ -1466,10 +1471,8 @@ pub fn memcpy_ty(bcx: block, dst: ValueRef, src: ValueRef, t: ty::t) {
14661471
let _icx = bcx.insn_ctxt("memcpy_ty");
14671472
let ccx = bcx.ccx();
14681473
if ty::type_is_structural(t) {
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);
1474+
let llsz = llsize_of(ccx, type_of::type_of(ccx, t));
1475+
call_memcpy(bcx, dst, src, llsz);
14731476
} else {
14741477
Store(bcx, Load(bcx, src), dst);
14751478
}
@@ -2339,7 +2342,9 @@ pub fn create_entry_wrapper(ccx: @CrateContext,
23392342
llvm::LLVMPositionBuilderAtEnd(bld, llbb);
23402343
23412344
let start_def_id = ccx.tcx.lang_items.start_fn();
2342-
if start_def_id.crate != ast::local_crate {
2345+
if start_def_id.crate == ast::local_crate {
2346+
ccx.sess.bug("start lang item is never in the local crate")
2347+
} else {
23432348
let start_fn_type = csearch::get_type(ccx.tcx,
23442349
start_def_id).ty;
23452350
trans_external_path(ccx, start_def_id, start_fn_type);
@@ -2356,7 +2361,8 @@ pub fn create_entry_wrapper(ccx: @CrateContext,
23562361
let (start_fn, args) = if use_start_lang_item {
23572362
let start_def_id = ccx.tcx.lang_items.start_fn();
23582363
let start_fn = if start_def_id.crate == ast::local_crate {
2359-
get_item_val(ccx, start_def_id.node)
2364+
ccx.sess.bug("start lang item is never in the local \
2365+
crate")
23602366
} else {
23612367
let start_fn_type = csearch::get_type(ccx.tcx,
23622368
start_def_id).ty;

branches/auto/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, 1);
524+
call_memcpy(bcx, cbox_out, cbox_in, sz);
525525
Store(bcx, cbox_out, cboxptr);
526526

527527
// Take the (deeply cloned) type descriptor

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

Lines changed: 29 additions & 67 deletions
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, 1);
790+
call_memcpy(bcx, lldestptr, llsrcptr, llsize);
791791
}
792792
}
793793
~"needs_drop" => {
@@ -846,82 +846,44 @@ pub fn trans_intrinsic(ccx: @CrateContext,
846846
Store(bcx, morestack_addr, fcx.llretptr.get());
847847
}
848848
~"memcpy32" => {
849-
let tp_ty = substs.tys[0];
850-
let lltp_ty = type_of::type_of(ccx, tp_ty);
851-
let align = C_i32(machine::llalign_of_min(ccx, lltp_ty) as i32);
852-
let size = C_i32(machine::llsize_of_real(ccx, lltp_ty) as i32);
853-
854-
let dst_ptr = PointerCast(bcx, get_param(decl, first_real_arg), T_ptr(T_i8()));
855-
let src_ptr = PointerCast(bcx, get_param(decl, first_real_arg + 1), T_ptr(T_i8()));
856-
let count = get_param(decl, first_real_arg + 2);
849+
let dst_ptr = get_param(decl, first_real_arg);
850+
let src_ptr = get_param(decl, first_real_arg + 1);
851+
let size = get_param(decl, first_real_arg + 2);
852+
let align = C_i32(1);
857853
let volatile = C_i1(false);
858-
let llfn = *bcx.ccx().intrinsics.get(&~"llvm.memcpy.p0i8.p0i8.i32");
859-
Call(bcx, llfn, [dst_ptr, src_ptr, Mul(bcx, size, count), align, volatile]);
854+
let llfn = *bcx.ccx().intrinsics.get(
855+
&~"llvm.memcpy.p0i8.p0i8.i32");
856+
Call(bcx, llfn, [dst_ptr, src_ptr, size, align, volatile]);
860857
}
861858
~"memcpy64" => {
862-
let tp_ty = substs.tys[0];
863-
let lltp_ty = type_of::type_of(ccx, tp_ty);
864-
let align = C_i32(machine::llalign_of_min(ccx, lltp_ty) as i32);
865-
let size = C_i64(machine::llsize_of_real(ccx, lltp_ty) as i64);
866-
867-
let dst_ptr = PointerCast(bcx, get_param(decl, first_real_arg), T_ptr(T_i8()));
868-
let src_ptr = PointerCast(bcx, get_param(decl, first_real_arg + 1), T_ptr(T_i8()));
869-
let count = get_param(decl, first_real_arg + 2);
859+
let dst_ptr = get_param(decl, first_real_arg);
860+
let src_ptr = get_param(decl, first_real_arg + 1);
861+
let size = get_param(decl, first_real_arg + 2);
862+
let align = C_i32(1);
870863
let volatile = C_i1(false);
871-
let llfn = *bcx.ccx().intrinsics.get(&~"llvm.memcpy.p0i8.p0i8.i64");
872-
Call(bcx, llfn, [dst_ptr, src_ptr, Mul(bcx, size, count), align, volatile]);
864+
let llfn = *bcx.ccx().intrinsics.get(
865+
&~"llvm.memcpy.p0i8.p0i8.i64");
866+
Call(bcx, llfn, [dst_ptr, src_ptr, size, align, volatile]);
873867
}
874868
~"memmove32" => {
875-
let tp_ty = substs.tys[0];
876-
let lltp_ty = type_of::type_of(ccx, tp_ty);
877-
let align = C_i32(machine::llalign_of_min(ccx, lltp_ty) as i32);
878-
let size = C_i32(machine::llsize_of_real(ccx, lltp_ty) as i32);
879-
880-
let dst_ptr = PointerCast(bcx, get_param(decl, first_real_arg), T_ptr(T_i8()));
881-
let src_ptr = PointerCast(bcx, get_param(decl, first_real_arg + 1), T_ptr(T_i8()));
882-
let count = get_param(decl, first_real_arg + 2);
869+
let dst_ptr = get_param(decl, first_real_arg);
870+
let src_ptr = get_param(decl, first_real_arg + 1);
871+
let size = get_param(decl, first_real_arg + 2);
872+
let align = C_i32(1);
883873
let volatile = C_i1(false);
884-
let llfn = *bcx.ccx().intrinsics.get(&~"llvm.memmove.p0i8.p0i8.i32");
885-
Call(bcx, llfn, [dst_ptr, src_ptr, Mul(bcx, size, count), align, volatile]);
874+
let llfn = *bcx.ccx().intrinsics.get(
875+
&~"llvm.memmove.p0i8.p0i8.i32");
876+
Call(bcx, llfn, [dst_ptr, src_ptr, size, align, volatile]);
886877
}
887878
~"memmove64" => {
888-
let tp_ty = substs.tys[0];
889-
let lltp_ty = type_of::type_of(ccx, tp_ty);
890-
let align = C_i32(machine::llalign_of_min(ccx, lltp_ty) as i32);
891-
let size = C_i64(machine::llsize_of_real(ccx, lltp_ty) as i64);
892-
893-
let dst_ptr = PointerCast(bcx, get_param(decl, first_real_arg), T_ptr(T_i8()));
894-
let src_ptr = PointerCast(bcx, get_param(decl, first_real_arg + 1), T_ptr(T_i8()));
895-
let count = get_param(decl, first_real_arg + 2);
896-
let volatile = C_i1(false);
897-
let llfn = *bcx.ccx().intrinsics.get(&~"llvm.memmove.p0i8.p0i8.i64");
898-
Call(bcx, llfn, [dst_ptr, src_ptr, Mul(bcx, size, count), align, volatile]);
899-
}
900-
~"memset32" => {
901-
let tp_ty = substs.tys[0];
902-
let lltp_ty = type_of::type_of(ccx, tp_ty);
903-
let align = C_i32(machine::llalign_of_min(ccx, lltp_ty) as i32);
904-
let size = C_i32(machine::llsize_of_real(ccx, lltp_ty) as i32);
905-
906-
let dst_ptr = PointerCast(bcx, get_param(decl, first_real_arg), T_ptr(T_i8()));
907-
let val = get_param(decl, first_real_arg + 1);
908-
let count = get_param(decl, first_real_arg + 2);
909-
let volatile = C_i1(false);
910-
let llfn = *bcx.ccx().intrinsics.get(&~"llvm.memset.p0i8.i32");
911-
Call(bcx, llfn, [dst_ptr, val, Mul(bcx, size, count), align, volatile]);
912-
}
913-
~"memset64" => {
914-
let tp_ty = substs.tys[0];
915-
let lltp_ty = type_of::type_of(ccx, tp_ty);
916-
let align = C_i32(machine::llalign_of_min(ccx, lltp_ty) as i32);
917-
let size = C_i64(machine::llsize_of_real(ccx, lltp_ty) as i64);
918-
919-
let dst_ptr = PointerCast(bcx, get_param(decl, first_real_arg), T_ptr(T_i8()));
920-
let val = get_param(decl, first_real_arg + 1);
921-
let count = get_param(decl, first_real_arg + 2);
879+
let dst_ptr = get_param(decl, first_real_arg);
880+
let src_ptr = get_param(decl, first_real_arg + 1);
881+
let size = get_param(decl, first_real_arg + 2);
882+
let align = C_i32(1);
922883
let volatile = C_i1(false);
923-
let llfn = *bcx.ccx().intrinsics.get(&~"llvm.memset.p0i8.i64");
924-
Call(bcx, llfn, [dst_ptr, val, Mul(bcx, size, count), align, volatile]);
884+
let llfn = *bcx.ccx().intrinsics.get(
885+
&~"llvm.memmove.p0i8.p0i8.i64");
886+
Call(bcx, llfn, [dst_ptr, src_ptr, size, align, volatile]);
925887
}
926888
~"sqrtf32" => {
927889
let x = get_param(decl, first_real_arg);

branches/auto/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, 1);
128+
base::call_memcpy(bcx, new_data_ptr, data_ptr, fill);
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, 1);
373+
base::call_memcpy(bcx, lldest, llcstr, llbytes);
374374
return bcx;
375375
}
376376
}

branches/auto/src/librustc/middle/trans/type_use.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,7 @@ pub fn type_uses_for(ccx: @CrateContext, fn_id: def_id, n_tps: uint)
135135
~"visit_tydesc" | ~"forget" | ~"frame_address" |
136136
~"morestack_addr" => 0,
137137

138-
~"memcpy32" | ~"memcpy64" | ~"memmove32" | ~"memmove64" |
139-
~"memset32" | ~"memset64" => use_repr,
138+
~"memcpy32" | ~"memcpy64" | ~"memmove32" | ~"memmove64" => 0,
140139

141140
~"sqrtf32" | ~"sqrtf64" | ~"powif32" | ~"powif64" |
142141
~"sinf32" | ~"sinf64" | ~"cosf32" | ~"cosf64" |

branches/auto/src/librustc/middle/typeck/check/mod.rs

Lines changed: 12 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -3538,89 +3538,65 @@ pub fn check_intrinsic_type(ccx: @mut CrateCtxt, it: @ast::foreign_item) {
35383538
(0u, ~[], ty::mk_nil_ptr(ccx.tcx))
35393539
}
35403540
~"memcpy32" => {
3541-
(1,
3541+
(0,
35423542
~[
35433543
ty::mk_ptr(tcx, ty::mt {
3544-
ty: param(ccx, 0),
3544+
ty: ty::mk_u8(),
35453545
mutbl: ast::m_mutbl
35463546
}),
35473547
ty::mk_ptr(tcx, ty::mt {
3548-
ty: param(ccx, 0),
3548+
ty: ty::mk_u8(),
35493549
mutbl: ast::m_imm
35503550
}),
35513551
ty::mk_u32()
35523552
],
35533553
ty::mk_nil())
35543554
}
35553555
~"memcpy64" => {
3556-
(1,
3556+
(0,
35573557
~[
35583558
ty::mk_ptr(tcx, ty::mt {
3559-
ty: param(ccx, 0),
3559+
ty: ty::mk_u8(),
35603560
mutbl: ast::m_mutbl
35613561
}),
35623562
ty::mk_ptr(tcx, ty::mt {
3563-
ty: param(ccx, 0),
3563+
ty: ty::mk_u8(),
35643564
mutbl: ast::m_imm
35653565
}),
35663566
ty::mk_u64()
35673567
],
35683568
ty::mk_nil())
35693569
}
35703570
~"memmove32" => {
3571-
(1,
3571+
(0,
35723572
~[
35733573
ty::mk_ptr(tcx, ty::mt {
3574-
ty: param(ccx, 0),
3574+
ty: ty::mk_u8(),
35753575
mutbl: ast::m_mutbl
35763576
}),
35773577
ty::mk_ptr(tcx, ty::mt {
3578-
ty: param(ccx, 0),
3578+
ty: ty::mk_u8(),
35793579
mutbl: ast::m_imm
35803580
}),
35813581
ty::mk_u32()
35823582
],
35833583
ty::mk_nil())
35843584
}
35853585
~"memmove64" => {
3586-
(1,
3586+
(0,
35873587
~[
35883588
ty::mk_ptr(tcx, ty::mt {
3589-
ty: param(ccx, 0),
3589+
ty: ty::mk_u8(),
35903590
mutbl: ast::m_mutbl
35913591
}),
35923592
ty::mk_ptr(tcx, ty::mt {
3593-
ty: param(ccx, 0),
3593+
ty: ty::mk_u8(),
35943594
mutbl: ast::m_imm
35953595
}),
35963596
ty::mk_u64()
35973597
],
35983598
ty::mk_nil())
35993599
}
3600-
~"memset32" => {
3601-
(1,
3602-
~[
3603-
ty::mk_ptr(tcx, ty::mt {
3604-
ty: param(ccx, 0),
3605-
mutbl: ast::m_mutbl
3606-
}),
3607-
ty::mk_u8(),
3608-
ty::mk_u32()
3609-
],
3610-
ty::mk_nil())
3611-
}
3612-
~"memset64" => {
3613-
(1,
3614-
~[
3615-
ty::mk_ptr(tcx, ty::mt {
3616-
ty: param(ccx, 0),
3617-
mutbl: ast::m_mutbl
3618-
}),
3619-
ty::mk_u8(),
3620-
ty::mk_u64()
3621-
],
3622-
ty::mk_nil())
3623-
}
36243600
~"sqrtf32" => (0, ~[ ty::mk_f32() ], ty::mk_f32()),
36253601
~"sqrtf64" => (0, ~[ ty::mk_f64() ], ty::mk_f64()),
36263602
~"powif32" => {

branches/auto/src/libstd/cast.rs

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,8 @@ use sys;
1414
use unstable::intrinsics;
1515

1616
/// Casts the value at `src` to U. The two types must have the same length.
17-
#[cfg(stage0)]
1817
pub unsafe fn transmute_copy<T, U>(src: &T) -> U {
19-
let mut dest: U = intrinsics::uninit();
18+
let mut dest: U = intrinsics::init();
2019
{
2120
let dest_ptr: *mut u8 = transmute(&mut dest);
2221
let src_ptr: *u8 = transmute(src);
@@ -27,26 +26,6 @@ pub unsafe fn transmute_copy<T, U>(src: &T) -> U {
2726
dest
2827
}
2928

30-
#[cfg(target_word_size = "32", not(stage0))]
31-
#[inline(always)]
32-
pub unsafe fn transmute_copy<T, U>(src: &T) -> U {
33-
let mut dest: U = intrinsics::uninit();
34-
let dest_ptr: *mut u8 = transmute(&mut dest);
35-
let src_ptr: *u8 = transmute(src);
36-
intrinsics::memcpy32(dest_ptr, src_ptr, sys::size_of::<U>() as u32);
37-
dest
38-
}
39-
40-
#[cfg(target_word_size = "64", not(stage0))]
41-
#[inline(always)]
42-
pub unsafe fn transmute_copy<T, U>(src: &T) -> U {
43-
let mut dest: U = intrinsics::uninit();
44-
let dest_ptr: *mut u8 = transmute(&mut dest);
45-
let src_ptr: *u8 = transmute(src);
46-
intrinsics::memcpy64(dest_ptr, src_ptr, sys::size_of::<U>() as u64);
47-
dest
48-
}
49-
5029
/**
5130
* Move a thing into the void
5231
*
@@ -64,7 +43,6 @@ pub unsafe fn forget<T>(thing: T) { intrinsics::forget(thing); }
6443
* and/or reinterpret_cast when such calls would otherwise scramble a box's
6544
* reference count
6645
*/
67-
#[inline(always)]
6846
pub unsafe fn bump_box_refcount<T>(t: @T) { forget(t); }
6947

7048
/**

0 commit comments

Comments
 (0)