Daniel Micay [Sat, 16 Feb 2013 22:55:55 +0000 (17:55 -0500)]
modernize std::deque
* use a proper exported data type with private fields
* implement core::container::Container
* use the current constructor convention
* use explicit self
* get rid of DVec and the mutable fields
bors [Sat, 16 Feb 2013 21:03:25 +0000 (13:03 -0800)]
auto merge of #4980 : pcwalton/rust/sizing-type-of, r=pcwalton
...locking-servo
`simplify_type` was bogus, as there was no way for it to handle enums
properly. It was also slow, because it created many Rust types at runtime. In
general creating Rust types during trans is a source of slowness, and I'd like
to avoid doing it as much as possible. (It is probably not possible to
eliminate it entirely, due to `subst`, but we should get rid of as much of it
as we can.) So this patch replaces `simplify_type` with `sizing_type_of`,
which creates a size-equivalent LLVM type directly without going through a
Rust type first.
Because this is causing an ICE in Servo, I'm rubber stamping it.
Patrick Walton [Sat, 16 Feb 2013 17:43:16 +0000 (09:43 -0800)]
librustc: Remove `simplify_type` and replace with `sizing_type_of`. rs=blocking-servo
`simplify_type` was bogus, as there was no way for it to handle enums
properly. It was also slow, because it created many Rust types at runtime. In
general creating Rust types during trans is a source of slowness, and I'd like
to avoid doing it as much as possible. (It is probably not possible to
eliminate it entirely, due to `subst`, but we should get rid of as much of it
as we can.) So this patch replaces `simplify_type` with `sizing_type_of`,
which creates a size-equivalent LLVM type directly without going through a
Rust type first.
Because this is causing an ICE in Servo, I'm rubber stamping it.
Niko Matsakis [Tue, 12 Feb 2013 00:33:31 +0000 (16:33 -0800)]
Permit lifetimes to appear in type parameter lists and after `&`. Lifetimes in
type parameter lists are currently ignored, but `&'a T` is equivalent to
`&a/T`.
bors [Fri, 15 Feb 2013 21:54:49 +0000 (13:54 -0800)]
auto merge of #4969 : nickdesaulniers/rust/issue3869, r=brson
Issue #3869
review? @nikomatsakis
Convert all uses of vec::slice to vec::view Issue #3869
Rename const_view to const_slice
Renamed mut_view to mut_slice
Fix windows build error. `buf` is borrowed by the call to
`as_mut_buf()` and so we must invoke `slice()` outside of that
call.
bors [Fri, 15 Feb 2013 18:06:12 +0000 (10:06 -0800)]
auto merge of #4958 : cpeterso/rust/reseed-rng, r=graydon
For Issue #4709:
**c531506 rt: rand.rs expects `rust_next()` to return `uint32_t`, not `size_t`**
rand.rs expects `rustrt::rand_next()` to return `u32`, but the `rand_next()` C function returns `size_t`: https://github.com/mozilla/rust/blob/ca71c6ec5bb8106121cbe33eec5a6a9ca7786039/src/libcore/rand.rs#L34
**f4320b6 move isaac RNG utility functions to new rust_rng.cpp file**
**665e900 encapsulate isaac RNG in `rust_rng` struct**
Move isaac's `randctx` into a `rust_rng` struct to make names similar to `rand::Rng` function names and prepare for auto-reseeding in the next commit.
**9a78dc9 reseed `rust_rng` after generating 32KB**
Precedents from other languages:
* Haskell's `GenAutoReseed` generator reseeds itself after generating 32KB: http://hackage.haskell.org/packages/archive/DRBG/0.1.2/doc/html/Crypto-Random-DRBG.html#t:GenAutoReseed
* Go's RNG reseeds itself after generating 1MB: https://code.google.com/p/go/source/browse/src/pkg/crypto/rand/rand_unix.go?name=go1.0.3#94
**9a76d71 don't deplete RNG entropy when there is only one runnable task**
`rust_sched_loop::schedule_task()` unnecessarily calls `isaac_rand()` for the common case when there is only 1 runnable task, thus depleting RNG entropy and incurring unnecessary overhead.
Daniel Micay [Fri, 15 Feb 2013 05:55:46 +0000 (00:55 -0500)]
rm FIXME from LinearMap's to_bucket
There are no more poor hash functions left in the codebase, and it makes
sense to rely on there being a good hash function thanks to the
inclusion of SipHash and the ease of using it with custom types.
bors [Fri, 15 Feb 2013 02:27:54 +0000 (18:27 -0800)]
auto merge of #4938 : thestinger/rust/no_zero, r=brson
I removed the unused wrappers methods named `calloc` because they relied on the malloc wrapper having a `bool zero = true` default parameter (which resulted in some accidental zeroing). Perhaps wrapping the actual calloc function would be useful, but I don't know of an existing use case that could use it so I just removed these.
This gives an ~1% performance improvement for TreeMap, which does a lot of small allocations. Vectors use `realloc` which didn't zero before these changes so there's no measurable change in performance.