about summary refs log tree commit diff
path: root/src/libstd
AgeCommit message (Collapse)AuthorLines
2013-08-26auto merge of #8766 : brson/rust/vecfromfn, r=alexcrichtonbors-4/+8
A recently-enabled test of this is causing valgrind failures.
2013-08-26std: Make vec::from_fn failure-safeBrian Anderson-4/+8
2013-08-26auto merge of #8488 : klutzy/rust/mingw-w64, r=brsonbors-15/+374
This patchset enables rustc to cross-build mingw-w64 outputs. Tested on mingw + mingw-w64 (mingw-builds, win64/seh/win32-threads/gcc-4.8.1). I also patched llvm to support Win64 stack unwinding. https://github.com/klutzy/llvm/commit/ebe22bdbcebc4f8342c4c7c50e3b61fa6c68c1ad I cross-built test/run-pass/smallest-hello-world.rs and confirmed it works. However, I also found something went wrong if I don't have custom `#[start]` routine.
2013-08-26Support Win64 context switchingklutzy-7/+31
This patch saves and restores win64's nonvolatile registers. This patch also saves stack information of thread environment block (TEB), which is at %gs:0x08 and %gs:0x10.
2013-08-26std: Add Win64 supportklutzy-3/+162
Some extern blobs are duplicated without "stdcall" abi, since Win64 does not use any calling convention. (Giving any abi to them causes llvm producing wrong bytecode.)
2013-08-26std: Bind write() on Win64klutzy-5/+15
2013-08-26std: Add Win64 typesklutzy-0/+166
2013-08-26auto merge of #8737 : blake2-ppc/rust/std-str-rsplit, r=huonwbors-73/+305
Make CharSplitIterator double-ended which is simple given that the operation is symmetric, once the split-N feature is factored out into its own adaptor. `.rsplitn_iter()` allows splitting `N` times from the back of a string, so it is a completely new feature. With the double-ended impl, `.split_iter()`, `.line_iter()`, `.word_iter()` all allow picking off elements from either end. `split_options_iter` is removed with the factoring of the split- and split-N- iterators, instead there is `split_terminator_iter`. --- Add benchmarks using `#[bench]` and tune CharSplitIterator a bit after Huon Wilson's suggestions Benchmarks 1-5 do the same split using different implementations of `CharEq`, all splitting an ascii string on ascii space. Benchmarks 6-7 split a unicode string on an ascii char. Before this PR test str::bench::split_iter_ascii ... bench: 166 ns/iter (+/- 2) test str::bench::split_iter_closure ... bench: 113 ns/iter (+/- 1) test str::bench::split_iter_extern_fn ... bench: 286 ns/iter (+/- 7) test str::bench::split_iter_not_ascii ... bench: 114 ns/iter (+/- 4) test str::bench::split_iter_slice ... bench: 220 ns/iter (+/- 12) test str::bench::split_iter_unicode_ascii ... bench: 217 ns/iter (+/- 3) test str::bench::split_iter_unicode_not_ascii ... bench: 248 ns/iter (+/- 3) PR, first commit test str::bench::split_iter_ascii ... bench: 331 ns/iter (+/- 9) test str::bench::split_iter_closure ... bench: 114 ns/iter (+/- 2) test str::bench::split_iter_extern_fn ... bench: 314 ns/iter (+/- 6) test str::bench::split_iter_not_ascii ... bench: 132 ns/iter (+/- 1) test str::bench::split_iter_slice ... bench: 157 ns/iter (+/- 3) test str::bench::split_iter_unicode_ascii ... bench: 502 ns/iter (+/- 64) test str::bench::split_iter_unicode_not_ascii ... bench: 250 ns/iter (+/- 3) PR, final version test str::bench::split_iter_ascii ... bench: 106 ns/iter (+/- 4) test str::bench::split_iter_closure ... bench: 107 ns/iter (+/- 1) test str::bench::split_iter_extern_fn ... bench: 267 ns/iter (+/- 6) test str::bench::split_iter_not_ascii ... bench: 108 ns/iter (+/- 1) test str::bench::split_iter_slice ... bench: 170 ns/iter (+/- 8) test str::bench::split_iter_unicode_ascii ... bench: 128 ns/iter (+/- 5) test str::bench::split_iter_unicode_not_ascii ... bench: 252 ns/iter (+/- 3) --- There are several ways to deal with `CharEq::only_ascii`. It is a performance optimization, so with that in mind, we allow passing bogus char (outside ascii) as long as they don't match. We use a byte value check to make sure we don't split on these (would split substrings in the middle of encoded char). (A more principled way would be to only pass the ascii codepoints to the CharEq when it indicates only_ascii, but that undoes some of the performance optimization.)
2013-08-26std::str: Tune CharSplitIterator after benchmarksblake2-ppc-55/+44
Implement Huon Wilson's suggestions (since the benchmarks agree!). Use `self.sep.matches(byte as char) && byte < 128u8` to match in the only_ascii case so that mistaken matches outside the ascii range can't create invalid substrings. Put the conditional on only_ascii outside the loop.
2013-08-26std::str: bench tests for .split_iter()blake2-ppc-0/+83
2013-08-25Add _opt variants to str byte-conversion functionsKevin Ballard-9/+108
Add _opt variants to from_bytes, from_bytes_owned, and from_bytes_slice. These variants return an Option instead of raising a condition/failing.
2013-08-25auto merge of #8723 : anasazi/rust/temporary-unkillable-io, r=brsonbors-124/+165
Also added a home_for_io_with_sched variant to consolidate some cases. This is a temporary step to resolving #8674.
2013-08-25std::str: Double-ended CharSplitIteratorblake2-ppc-68/+228
Add new methods `.rsplit_iter()` and `.rsplitn_iter()` for &str. Separate out CharSplitIterator and CharSplitNIterator, CharSplitIterator (`split_iter` and `rsplit_iter`) is made double-ended while `splitn_iter` and `rsplitn_iter` (limited to N splits) are not, since these don't have the same symmetry. With CharSplitIterator being double ended, derived iterators like `line_iter` and `word_iter` are too.
2013-08-24auto merge of #8701 : brson/rust/issue-8698, r=thestingerbors-8/+4
2013-08-24auto merge of #8637 : alexcrichton/rust/ifmt-less-hax, r=graydonbors-38/+60
Recent improvements to `&mut Trait` have made this work possible, and it solidifies that `ifmt` doesn't always have to return a string, but rather it's based around writers.
2013-08-24auto merge of #8607 : sfackler/rust/extensions, r=brsonbors-123/+122
The method names in std::rt::io::extensions::WriterByteConversions are the same as those in std::io::WriterUtils and a resolve error causes rustc to fail after trying to find an impl of io::Writer instead of trying to look for rt::io::Writer as well.
2013-08-24auto merge of #8740 : brson/rust/rt-opt, r=thestingerbors-204/+232
See #8599
2013-08-24std::rt: Enforce sanity a while longerBrian Anderson-1/+2
I'm not comfortable turning off rtassert! yet
2013-08-24std: Make vec::push_all_move call reserve_at_leastBrian Anderson-1/+1
vec::unshift uses this to add elements, scheduler queues use unshift, and this was causing a lot of reallocation
2013-08-24std::rt: Remove an unnecessary allocation from the main sched loopBrian Anderson-11/+11
2013-08-24std: Convert the runtime TLS key to a Rust global to avoid FFIBrian Anderson-15/+17
2013-08-24std::rt: Remove metrics for perfBrian Anderson-115/+0
These aren't used for anything at the moment and cause some TLS hits on some perf-critical code paths. Will need to put better thought into it in the future.
2013-08-24std::rt: Reduce MessageQueue contentionBrian Anderson-12/+69
It's not a huge win but it does reduce the amount of time spent contesting the message queue when the schedulers are under load
2013-08-24std::rt: Reduce SleeperList contentionBrian Anderson-12/+44
This makes the lock much less contended. In the test I'm running the number of times it's contended goes from ~100000 down to ~1000.
2013-08-24std::rt: Remove extra boxes from MessageQueue and SleeperListBrian Anderson-7/+6
2013-08-24std::rt: Optimize TLS use in change_task_contextBrian Anderson-1/+25
2013-08-24std: More TLS micro-optimizationBrian Anderson-12/+31
2013-08-24Add OwnedStr::into_bytesSteven Fackler-1/+16
My primary use case here is sending strings across the wire where the intermediate storage is a byte array. The new method ends up avoiding a copy.
2013-08-24Settle on the format/write/print family of namesAlex Crichton-26/+26
2013-08-24Remove ifmt hax and implement fprintfAlex Crichton-17/+39
2013-08-24auto merge of #8732 : kballard/rust/str-truncate, r=thestingerbors-0/+42
2013-08-24auto merge of #8725 : bblum/rust/docs, r=graydonbors-1/+85
This documents how to use trait bounds in a (hopefully) user-friendly way, in the containers tutorial, and also documents the task watching implementation for runtime developers in kill.rs. r anybody
2013-08-23Add new function str.truncate()Kevin Ballard-0/+42
2013-08-23std: Convert some assert!s to rtassert!Brian Anderson-5/+6
2013-08-23Define cfg(rtopt) when optimizing. Turn off runtime sanity checksBrian Anderson-2/+7
Naturally, and sadly, turning off sanity checks in the runtime is a noticable performance win. The particular test I'm running goes from ~1.5 s to ~1.3s. Sanity checks are turned *on* when not optimizing, or when cfg includes `rtdebug` or `rtassert`.
2013-08-23std: Reduce TLS accessBrian Anderson-15/+18
2013-08-23auto merge of #8716 : andrew-d/rust/andrew-fix-warnings, r=alexcrichtonbors-1/+1
Small, but whatever :8ball:
2013-08-23auto merge of #8705 : brson/rust/lesscxx, r=graydonbors-24/+7
2013-08-23rt: Remove old precise GC codeBrian Anderson-3/+0
2013-08-23rt: Remove exit_status helpersBrian Anderson-16/+5
2013-08-23rt: Memory regions are never synchronized nowBrian Anderson-5/+2
2013-08-23Document the task watching / exit code propagation implementation.Ben Blum-1/+85
2013-08-23fix performance regression from invalid IRDaniel Micay-1/+1
Monomorphize's normalization results in a 2% decrease in non-optimized code size for libstd, so there's a negligible cost to removing it. This also fixes several visit glue bugs because normalize wasn't considering the differences in visit glue between types. Closes #8720
2013-08-23Fix some vector function failure tests. Closes #8698Brian Anderson-8/+4
2013-08-23Fix two small warningsAndrew Dunham-1/+1
2013-08-23Rename {Reader,Writer}ByteConversions methodsSteven Fackler-123/+122
The method names in std::rt::io::extensions::WriterByteConversions are the same as those in std::io::WriterUtils and a resolve error causes rustc to fail after trying to find an impl of io::Writer instead of trying to look for rt::io::Writer as well. Same goes for ReaderByteConversions.
2013-08-23auto merge of #8691 : anasazi/rust/fix-timer-interface, r=brsonbors-7/+2
Resolves #8687.
2013-08-23auto merge of #8686 : kmcallister/rust/doc, r=catamorphismbors-1/+4
2013-08-23auto merge of #8681 : mrordinaire/rust/remove-set_args, r=brsonbors-25/+6
2013-08-23auto merge of #8677 : bblum/rust/scratch, r=alexcrichtonbors-51/+82
r anybody; there isn't anything complicated here