summary refs log tree commit diff
path: root/src/libstd/vec.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2013-07-09 18:28:46 -0700
committerbors <bors@rust-lang.org>2013-07-09 18:28:46 -0700
commit41dcec2fe16e272016ae77d10a6a5ff3a737f192 (patch)
tree6eebc49e7033a0d696c93c8e23d7caeb28d4eca1 /src/libstd/vec.rs
parent137d1fb210a844a76f89d7355a1aaf9f7a88af33 (diff)
parent413d51e32debf0c3f7dda2434b64d73585df21ef (diff)
downloadrust-41dcec2fe16e272016ae77d10a6a5ff3a737f192.tar.gz
rust-41dcec2fe16e272016ae77d10a6a5ff3a737f192.zip
auto merge of #7265 : brson/rust/io-upstream, r=brson
r? @graydon, @nikomatsakis, @pcwalton, or @catamorphism

Sorry this is so huge, but it's been accumulating for about a month. There's lots of stuff here, mostly oriented toward enabling multithreaded scheduling and improving compatibility between the old and new runtimes. Adds task pinning so that we can create the 'platform thread' in servo.

[Here](https://github.com/brson/rust/blob/e1555f9b5628af2b6c6ed344cad621399cb7684d/src/libstd/rt/mod.rs#L201) is the current runtime setup code.

About half of this has already been reviewed.
Diffstat (limited to 'src/libstd/vec.rs')
-rw-r--r--src/libstd/vec.rs16
1 files changed, 6 insertions, 10 deletions
diff --git a/src/libstd/vec.rs b/src/libstd/vec.rs
index 2d730b7a6a2..4b719080f84 100644
--- a/src/libstd/vec.rs
+++ b/src/libstd/vec.rs
@@ -20,7 +20,6 @@ use cmp::{Eq, TotalEq, TotalOrd, Ordering, Less, Equal, Greater};
 use clone::Clone;
 use iterator::{FromIterator, Iterator, IteratorUtil};
 use kinds::Copy;
-use libc;
 use libc::c_void;
 use num::Zero;
 use option::{None, Option, Some};
@@ -33,17 +32,12 @@ use sys::size_of;
 use uint;
 use unstable::intrinsics;
 #[cfg(stage0)]
-use intrinsic::{get_tydesc, TyDesc};
+use intrinsic::{get_tydesc};
 #[cfg(not(stage0))]
-use unstable::intrinsics::{get_tydesc, contains_managed, TyDesc};
+use unstable::intrinsics::{get_tydesc, contains_managed};
 use vec;
 use util;
 
-extern {
-    #[fast_ffi]
-    unsafe fn vec_reserve_shared_actual(t: *TyDesc, v: **raw::VecRepr, n: libc::size_t);
-}
-
 /// Returns true if two vectors have the same length
 pub fn same_length<T, U>(xs: &[T], ys: &[U]) -> bool {
     xs.len() == ys.len()
@@ -1139,7 +1133,9 @@ impl<T> OwnedVector<T> for ~[T] {
                 let td = get_tydesc::<T>();
                 if ((**ptr).box_header.ref_count ==
                     managed::raw::RC_MANAGED_UNIQUE) {
-                    vec_reserve_shared_actual(td, ptr as **raw::VecRepr, n as libc::size_t);
+                    // XXX transmute shouldn't be necessary
+                    let td = cast::transmute(td);
+                    ::at_vec::raw::reserve_raw(td, ptr, n);
                 } else {
                     let alloc = n * sys::nonzero_size_of::<T>();
                     *ptr = realloc_raw(*ptr as *mut c_void, alloc + size_of::<raw::VecRepr>())
@@ -1169,7 +1165,7 @@ impl<T> OwnedVector<T> for ~[T] {
                 let ptr: *mut *mut raw::VecRepr = cast::transmute(self);
                 let td = get_tydesc::<T>();
                 if contains_managed::<T>() {
-                    vec_reserve_shared_actual(td, ptr as **raw::VecRepr, n as libc::size_t);
+                    ::at_vec::raw::reserve_raw(td, ptr, n);
                 } else {
                     let alloc = n * sys::nonzero_size_of::<T>();
                     let size = alloc + size_of::<raw::VecRepr>();