Commit Graph

26584 Commits

Author SHA1 Message Date
Alex Crichton
28fa81a954 Invoke gcc with -nodefaultlibs
This will hopefully bring us closer to #11937. We're still using gcc's idea of
"startup files", but this should prevent us from leaking in dependencies that we
don't quite want (libgcc for example once compiler-rt is what we use).
2014-02-14 08:07:46 -08:00
Eduard Burtescu
6e84023596 Removed the obsolete ast::CallSugar (previously used by do). 2014-02-14 07:48:13 -08:00
Steven Fackler
07ea23e15d Expand ItemDecorator extensions in all contexts
Now that fold_item can return multiple items, this is pretty trivial. It
also recursively expands generated items so ItemDecorators can generate
items that are tagged with ItemDecorators!

Closes #4913
2014-02-14 07:48:00 -08:00
Edward Wang
c1fac65396 Add test for #8860 2014-02-14 07:47:45 -08:00
HeroesGrave
11b2515f0f Removed libextra dependency from libsyntax. 2014-02-14 07:47:31 -08:00
Dave Hodder
3f54ca1ec4 Add function doc comments for extra::url::* 2014-02-14 07:47:17 -08:00
Flavio Percoco
a289587dd3 Ensure an error is raised on infinite recursion 2014-02-14 07:47:05 -08:00
Eduard Burtescu
3af5f38f3c Don't copy &Trait and &mut Trait to temporaries for every call. 2014-02-14 07:46:41 -08:00
Alex Crichton
ee2a888860 extra: Capture stdout/stderr of tests by default
When tests fail, their stdout and stderr is printed as part of the summary, but
this helps suppress failure messages from #[should_fail] tests and generally
clean up the output of the test runner.
2014-02-14 07:46:29 -08:00
lpy
665555d58f return value/use extra::test::black_box in benchmarks 2014-02-14 07:45:34 -08:00
bors
92c5738aae auto merge of #12207 : alexcrichton/rust/up-llvm, r=sfackler
Includes an upstream commit by pcwalton to improve codegen of our enums getting
moved around.

This also introduces a new commit on top of our stack of patches to fix a mingw32 build issue. I have submitted the patch upstream: http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20140210/204653.html

I verified that this builds on the try bots, which amazes me because I think that c++11 is turned on now, but I guess we're still lucky!

Closes #10613 (pcwalton's patch landed)
Closes #11992 (llvm has removed these options)
2014-02-14 07:26:40 -08:00
Alex Crichton
804955f79a Upgrade LLVM
Includes an upstream commit by pcwalton to improve codegen of our enums getting
moved around.
2014-02-14 07:22:49 -08:00
bors
18477ac68a auto merge of #12234 : sfackler/rust/restructure-item-decorator, r=huonw
The old method of building up a list of items and threading it through
all of the decorators was unwieldy and not really scalable as
non-deriving ItemDecorators become possible. The API is now that the
decorator gets an immutable reference to the item it's attached to, and
a callback that it can pass new items to. If we want to add syntax
extensions that can modify the item they're attached to, we can add that
later, but I think it'll have to be separate from ItemDecorator to avoid
strange ordering issues.

@huonw
2014-02-14 06:11:43 -08:00
bors
d40b537405 auto merge of #12192 : luqmana/rust/fix-cross, r=alexcrichton
Fix some fall out from the big command line option changes.
2014-02-14 01:41:46 -08:00
bors
03b324ff44 auto merge of #12186 : alexcrichton/rust/no-sleep-2, r=brson
Any single-threaded task benchmark will spend a good chunk of time in `kqueue()` on osx and `epoll()` on linux, and the reason for this is that each time a task is terminated it will hit the syscall. When a task terminates, it context switches back to the scheduler thread, and the scheduler thread falls out of `run_sched_once` whenever it figures out that it did some work.

