about summary refs log tree commit diff
path: root/src/libstd
AgeCommit message (Collapse)AuthorLines
2013-05-27auto merge of #6724 : thestinger/rust/swap_fast, r=thestingerbors-25/+116
Passing higher alignment values gives the optimization passes more freedom since it can copy in larger chunks. This change results in rustc outputting the same post-optimization IR as clang for swaps and most copies excluding the lack of information about padding. Code snippet: ```rust #[inline(never)] fn swap<T>(x: &mut T, y: &mut T) { util::swap(x, y); } ``` Original IR (for `int`): ```llvm define internal fastcc void @_ZN9swap_283417_a71830ca3ed2d65d3_00E(i64*, i64*) #1 { static_allocas: %2 = icmp eq i64* %0, %1 br i1 %2, label %_ZN4util9swap_283717_a71830ca3ed2d65d3_00E.exit, label %3 ; <label>:3 ; preds = %static_allocas %4 = load i64* %0, align 1 %5 = load i64* %1, align 1 store i64 %5, i64* %0, align 1 store i64 %4, i64* %1, align 1 br label %_ZN4util9swap_283717_a71830ca3ed2d65d3_00E.exit _ZN4util9swap_283717_a71830ca3ed2d65d3_00E.exit: ; preds = %3, %static_allocas ret void } ``` After #6710: ```llvm define internal fastcc void @_ZN9swap_283017_a71830ca3ed2d65d3_00E(i64* nocapture, i64* nocapture) #1 { static_allocas: %2 = load i64* %0, align 1 %3 = load i64* %1, align 1 store i64 %3, i64* %0, align 1 store i64 %2, i64* %1, align 1 ret void } ``` After this change: ```llvm define internal fastcc void @_ZN9swap_283017_a71830ca3ed2d65d3_00E(i64* nocapture, i64* nocapture) #1 { static_allocas: %2 = load i64* %0, align 8 %3 = load i64* %1, align 8 store i64 %3, i64* %0, align 8 store i64 %2, i64* %1, align 8 ret void } ``` Another example: ```rust #[inline(never)] fn set<T>(x: &mut T, y: T) { *x = y; } ``` Before, with `(int, int)` (align 1): ```llvm define internal fastcc void @_ZN8set_282517_8fa972e3f9e451983_00E({ i64, i64 }* nocapture, { i64, i64 }* nocapture) #1 { static_allocas: %2 = bitcast { i64, i64 }* %1 to i8* %3 = bitcast { i64, i64 }* %0 to i8* tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* %3, i8* %2, i64 16, i32 1, i1 false) ret void } ``` After, with `(int, int)` (align 8): ```llvm define internal fastcc void @_ZN8set_282617_8fa972e3f9e451983_00E({ i64, i64 }* nocapture, { i64, i64 }* nocapture) #1 { static_allocas: %2 = bitcast { i64, i64 }* %1 to i8* %3 = bitcast { i64, i64 }* %0 to i8* tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* %3, i8* %2, i64 16, i32 8, i1 false) ret void } ```
2013-05-27fix casts on 32-bitDaniel Micay-2/+2
2013-05-27auto merge of #6703 : sanxiyn/rust/allocation-lint, r=sanxiynbors-5/+5
Fix #6145. In particular, handle operator overloading.
2013-05-28Remove unnecessary allocations flagged by lintSeo Sanghyeon-5/+5
2013-05-27Get rid of no-longer-needed #[doc(hidden)] attributes.Lindsey Kuper-11/+2
There were several old `#[doc(hidden)]` attributes in libstd and libextra, left over from when rustdoc didn't hide private definitions, tagged with `FIXME #3538`. Since #3538 is now closed, I removed the `#[doc(hidden)]` attributes as well as the FIXMEs, but I left `#[doc(hidden)]` in libstd/task/spawn.rs and libstd/task/rt.rs since those two are apparently `pub`, as well as in libextra/std.rc since std/extra is `pub`.
2013-05-27auto merge of #6763 : steveklabnik/rust/core_to_std, r=thestingerbors-20/+20
When I submitted #6748 yesterday, I used the old name. r? @thestinger
2013-05-27Fix docs to use std instead of core.Steve Klabnik-20/+20
When I submitted #6748 yesterday, I used the old name.
2013-05-27Rename unwrap_input/unwrap_output as suggested bygareth-11/+11
@brson. Also fix a few documentation bugs.
2013-05-27Make test_change_working_directory change the currentgareth-3/+5
directory to be the parent of the current-current directory, instead of changing to the tmp directory, which was causing issues with OS X and its /tmp => /private/tmp symlink.
2013-05-27Refactor core::run in order to address many of the issuesgareth-304/+607
mentioned in #2625. This change makes the module more oriented around Process values instead of having to deal with process ids directly. Apart from issues mentioned in #2625, other changes include: - Changing the naming to be more consistent - Process/process is now used instead of a mixture of Program/program and Process/process. - More docs/tests. Some io/scheduler related issues remain (mentioned in #2625).
2013-05-26auto merge of #6748 : steveklabnik/rust/bool_docs, r=thestingerbors-19/+194
There was some before, but now we have a big header, as well as lots of individual bits of documentation.
2013-05-26Add documentation for libstd/bool.rs.Steve Klabnik-19/+194
There was some before, but now we have a big header, as well as lots of individual bits of documentation.
2013-05-26inline bump_box_refcountDaniel Micay-0/+1
2013-05-26make transmute_copy use memcpy, and inline itDaniel Micay-0/+21
2013-05-26use uninit for cast::transmute_copyDaniel Micay-1/+1
2013-05-26add memset32/memset64Daniel Micay-0/+34
2013-05-26C++0x -> C++11Daniel Micay-1/+1
2013-05-26make the memcpy/memmove intrinsics higher-levelDaniel Micay-23/+58
This allows them to make use of the type's alignment, instead of being pessimistic and assuming it is only 1.
2013-05-25testsuite: Add a test for listing the root directory...Tim Chevalier-1/+15
...and don't treat Path("/") like Path("").
2013-05-25core: Fail with a better error message when list_dir gets an empty pathTim Chevalier-0/+11
(Yes, this did happen in real life...)
2013-05-25auto merge of #6722 : alexcrichton/rust/issue-4219-no-merge-hack, r=brsonbors-1149/+941
Changes the int/uint modules to all use macros instead of using the `merge` attribute. It would be nice to have #4375 resolved as well for this, but that can probably come at a later date. Closes #4219.
2013-05-25Add basic atomic typesJames Miller-0/+344
2013-05-24Remove usage of the #[merge] hack with int modulesAlex Crichton-1149/+941
2013-05-24auto merge of #6712 : thestinger/rust/derive, r=catamorphismbors-24/+2
2013-05-24use deriving for DeepCloneDaniel Micay-24/+2
2013-05-23auto merge of #6710 : thestinger/rust/swap, r=catamorphismbors-6/+44
2013-05-23optimize util::swap, &mut pointers never aliasDaniel Micay-3/+35
2013-05-24make arm register definition consistent with rtJyun-Yan You-1/+1
2013-05-23add memcpy intrinsic to mirror memmoveDaniel Micay-0/+7
2013-05-23swap_ptr: rm equality checkDaniel Micay-3/+2
This isn't needed semantically, and it's the wrong case to optimize for.
2013-05-23cleanup warnings from libstdErick Tryzelaar-566/+545
2013-05-23core: remove iter_bytes helper functionsErick Tryzelaar-36/+0
2013-05-22libstd: Fix merge fallout.Patrick Walton-0/+3238
2013-05-22syntax: Change syntax extensions to expand to `std::foo` instead of `core::foo`Patrick Walton-0/+10
2013-05-22libextra: Rename the actual metadata names of libcore to libstd and libstd ↵Patrick Walton-7/+8
to libextra
2013-05-22librustc: Rename core injection to std injectionPatrick Walton-2/+3
2013-05-22libstd: Rename libcore to libstd and libstd to libextra; update makefiles.Patrick Walton-32134/+52668
This only changes the directory names; it does not change the "real" metadata names.
2013-05-22add smallintsetJihyun Yu-1/+242
2013-05-20auto merge of #6647 : alexcrichton/rust/unnecessary-alloc, r=graydonbors-60/+60
This adds a lint mode for detecting unnecessary allocations on the heap. This isn't super fancy, currently it only has two rules 1. For a function's arguments, if you allocate a `[~|@]str` literal, when the type of the argument is a `&str`, emit a warning. 2. For the same case, emit warnings for boxed vectors when slices are required. After adding the lint, I rampaged through the libraries and removed all the unnecessary allocations I could find.
2013-05-20auto merge of #6372 : brson/rust/intrinsics, r=catamorphismbors-12/+6
...s
2013-05-20auto merge of #6639 : osaut/rust/arc-clean, r=brsonbors-4/+34
* Add ARC::get method and implements the function from it. * Add an example showing a simple use of ARC. Update PR #6622 to avoid git noise. I will remove the function get later.
2013-05-20Replace all uses of rust-intrinsic ABI with calls to unstable::intrinsicsBrian Anderson-12/+6
2013-05-20Remove all unnecessary allocations (as flagged by lint)Alex Crichton-60/+60
2013-05-20Remove two warnings about unneccesary safe blocks.Steve Klabnik-6/+2
Since a snapshot was done last night, these are good to go.
2013-05-20Add ARC::get method and implements the function from it. Add an example ↵Olivier Saut-2/+32
showing a simple use of ARC.
2013-05-20Typo corrected and updated copyright yearsOlivier Saut-2/+2
2013-05-19Register snapshotsBrian Anderson-1814/+0
2013-05-19auto merge of #6106 : thestinger/rust/iter, r=bstriebors-16/+11
I don't have a strong opinion on the function vs. method, but there's no point in having both. I'd like to make a `repeat` adaptor like Python/Haskell for turning a value into an infinite stream of the value, so this has to at least be renamed.
2013-05-19Use assert_eq! rather than assert! where possibleCorey Richardson-547/+547
2013-05-18auto merge of #6577 : brson/rust/io-upstream, r=pcwaltonbors-16/+9
r? This is all of my scheduler work on #4419 from the last 3 weeks or so. I've had a few failed pull requests so far but I think the problems are ironed out. * TCP * The beginnings of runtime embedding APIs * Porting various corners of core to be compatible with both schedulers * libuv timer bindings * Further refinement of I/O error handling, including a new, incomplete, `read_error` condition * Incomplete refactoring to make tasks work without coroutines and user-space scheduling * Implementations of Reader/Writer extension methods * Implementations of the most important part of core::comm I'm particularly happy with how easy the [comm types on top of the scheduler](https://github.com/brson/rust/blob/io-upstream/src/libcore/rt/comm.rs). Note that these implementations do not use pipes. If anything here needs careful review though it's this code. This branch passes 95% of the run-pass tests (with `TESTARGS=--newrt`) In the next week I'll probably spend some time adding preliminary multithreading and seeing how close we are to removing the old runtime.