Commit Graph

23908 Commits

Author SHA1 Message Date
bors
c0b7972f7d auto merge of #10422 : alexcrichton/rust/explicit-crate-map, r=pcwalton
As we start to move runtime components into the crate map, it's becoming harder
and harder to start the runtime from a C function as rust is embedded in another
application. Right now if you compile a rust crate as a dynamic library which is
then linked to another application, when using std::rt::start there are no I/O
local services, even though rustuv was linked against and requested. The reason
for this is that there is no top level crate map available specifying where to
find libuv I/O.

This option is not meant to be used regularly, but rather whenever compiling a
final library crate and linking it into another application. This lifts the
requirement that to get a crate map you must have the final destination be an
executable.
2013-11-11 16:11:22 -08:00
bors
88e383ef1e auto merge of #10419 : brson/rust/conditiondocs, r=alexcrichton
Fixes #8553 by just not mentioning TLS, and instead just referring to the 'task-local condition handler'.
2013-11-11 13:16:24 -08:00
bors
23746ae990 auto merge of #10403 : poiru/rust/issue-2675, r=alexcrichton
Closes #2675.
2013-11-11 12:06:25 -08:00
Alex Crichton
0cc5e6c83f Remove resolve's xray infrastructure
Since the removal of privacy from resolve, this flag is no longer necessary to
get the test runner working. All of the privacy checks are bypassed by a special
item attribute in the privacy visitor.

Closes #4947
2013-11-11 11:26:31 -08:00
Leah Hanson
a5b6d8d7c2 Remove test issue-3461
According to issue #3461, it doesn't sound like this is planned to be fixed.
2013-11-11 13:25:07 -06:00
Birunthan Mohanathas
36afd60609 Add asserts to check for faililng QueryPerformance* calls in precise_time_ns
Closes #2675.
2013-11-11 21:21:51 +02:00
Birunthan Mohanathas
61f76a5130 Change use of unsigned integers to signed integers for clarity in
precise_time_ns

The QueryPerformance* functions take a LARGE_INTEGER, which is a signed
64-bit integer rather than an unsigned 64-bit integer. `ts.tv_sec`, too,
is a signed integer so `ns_per_s` has been changed to a int64_t.
2013-11-11 21:21:24 +02:00
Leah Hanson
ba4bf7ec33 Remove run-pass/issue-3907-2.rs
This test is not supposed to compile; there is an equivalent test in compile-fail/issue-3907.rs.
2013-11-11 12:59:00 -06:00
bors
0966ec01dc auto merge of #10407 : alexcrichton/rust/no-fixed-stack-segment, r=brson
The commit messages have more details, but this removes all analysis and usage related to fixed_stack_segment and rust_stack attributes. It's now the assumption that we always have "enough stack" and we'll implement detection of stack overflow through other means.