If we know that `epoll()` will return nothing, then we can continue to do work locally (only while there's work to be done). We must fall back to `epoll()` whenever there's active I/O in order to check whether it's ready or not, but without that (which is largely the case in benchmarks), we can prevent the costly syscall and can get a nice speedup.

I've separated the commits into preparation for this change and then the change itself, the last commit message has more details.
2014-02-14 00:26:47 -08:00
bors
2fe7bfe4d2 auto merge of #12162 : eddyb/rust/ast-map-cheap-path, r=nikomatsakis 2014-02-13 23:06:46 -08:00
Eduard Burtescu
a02b10a062 Refactored ast_map and friends, mainly to have Paths without storing them. 2014-02-14 08:43:29 +02:00
Steven Fackler
3c02749ad8 Tweak ItemDecorator API
The old method of building up a list of items and threading it through
all of the decorators was unwieldy and not really scalable as
non-deriving ItemDecorators become possible. The API is now that the
decorator gets an immutable reference to the item it's attached to, and
a callback that it can pass new items to. If we want to add syntax
extensions that can modify the item they're attached to, we can add that
later, but I think it'll have to be separate from ItemDecorator to avoid
strange ordering issues.
2014-02-13 21:53:06 -08:00
bors
8d6fef674d auto merge of #12256 : brson/rust/android, r=alexcrichton
Android bot has been having some problems. A few details in the commits.
2014-02-13 21:51:52 -08:00
Brian Anderson
6784179352 Stop looping on error waiting for android test results
These seem to be causing iloops on the bots. Let's rather see the errors.
2014-02-13 21:19:06 -08:00
Brian Anderson
a06ce0c91f compiletest: Run all android tests serially
This is an attempt to isolate test failures on the bots. It may also
eliminate problems with the emulators breaking by reducing the chance
of OOM.
2014-02-13 21:17:02 -08:00
bors
22c34f3c4c auto merge of #12172 : alexcrichton/rust/green-improvements, r=brson
These commits pick off some low-hanging fruit which were slowing down spawning green threads. The major speedup comes from fixing a bug in stack caching where we never used any cached stacks!

The program I used to benchmark is at the end. It was compiled with `rustc --opt-level=3 bench.rs --test` and run as `RUST_THREADS=1 ./bench --bench`. I chose to use `RUST_THREADS=1` due to #11730 as the profiles I was getting interfered too much when all the schedulers were in play (and shouldn't be after #11730 is fixed). All of the units below are in ns/iter as reported by `--bench` (lower is better).

|               | green | native | raw    |
| ------------- | ----- | ------ | ------ |
| osx before    | 12699 | 24030  | 19734  |
| linux before  | 10223 | 125983 | 122647 |
| osx after     |  3847 | 25771  | 20835  |
| linux after   |  2631 | 135398 | 122765 |

Note that this is *not* a benchmark of spawning green tasks vs native tasks. I put in the native numbers just to get a ballpark of where green tasks are. This is benchmark is *clearly* benefiting from stack caching. Also, OSX is clearly not 5x faster than linux, I think my VM is just much slower.

All in all, this ended up being a nice 4x speedup for spawning a green task when you're using a cached stack.

```rust
extern mod extra;
extern mod native;
use std::rt:🧵:Thread;

#[bench]
fn green(bh: &mut extra::test::BenchHarness) {
    let (p, c) = SharedChan::new();
    bh.iter(|| {
        let c = c.clone();
        spawn(proc() {
            c.send(());
        });
        p.recv();
    });
}

#[bench]
fn native(bh: &mut extra::test::BenchHarness) {
    let (p, c) = SharedChan::new();
    bh.iter(|| {
        let c = c.clone();
        native::task::spawn(proc() {
            c.send(());
        });
        p.recv();
    });
}

#[bench]
fn raw(bh: &mut extra::test::BenchHarness) {
    bh.iter(|| {
        Thread::start(proc() {}).join()
    });
}
```
2014-02-13 20:36:55 -08:00
Alex Crichton
301ff0c2df Remove two allocations from spawning a green task
Two unfortunate allocations were wrapping a proc() in a proc() with
GreenTask::build_start_wrapper, and then boxing this proc in a ~proc() inside of
Context::new(). Both of these allocations were a direct result from two
conditions:

1. The Context::new() function has a nice api of taking a procedure argument to
   start up a new context with. This inherently required an allocation by
   build_start_wrapper because extra code needed to be run around the edges of a
   user-provided proc() for a new task.

2. The initial bootstrap code only understood how to pass one argument to the
   next function. By modifying the assembly and entry points to understand more
   than one argument, more information is passed through in registers instead of
   allocating a pointer-sized context.

This is sadly where I end up throwing mips under a bus because I have no idea
what's going on in the mips context switching code and don't know how to modify
it.

Closes #7767
cc #11389
2014-02-13 20:31:17 -08:00
Alex Crichton
21a064d5a3 Don't require an allocation for on_exit messages
Instead, use an enum to allow running both a procedure and sending the task
result over a channel. I expect the common case to be sending on a channel (e.g.
task::try), so don't require an extra allocation in the common case.

cc #11389
2014-02-13 20:29:47 -08:00
Alex Crichton
aaead93c45 Don't allocate in LocalHeap::new()
One of these is allocated for every task, trying to cut down on allocations

cc #11389
2014-02-13 20:29:47 -08:00
Alex Crichton
d5e0622f95 Fix a bug where cached stacks weren't re-used
The condition was the wrong direction and it also didn't take equality into
account. Tests were added for both cases.

For the small benchmark of `task::try(proc() {}).unwrap()`, this takes the
iteration time on OSX from 15119 ns/iter to 6179 ns/iter (timed with
RUST_THREADS=1)

cc #11389
2014-02-13 20:29:46 -08:00
bors
68129d299b auto merge of #12061 : pongad/rust/delorderable, r=cmr
#12057
2014-02-13 19:16:59 -08:00
Michael Darakananda
bf1464c413 Removed num::Orderable 2014-02-13 20:12:59 -05:00
bors
89b1686bd7 auto merge of #12017 : FlaPer87/rust/replace-mod-crate, r=alexcrichton
The first setp for #9880 is to add a new `crate` keyword. This PR does exactly that. I took a chance to refactor `parse_item_foreign_mod` and I broke it down into 2 separate methods to isolate each feature.

The next step will be to push a new stage0 snapshot and then get rid of all `extern mod` around the code.
2014-02-13 16:32:01 -08:00
bors
94d453e459 auto merge of #12248 : alexcrichton/rust/rollup, r=alexcrichton
This passed `make check` locally, so hopefully it passes on bors!
2014-02-13 15:17:21 -08:00
Luqman Aden
ffdda22aa2 mk: Fix non-android cross builds. 2014-02-13 18:11:23 -05:00
Alex Crichton
640b22852f Rebase conflicts from this giant stack of patches
List of PRs contained in this rollup:

Closes #12167 r=alexcrichton
Closes #12200 r=alexcrichton
Closes #12206 r=pcwalton
Closes #12209 r=huonw
Closes #12211 r=pcwalton
Closes #12217 r=brson
Closes #12218 r=alexcrichton
Closes #12220 r=alexcrichton
Closes #12222 r=kballard
Closes #12225 r=alexcrichton
Closes #12227 r=kballard
Closes #12237 r=alexcrichton
Closes #12240 r=kballard
2014-02-13 13:33:46 -08:00
Alex Crichton
76c313ceb1 Lift $dst outside the closure in write!
If you were writing to something along the lines of `self.foo` then with the new
closure rules it meant that you were borrowing `self` for the entirety of the
closure, meaning that you couldn't format other fields of `self` at the same
time as writing to a buffer contained in `self`.

By lifting the borrow outside of the closure the borrow checker can better
understand that you're only borrowing one of the fields at a time. This had to
use type ascription as well in order to preserve trait object coercions.
2014-02-13 13:05:48 -08:00
JeremyLetang
60bc76fb78 remove duplicate function from std::ptr (is_null, is_not_null, offset, mut_offset) 2014-02-13 12:54:17 -08:00
Alex Crichton
1c5295c0bf Register new snapshots 2014-02-13 12:54:17 -08:00
Huon Wilson
44e6883d14 mk: make NO_REBUILD more forceful and more general.
Previously crates like `green` and `native` would still depend on their
parents when running `make check-stage2-green NO_REBUILD=1`, this
ensures that they only depend on their source files.

Also, apply NO_REBUILD to the crate doc tests, so, for example,
`check-stage2-doc-std` will use an already compiled `rustdoc` directly.
2014-02-13 12:54:01 -08:00
Alex Crichton
065e121fc2 Relax an assertion in start_selection()
It asserted that the previous count was always nonnegative, but DISCONNECTED is
a valid value for it to see. In order to continue to remember to store
DISCONNECTED after DISCONNECTED was seen, I also added a helper method.

Closes #12226
2014-02-13 12:54:01 -08:00
Huon Wilson
411a01feb3 std::comm: replace Handle.id with a method.
The `id` shouldn't be changed by external code, and exposing it publicly
allows to be accidentally changed.

Also, remove the first element special case in the `select!` macro.
2014-02-13 12:54:01 -08:00
Tobias Bucher
866d6cc33d Add documentation for conditional-compilation
This documents in-source conditions using #[cfg(...)] and configurations
pre-defined by the compiler.

Fix #7962.
2014-02-13 12:54:01 -08:00
Brendan Zabarauskas
957fcb3f54 Add some missing Show implementations in libstd 2014-02-13 12:54:01 -08:00
Liigo Zhuang
8a5b938b3b Move base64 and hex from libextra to libserialize 2014-02-13 12:50:25 -08:00
Felix S. Klock II
7dc187afd8 Remove a source of O(n^2) running time in bigints.
::num::bigint, Remove a source of O(n^2) running time in `fn shr_bits`.

I'll cut to the chase: On my laptop, this brings the running time on
`pidigits 2000` (from src/test/bench/shootout-pidigits.rs) from this:
```
% time ./pidigits 2000 > /dev/null

real	0m7.695s
user	0m7.690s
sys	0m0.005s
```
to this:
```
% time ./pidigits 2000 > /dev/null

real	0m0.322s
user	0m0.318s
sys	0m0.004s
```

The previous code was building up a vector by repeatedly making a
fresh copy for each element that was unshifted onto the front,
yielding quadratic running time.  This fixes that by building up the
vector in reverse order (pushing elements onto the end) and then
reversing it.

(Another option would be to build up a zero-initialized vector of the
desired length and then installing all of the shifted result elements
into their target index, but this was easier to hack up quickly, and
yields the desired asymptotic improvement.  I have been thinking of
adding a `vec::from_fn_rev` to handle this case, maybe I will try that
this weekend.)
2014-02-13 12:50:25 -08:00
Seo Sanghyeon
606c23a789 Resolve type variables when checking casting to char 2014-02-13 12:50:25 -08:00
Alex Crichton
745aa7482a Include compiler-rt in the distribution tarballs 2014-02-13 12:50:25 -08:00
Steven Fackler
6b429d07c9 Stop unloading syntax libraries
Externally loaded libraries are able to do things that cause references
to them to survive past the expansion phase (e.g. creating @-box cycles,
launching a task or storing something in task local data). As such, the
library has to stay loaded for the lifetime of the process.
2014-02-13 12:50:24 -08:00
Flavio Percoco
5deb3c9ca0 Remove obsolete warnings for extern mod
This patch gets rid of ObsoleteExternModAttributesInParens and
ObsoleteNamedExternModule since the replacement of `extern mod` with
`extern crate` avoids those cases and raises different errors. Both have
been around for at least a version which makes this a good moment to get
rid of them.
2014-02-13 20:52:17 +01:00
Flavio Percoco
9a6d92c1d7 Replace extern mod with extern crate
This patch adds a new keyword `crate` which is intended to replace mod
in the context of `extern mod` as part of the issue #9880. The patch
doesn't replace all `extern mod` cases since it is necessary to first
push a new snapshot 0.

The implementation could've been less invasive than this. However I
preferred to take this chance to split the `parse_item_foreign_mod`
method and pull the `extern crate` part out of there, hence the new
method `parse_item_foreign_crate`.
2014-02-13 20:52:16 +01:00
Flavio Percoco
968633b60a Replace crate usage with krate
This patch replaces all `crate` usage with `krate` before introducing the
new keyword. This ensures that after introducing the keyword, there
won't be any compilation errors.

krate might not be the most expressive substitution for crate but it's a
very close abbreviation for it. `module` was already used in several
places already.
2014-02-13 20:52:07 +01:00
bors
cfb87f10ec auto merge of #12210 : zr40/rust/patch-1, r=cmr
According to kimundi on IRC, the current term for `()` is 'unit'. This commit updates tutorial.md to change 'nil' to 'unit' where `()` is described.
2014-02-13 10:32:18 -08:00
Yehuda Katz
4667c492b5 Adds support for working with URL Paths
It is sometimes useful to parse just the path portion of a URL (path,
query string and fragment) rather than the entire URL.
2014-02-12 21:28:58 -08:00