Skip to content

Commit c8e683e

Browse files
committed
---
yaml --- r: 60061 b: refs/heads/master c: 19d2ba3 h: refs/heads/master i: 60059: 592d7ca v: v3
1 parent 3f6c279 commit c8e683e

File tree

13 files changed

+49
-201
lines changed

13 files changed

+49
-201
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: 0ed4495ac4c262a8361dded6900e4e69b1faaee1
2+
refs/heads/master: 19d2ba33832d1fa1ba6485df7b481e9aa5e5bd02
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 2d28d645422c1617be58c8ca7ad9a457264ca850
55
refs/heads/try: c50a9d5b664478e533ba1d1d353213d70c8ad589

trunk/src/libcore/core.rc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,6 @@ pub mod nil;
164164
pub mod bool;
165165
pub mod char;
166166
pub mod tuple;
167-
pub mod simd;
168167

169168
pub mod vec;
170169
pub mod at_vec;

trunk/src/libcore/simd.rs

Lines changed: 0 additions & 43 deletions
This file was deleted.

trunk/src/libcore/vec.rs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -991,7 +991,7 @@ pub fn connect<T:Copy>(v: &[~[T]], sep: &T) -> ~[T] {
991991
* ~~~
992992
*
993993
*/
994-
pub fn foldl<T, U>(z: T, v: &[U], p: &fn(t: T, u: &U) -> T) -> T {
994+
pub fn foldl<'a, T, U>(z: T, v: &'a [U], p: &fn(t: T, u: &'a U) -> T) -> T {
995995
let mut accum = z;
996996
let mut i = 0;
997997
let l = v.len();
@@ -1023,12 +1023,13 @@ pub fn foldl<T, U>(z: T, v: &[U], p: &fn(t: T, u: &U) -> T) -> T {
10231023
* ~~~
10241024
*
10251025
*/
1026-
pub fn foldr<T, U: Copy>(v: &[T], z: U, p: &fn(t: &T, u: U) -> U) -> U {
1027-
let mut accum = z;
1028-
for v.each_reverse |elt| {
1029-
accum = p(elt, accum);
1026+
pub fn foldr<'a, T, U>(v: &'a [T], mut z: U, p: &fn(t: &'a T, u: U) -> U) -> U {
1027+
let mut i = v.len();
1028+
while i > 0 {
1029+
i -= 1;
1030+
z = p(&v[i], z);
10301031
}
1031-
accum
1032+
return z;
10321033
}
10331034
10341035
/**
@@ -1848,7 +1849,7 @@ pub trait ImmutableVector<'self, T> {
18481849
fn last_opt(&self) -> Option<&'self T>;
18491850
fn each_reverse(&self, blk: &fn(&T) -> bool);
18501851
fn eachi_reverse(&self, blk: &fn(uint, &T) -> bool);
1851-
fn foldr<U: Copy>(&self, z: U, p: &fn(t: &T, u: U) -> U) -> U;
1852+
fn foldr<'a, U>(&'a self, z: U, p: &fn(t: &'a T, u: U) -> U) -> U;
18521853
fn map<U>(&self, f: &fn(t: &T) -> U) -> ~[U];
18531854
fn mapi<U>(&self, f: &fn(uint, t: &T) -> U) -> ~[U];
18541855
fn map_r<U>(&self, f: &fn(x: &T) -> U) -> ~[U];
@@ -1921,7 +1922,7 @@ impl<'self,T> ImmutableVector<'self, T> for &'self [T] {
19211922

19221923
/// Reduce a vector from right to left
19231924
#[inline]
1924-
fn foldr<U:Copy>(&self, z: U, p: &fn(t: &T, u: U) -> U) -> U {
1925+
fn foldr<'a, U>(&'a self, z: U, p: &fn(t: &'a T, u: U) -> U) -> U {
19251926
foldr(*self, z, p)
19261927
}
19271928

trunk/src/librustc/middle/trans/build.rs

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -963,28 +963,20 @@ pub fn ExtractElement(cx: block, VecVal: ValueRef, Index: ValueRef) ->
963963
}
964964
965965
pub fn InsertElement(cx: block, VecVal: ValueRef, EltVal: ValueRef,
966-
Index: ValueRef) -> ValueRef {
966+
Index: ValueRef) {
967967
unsafe {
968-
if cx.unreachable { return llvm::LLVMGetUndef(T_nil()); }
968+
if cx.unreachable { return; }
969969
count_insn(cx, "insertelement");
970-
llvm::LLVMBuildInsertElement(B(cx), VecVal, EltVal, Index, noname())
970+
llvm::LLVMBuildInsertElement(B(cx), VecVal, EltVal, Index, noname());
971971
}
972972
}
973973
974974
pub fn ShuffleVector(cx: block, V1: ValueRef, V2: ValueRef,
975-
Mask: ValueRef) -> ValueRef {
975+
Mask: ValueRef) {
976976
unsafe {
977-
if cx.unreachable { return llvm::LLVMGetUndef(T_nil()); }
977+
if cx.unreachable { return; }
978978
count_insn(cx, "shufflevector");
979-
llvm::LLVMBuildShuffleVector(B(cx), V1, V2, Mask, noname())
980-
}
981-
}
982-
983-
pub fn VectorSplat(cx: block, NumElts: uint, EltVal: ValueRef) -> ValueRef {
984-
unsafe {
985-
let Undef = llvm::LLVMGetUndef(T_vector(val_ty(EltVal), NumElts));
986-
let VecVal = InsertElement(cx, Undef, EltVal, C_i32(0));
987-
ShuffleVector(cx, VecVal, Undef, C_null(T_vector(T_i32(), NumElts)))
979+
llvm::LLVMBuildShuffleVector(B(cx), V1, V2, Mask, noname());
988980
}
989981
}
990982

trunk/src/librustc/middle/trans/common.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -984,12 +984,6 @@ pub fn T_array(t: TypeRef, n: uint) -> TypeRef {
984984
}
985985
}
986986

987-
pub fn T_vector(t: TypeRef, n: uint) -> TypeRef {
988-
unsafe {
989-
return llvm::LLVMVectorType(t, n as c_uint);
990-
}
991-
}
992-
993987
// Interior vector.
994988
pub fn T_vec2(targ_cfg: @session::config, t: TypeRef) -> TypeRef {
995989
return T_struct(~[T_int(targ_cfg), // fill

trunk/src/librustc/middle/trans/type_of.rs

Lines changed: 15 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -155,15 +155,9 @@ pub fn sizing_type_of(cx: @CrateContext, t: ty::t) -> TypeRef {
155155
}
156156

157157
ty::ty_struct(did, _) => {
158-
if ty::type_is_simd(cx.tcx, t) {
159-
let et = ty::simd_type(cx.tcx, t);
160-
let n = ty::simd_size(cx.tcx, t);
161-
T_vector(type_of(cx, et), n)
162-
} else {
163-
let repr = adt::represent_type(cx, t);
164-
let packed = ty::lookup_packed(cx.tcx, did);
165-
T_struct(adt::sizing_fields_of(cx, repr), packed)
166-
}
158+
let repr = adt::represent_type(cx, t);
159+
let packed = ty::lookup_packed(cx.tcx, did);
160+
T_struct(adt::sizing_fields_of(cx, repr), packed)
167161
}
168162

169163
ty::ty_self(_) | ty::ty_infer(*) | ty::ty_param(*) | ty::ty_err(*) => {
@@ -269,19 +263,14 @@ pub fn type_of(cx: @CrateContext, t: ty::t) -> TypeRef {
269263
}
270264
ty::ty_opaque_closure_ptr(_) => T_opaque_box_ptr(cx),
271265
ty::ty_struct(did, ref substs) => {
272-
if ty::type_is_simd(cx.tcx, t) {
273-
let et = ty::simd_type(cx.tcx, t);
274-
let n = ty::simd_size(cx.tcx, t);
275-
T_vector(type_of(cx, et), n)
276-
} else {
277-
// Only create the named struct, but don't fill it in. We fill it
278-
// in *after* placing it into the type cache. This prevents
279-
// infinite recursion with recursive struct types.
280-
T_named_struct(llvm_type_name(cx,
281-
a_struct,
282-
did,
283-
/*bad*/ copy substs.tps))
284-
}
266+
// Only create the named struct, but don't fill it in. We fill it
267+
// in *after* placing it into the type cache. This prevents
268+
// infinite recursion with recursive struct types.
269+
270+
common::T_named_struct(llvm_type_name(cx,
271+
a_struct,
272+
did,
273+
/*bad*/ copy substs.tps))
285274
}
286275
ty::ty_self(*) => cx.tcx.sess.unimpl(~"type_of: ty_self"),
287276
ty::ty_infer(*) => cx.tcx.sess.bug(~"type_of with ty_infer"),
@@ -300,12 +289,10 @@ pub fn type_of(cx: @CrateContext, t: ty::t) -> TypeRef {
300289
}
301290

302291
ty::ty_struct(did, _) => {
303-
if !ty::type_is_simd(cx.tcx, t) {
304-
let repr = adt::represent_type(cx, t);
305-
let packed = ty::lookup_packed(cx.tcx, did);
306-
common::set_struct_body(llty, adt::fields_of(cx, repr),
307-
packed);
308-
}
292+
let repr = adt::represent_type(cx, t);
293+
let packed = ty::lookup_packed(cx.tcx, did);
294+
common::set_struct_body(llty, adt::fields_of(cx, repr),
295+
packed);
309296
}
310297
_ => ()
311298
}

trunk/src/librustc/middle/ty.rs

Lines changed: 2 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1567,13 +1567,6 @@ pub fn type_is_sequence(ty: t) -> bool {
15671567
}
15681568
}
15691569