The stack overflow detection is currently implemented for rust functions, but it is unimplemented for C functions (we still don't have guard pages).
2013-11-11 10:46:28 -08:00
Alex Crichton
1f19243095 Decrease the default stack size back to 2MB
I increased this to 4MB when I implemented abort-on-stack-overflow for Rust
functions. Now that the fixed_stack_segment attribute is removed, no rust
function will ever reasonably request 2MB of stack (due to calling an FFI
function).

The default size of 2MB should be plenty for everyday use-cases, and tasks can
still request more stack via the spawning API.
2013-11-11 10:40:34 -08:00
Alex Crichton
7755ffd013 Remove #[fixed_stack_segment] and #[rust_stack]
These two attributes are no longer useful now that Rust has decided to leave
segmented stacks behind. It is assumed that the rust task's stack is always
large enough to make an FFI call (due to the stack being very large).

There's always the case of stack overflow, however, to consider. This does not
change the behavior of stack overflow in Rust. This is still normally triggered
by the __morestack function and aborts the whole process.

C stack overflow will continue to corrupt the stack, however (as it did before
this commit as well). The future improvement of a guard page at the end of every
rust stack is still unimplemented and is intended to be the mechanism through
which we attempt to detect C stack overflow.

Closes #8822
Closes #10155
2013-11-11 10:40:34 -08:00
Leah Hanson
2d6ef29e68 Removed test issue-912.rs
This was marked xfail-test
According to rust's issue #912, this will not be fixed.
There's no point in keeping the test if it is never intended to pass.
2013-11-11 12:12:39 -06:00
Alex Crichton
cdf7d63bfc Optimize creation of buffered readers/writers
I was benchmarking rust-http recently, and I saw that 50% of its time was spent
creating buffered readers/writers. Albeit rust-http wasn't using
std::rt::io::buffered, but the same idea applies here. It's much cheaper to
malloc a large region and not initialize it than to set it all to 0. Buffered
readers/writers never use uninitialized data, and their internal buffers are
encapsulated, so any usage of uninitialized slots are an implementation bug in
the readers/writers.
2013-11-11 10:08:03 -08:00
Alex Crichton
2eb92b77a9 Add a flag to force generating toplevel crate map
As we start to move runtime components into the crate map, it's becoming harder
and harder to start the runtime from a C function as rust is embedded in another
application. Right now if you compile a rust crate as a dynamic library which is
then linked to another application, when using std::rt::start there are no I/O
local services, even though rustuv was linked against and requested. The reason
for this is that there is no top level crate map available specifying where to
find libuv I/O.

This option is not meant to be used regularly, but rather whenever compiling a
final library crate and linking it into another application. This lifts the
requirement that to get a crate map you must have the final destination be an
executable.
2013-11-11 09:26:24 -08:00
bors
4d9b95fada auto merge of #10417 : cmr/rust/vec_overflow, r=huonw
Fixes #10271
2013-11-11 08:56:18 -08:00
bors
4059b5c4b3 auto merge of #10409 : alexcrichton/rust/issue-10386, r=brson
Turns out the pipe names must have special names on windows. Once we have
special names, all the tests pass just fine.

Closes #10386
2013-11-11 07:46:18 -08:00
bors
c47986b675 auto merge of #10394 : yichoi/rust/make_check_pass_android, r=brson
To enable test on android bot #9120

some tests are disabled and can be fixed further.
2013-11-11 06:21:16 -08:00
Seo Sanghyeon
2337d88339 Fix path parsing 2013-11-11 21:53:14 +09:00
Brian Anderson
e34834375d doc: Don't mention TLS in condition tutorial 2013-11-11 04:29:09 -08:00
bors
be79d7ecdc auto merge of #10416 : cmr/rust/range_size_hint, r=huonw 2013-11-11 04:26:12 -08:00
Corey Richardson
fc01f20c42 Implement size_hint for Range
Closes #8606
2013-11-11 07:22:30 -05:00
Corey Richardson
a46b2b8e7a vec: with_capacity: check for overflow
Fixes #10271
2013-11-11 06:09:28 -05:00
Corey Richardson
2c18983ea5 Clean lint on test build 2013-11-11 05:00:48 -05:00
bors
46100c0622 auto merge of #10408 : alexcrichton/rust/snapshots, r=huonw
Mostly just using the `system` abi where possible.
2013-11-10 21:56:08 -08:00
Alex Crichton
681ea93d52 Enable uv pipe tests on windows
Turns out the pipe names must have special names on windows. Once we have
special names, all the tests pass just fine.

Closes #10386
2013-11-10 20:43:08 -08:00
Alex Crichton
7407bcc1a2 Register new snapshots 2013-11-10 17:51:56 -08:00
bors
63cfc9989d auto merge of #10406 : alexcrichton/rust/issue-10405, r=huonw
The logging macros all use libuv-based I/O, and there was one stray debug
statement in task::spawn which was executing before the I/O context was ready.
Remove it and add a test to make sure that we can continue to debug this sort of
code.

Closes #10405
2013-11-10 16:01:12 -08:00
bors
95b46a1763 auto merge of #10226 : nibrahim/rust/docepub, r=alexcrichton
Added two new rules to create epubs out of the tutorial and reference manual source files. This is useful and doesn't add any new dependencies to the build process.
2013-11-10 14:46:04 -08:00
Alex Crichton
64afa4ea22 Only run dsymutil on OSX in debug builds
When there are no debug symbols generated, then the program just prints an
annoying warning otherwise.

Closes #10198
2013-11-10 13:58:11 -08:00
bors
fe48d8fcd1 auto merge of #10399 : huonw/rust/get-opt-doc, r=alexcrichton 2013-11-10 13:36:11 -08:00
Alex Crichton
b71d629744 Remove a debug! statement before I/O is ready
The logging macros all use libuv-based I/O, and there was one stray debug
statement in task::spawn which was executing before the I/O context was ready.
Remove it and add a test to make sure that we can continue to debug this sort of
code.

Closes #10405
2013-11-10 13:05:36 -08:00
bors
b5e602ac56 auto merge of #10321 : alexcrichton/rust/uv-rewrite, r=brson
The major impetus for this pull request was to remove all usage of `~fn()` in `librustuv`. This construct is going away as a language feature, and additionally it imposes the requirement that all I/O operations have at least one allocation. This allocation has been seen to have a fairly high performance impact in profiles of I/O benchmarks.

I've migrated `librustuv` away from all usage of `~fn()`, and at the same time it no longer allocates on every I/O operation anywhere. The scheduler is now much more tightly integrated with all of the libuv bindings and most of the uv callbacks are specialized functions for a certain procedure. This is a step backwards in terms of making `librustuv` usable anywhere else, but I think that the performance gains are a big win here.

In just a simple benchmark of reading/writing 4k of 0s at a time between a tcp client/server in separate processes on the same system, I have witnessed the throughput increase from ~750MB/s to ~1200MB/s with this change applied.

I'm still in the process of testing this change, although all the major bugs (to my knowledge) have been fleshed out and removed. There are still a few spurious segfaults, and that's what I'm currently investigating. In the meantime, I wanted to put this up for review to get some eyes on it other than mine. I'll update this once I've got all the tests passing reliably again.
2013-11-10 12:26:10 -08:00
Alex Crichton
e38a89d0b0 Fix usage of libuv for windows 2013-11-10 12:23:57 -08:00
Huon Wilson
8e719bdfb5 extra::getopts: update docs for minor renaming. 2013-11-10 23:28:26 +11:00
Alex Crichton
c5fdd69d3e Carefully destroy channels at the right time.
When a channel is destroyed, it may attempt scheduler operations which could
move a task off of it's I/O scheduler. This is obviously a bad interaction, and
some finesse is required to make it work (making destructors run at the right
time).

Closes #10375
2013-11-10 01:37:12 -08:00
Alex Crichton
86a321b65d Another round of test fixes from previous commits 2013-11-10 01:37:12 -08:00
Alex Crichton
3a3eefc5c3 Update to the latest libuv
At this time, also point the libuv submodule to the official repo instead of my
own off to the side.

cc #10246
Closes #10329
2013-11-10 01:37:11 -08:00
Alex Crichton
b652bbc670 Fall back from uv tty instances more aggressively
It appears that uv's support for interacting with a stdio stream as a tty when
it's actually a pipe is pretty problematic. To get around this, promote a check
to see if the stream is a tty to the top of the tty constructor, and bail out
quickly if it's not identified as a tty.

Closes #10237
2013-11-10 01:37:11 -08:00
Alex Crichton
df4c0b8e43 Make the uv bindings resilient to linked failure
In the ideal world, uv I/O could be canceled safely at any time. In reality,
however, we are unable to do this. Right now linked failure is fairly flaky as
implemented in the runtime, making it very difficult to test whether the linked
failure mechanisms inside of the uv bindings are ready for this kind of
interaction.

Right now, all constructors will execute in a task::unkillable block, and all
homing I/O operations will prevent linked failure in the duration of the homing
operation. What this means is that tasks which perform I/O are still susceptible
to linked failure, but the I/O operations themselves will never get interrupted.
Instead, the linked failure will be received at the edge of the I/O operation.
2013-11-10 01:37:11 -08:00
Alex Crichton
5e6bbc6bfa Assorted test fixes and merge conflicts 2013-11-10 01:37:11 -08:00
Alex Crichton
b545751597 Rework the idle callback to have a safer interface
It turns out that the uv implementation would cause use-after-free if the idle
callback was used after the call to `close`, and additionally nothing would ever
really work that well if `start()` were called twice. To change this, the
`start` and `close` methods were removed in favor of specifying the callback at
creation, and allowing destruction to take care of closing the watcher.
2013-11-10 01:37:11 -08:00
Alex Crichton
d08aadcc9a Update all uv tests to pass again 2013-11-10 01:37:11 -08:00
Alex Crichton
0df8b0057c Work around bugs in 32-bit enum FFI
cc #10308
2013-11-10 01:37:11 -08:00
Alex Crichton
1bdaea827e Migrate all streams to synchronous closing 2013-11-10 01:37:11 -08:00
Alex Crichton
f9abd998d6 Add bindings to uv's utime function
This exposes the ability to change the modification and access times on a file.

Closes #10266
2013-11-10 01:37:11 -08:00
Alex Crichton
497d63f0bc Don't overflow in a converting stat times to u64
Closes #10297
2013-11-10 01:37:11 -08:00
Alex Crichton
aa78c3d6f6 Clean up the remaining chunks of uv 2013-11-10 01:37:11 -08:00
Alex Crichton
584b359348 Migrate uv net bindings away from ~fn() 2013-11-10 01:37:11 -08:00
Alex Crichton
5842b606a7 Migrate uv getaddrinfo away from ~fn() 2013-11-10 01:37:10 -08:00
Alex Crichton
be896288a3 Migrate uv file bindings away from ~fn() 2013-11-10 01:37:10 -08:00