1570-
pub fn type_is_simd(cx: ctxt, ty: t) -> bool {
1571-
match get(ty).sty {
1572-
ty_struct(did, _) => lookup_simd(cx, did),
1573-
_ => false
1574-
}
1575-
}
1576-
15771570
pub fn type_is_str(ty: t) -> bool {
15781571
match get(ty).sty {
15791572
ty_estr(_) => true,
@@ -1590,26 +1583,6 @@ pub fn sequence_element_type(cx: ctxt, ty: t) -> t {
15901583
}
15911584
}
15921585

1593-
pub fn simd_type(cx: ctxt, ty: t) -> t {
1594-
match get(ty).sty {
1595-
ty_struct(did, ref substs) => {
1596-
let fields = lookup_struct_fields(cx, did);
1597-
lookup_field_type(cx, did, fields[0].id, substs)
1598-
}
1599-
_ => fail!(~"simd_type called on invalid type")
1600-
}
1601-
}
1602-
1603-
pub fn simd_size(cx: ctxt, ty: t) -> uint {
1604-
match get(ty).sty {
1605-
ty_struct(did, _) => {
1606-
let fields = lookup_struct_fields(cx, did);
1607-
fields.len()
1608-
}
1609-
_ => fail!(~"simd_size called on invalid type")
1610-
}
1611-
}
1612-
16131586
pub fn get_element_type(ty: t, i: uint) -> t {
16141587
match get(ty).sty {
16151588
ty_tup(ref ts) => return ts[i],
@@ -2408,14 +2381,6 @@ pub fn type_is_signed(ty: t) -> bool {
24082381
}
24092382
}
24102383
2411-
pub fn type_is_machine(ty: t) -> bool {
2412-
match get(ty).sty {
2413-
ty_int(ast::ty_i) | ty_uint(ast::ty_u) | ty_float(ast::ty_f) => false,
2414-
ty_int(*) | ty_uint(*) | ty_float(*) => true,
2415-
_ => false
2416-
}
2417-
}
2418-
24192384
// Whether a type is Plain Old Data -- meaning it does not contain pointers
24202385
// that the cycle collector might care about.
24212386
pub fn type_is_pod(cx: ctxt, ty: t) -> bool {
@@ -3931,7 +3896,7 @@ pub fn has_attr(tcx: ctxt, did: def_id, attr: &str) -> bool {
39313896
attrs: ref attrs,
39323897
_
39333898
}, _)) => attr::attrs_contains_name(*attrs, attr),
3934-
_ => tcx.sess.bug(fmt!("has_attr: %? is not an item",
3899+
_ => tcx.sess.bug(fmt!("lookup_packed: %? is not an item",
39353900
did))
39363901
}
39373902
} else {
@@ -3943,16 +3908,11 @@ pub fn has_attr(tcx: ctxt, did: def_id, attr: &str) -> bool {
39433908
}
39443909
}
39453910
3946-
/// Determine whether an item is annotated with `#[packed]`
3911+
/// Determine whether an item is annotated with `#[packed]` or not
39473912
pub fn lookup_packed(tcx: ctxt, did: def_id) -> bool {
39483913
has_attr(tcx, did, "packed")
39493914
}
39503915
3951-
/// Determine whether an item is annotated with `#[simd]`
3952-
pub fn lookup_simd(tcx: ctxt, did: def_id) -> bool {
3953-
has_attr(tcx, did, "simd")
3954-
}
3955-
39563916
// Look up a field ID, whether or not it's local
39573917
// Takes a list of type substs in case the struct is generic
39583918
pub fn lookup_field_type(tcx: ctxt,

trunk/src/librustc/middle/typeck/check/mod.rs

Lines changed: 1 addition & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -561,14 +561,8 @@ pub fn check_no_duplicate_fields(tcx: ty::ctxt,
561561
}
562562

563563
pub fn check_struct(ccx: @mut CrateCtxt, id: ast::node_id, span: span) {
564-
let tcx = ccx.tcx;
565-
566564
// Check that the class is instantiable
567-
check_instantiable(tcx, span, id);
568-
569-
if ty::lookup_simd(tcx, local_def(id)) {
570-
check_simd(tcx, span, id);
571-
}
565+
check_instantiable(ccx.tcx, span, id);
572566
}
573567

574568
pub fn check_item(ccx: @mut CrateCtxt, it: @ast::item) {
@@ -3053,35 +3047,6 @@ pub fn check_instantiable(tcx: ty::ctxt,
30533047
}
30543048
}
30553049

3056-
pub fn check_simd(tcx: ty::ctxt, sp: span, id: ast::node_id) {
3057-
let t = ty::node_id_to_type(tcx, id);
3058-
if ty::type_needs_subst(t) {
3059-
tcx.sess.span_err(sp, "SIMD vector cannot be generic");
3060-
return;
3061-
}
3062-
match ty::get(t).sty {
3063-
ty::ty_struct(did, ref substs) => {
3064-
let fields = ty::lookup_struct_fields(tcx, did);
3065-
if fields.is_empty() {
3066-
tcx.sess.span_err(sp, "SIMD vector cannot be empty");
3067-
return;
3068-
}
3069-
let e = ty::lookup_field_type(tcx, did, fields[0].id, substs);
3070-
if !vec::all(fields,
3071-
|f| ty::lookup_field_type(tcx, did, f.id, substs) == e) {
3072-
tcx.sess.span_err(sp, "SIMD vector should be homogeneous");
3073-
return;
3074-
}
3075-
if !ty::type_is_machine(e) {
3076-
tcx.sess.span_err(sp, "SIMD vector element type should be \
3077-
machine type");
3078-
return;
3079-
}
3080-
}
3081-
_ => ()
3082-
}
3083-
}
3084-
30853050
pub fn check_enum_variants(ccx: @mut CrateCtxt,
30863051
sp: span,
30873052
vs: &[ast::variant],

trunk/src/libstd/ebml.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,7 @@ pub mod reader {
379379
fn read_int(&mut self) -> int {
380380
let v = doc_as_u64(self.next_doc(EsInt)) as i64;
381381
if v > (int::max_value as i64) || v < (int::min_value as i64) {
382+
debug!("FIXME #6122: Removing this makes this function miscompile");
382383
fail!(fmt!("int %? out of range for this architecture", v));
383384
}
384385
v as int

trunk/src/test/compile-fail/simd-type.rs

Lines changed: 0 additions & 13 deletions
This file was deleted.

trunk/src/test/run-pass/issue-5517.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
fn main() {
12+
let box1 = @mut 42;
13+
let _x = *(&mut *box1) == 42 || *(&mut *box1) == 31337;
14+
}

trunk/src/test/run-pass/simd-type.rs

Lines changed: 0 additions & 9 deletions
This file was deleted.

0 commit comments

Comments
 (0)