Commit Graph

375 Commits

Author SHA1 Message Date
bors
9e1e152091 auto merge of #8596 : vadimcn/rust/master, r=alexcrichton
This resolves issue #908.  

Notable changes:
-  On Windows, LLVM integrated assembler emits bad stack unwind tables when segmented stacks are enabled.  However, unwind info directives in the assembly output are correct, so we generate assembly first and then run it through an external assembler, just like it is already done for Android builds.

- Linker is invoked  via "g++" command instead of "gcc": g++ passes the appropriate magic parameters to the linker, which ensure correct registration of stack unwind tables in dynamic libraries.
2013-08-22 21:06:25 -07:00
Vadim Chugunov
12ecdb6381 Enabled unit tests in std and extra. 2013-08-22 20:02:20 -07:00
Jeff Olson
b7cbd8a8fd fix 32bit mac build error 2013-08-22 17:26:02 -07:00
Jeff Olson
744c46225e make check appeasement 2013-08-22 16:33:59 -07:00
Jeff Olson
8d997fba1a std: put FileMode/Access->whence-mask in uvio, open/unlink as fns in file:: 2013-08-22 16:31:58 -07:00
Jeff Olson
6311856bf4 std: slight refactor on UvFilestream seek behavior, pre-seek-refactor 2013-08-22 16:31:58 -07:00
Jeff Olson
94b84a851c std: all of the calls in rt::uv::file take a &Loop 2013-08-22 16:31:58 -07:00
Jeff Olson
f01e265357 std: moved static file actions (open,unlink) to FsRequest 2013-08-22 16:31:58 -07:00
Jeff Olson
f85d3b3ec1 std: reform fn sigs of FileDescriptor methods (better result signalling) 2013-08-22 16:31:58 -07:00
Jeff Olson
429b5f88f9 std: rename tmp file paths to go into ./tmp folder in builddir 2013-08-22 16:31:58 -07:00
Jeff Olson
13eb259a09 change FileDescriptor instance methods to use &mut self 2013-08-22 16:31:58 -07:00
Jeff Olson
ece709f172 std: more seek tests 2013-08-22 16:31:58 -07:00
Jeff Olson
320ccbeb53 std: naive stdio print test in uvio 2013-08-22 16:31:58 -07:00
Jeff Olson
10ff5355b3 std: UvFileStream implements HomingIO + .home_for_io() wrapper usage 2013-08-22 16:31:58 -07:00
Jeff Olson
c3a819b01c std: writing to stdout only works when using -1 offset.. 2013-08-22 16:31:58 -07:00
Jeff Olson
0e9964189d std: lint appeasement for unused param in condition handler 2013-08-22 16:31:58 -07:00
Jeff Olson
05c8cc70c9 std: rework file io.. support [p]read,[p]write, impl seek/tell + more tests 2013-08-22 16:31:57 -07:00
Jeff Olson
48d6761028 std: adding #[fixed_stack_segment] as needed in new uvll calls 2013-08-22 16:31:57 -07:00
Jeff Olson
4015b4a9b4 std: add FileStream::unlink + more tests 2013-08-22 16:31:57 -07:00
Jeff Olson
f6d897d7d9 std: rt::io::file::FileStream fleshed out.. needs more work.. see extended
- change all uses of Path in fn args to &P
- FileStream.read assumptions were wrong (libuv file io is non-positional)
- the above will mean that we "own" Seek impl info .. should probably
  push it in UvFileDescriptor..
- needs more tests
2013-08-22 16:31:57 -07:00
Jeff Olson
47f0e91689 std: CRUD file io bindings in uvio, fs_open()/unlink() in IoFactory + test 2013-08-22 16:31:57 -07:00
Jeff Olson
f60bd75f4d std: remove fcntl const bindings + making valgrind clean w/ no owned vecs 2013-08-22 16:31:57 -07:00
Jeff Olson
e0a80ee332 std: support async/threadpool & sync paths in uv_fs_* calls + add sync test 2013-08-22 16:31:57 -07:00
Jeff Olson
c49c2921b0 std: add read and unlink to low-level FileDescriptor + end-to-end CRUD test 2013-08-22 16:31:57 -07:00
Jeff Olson
dabbac1d6c std: working tests for low-level libuv open, write and close operations 2013-08-22 16:31:57 -07:00
Jeff Olson
a901b16690 std: bootstrapping libuv-based fileio in newrt... open & close
the test "touch"es a new file
2013-08-22 16:31:57 -07:00
bors
4e3dbf959a auto merge of #8666 : nikomatsakis/rust/issue-3678-extern-fn-types, r=pcwalton
Change the type of crust fns like this one:

    extern fn foo() { ... }

from `*u8` to `extern "C" fn()`.

r? @pcwalton (or whomever)
2013-08-22 07:01:27 -07:00
Tim Chevalier
5da4b4d928 std/extra: changing XXX to FIXME; cleanup
* Get rid of by-value-self workarounds; it works now
* Remove type annotations, they're not needed anymore
2013-08-21 17:17:41 -07:00
Niko Matsakis
ffb6404c5a Adjust callbacks in the libraries for the new type of extern fns
cc #3678
2013-08-21 10:50:42 -04:00
bors
4c75e92612 auto merge of #8600 : sfackler/rust/http, r=brson
It's an empty stub and as one of the comments notes, doesn't belong in
libstd.
2013-08-21 05:01:43 -07:00
bors
d56b9b102b auto merge of #8656 : toddaaro/rust/idle-opt+cleaning, r=brson
Fixed a memory leak caused by the singleton idle callback failing to close correctly. The problem was that the close function requires running inside a callback in the event loop, but we were trying to close the idle watcher after the loop returned from run. The fix was to just call run again to process this callback. There is an additional tweak to move the initialization logic fully into bootstrap, so tasks that do not ever call run do not have problems destructing.
2013-08-20 18:51:55 -07:00
bors
0bc1ca4045 auto merge of #8631 : anasazi/rust/homing-io, r=brson
libuv handles are tied to the event loop that created them. In order to perform IO, the handle must be on the thread with its home event loop. Thus, when as task wants to do IO it must first go to the IO handle's home event loop and pin itself to the corresponding scheduler while the IO action is in flight. Once the IO action completes, the task is unpinned and either returns to its home scheduler if it is a pinned task, or otherwise stays on the current scheduler.

Making new blocking IO implementations (i.e. files) thread safe is rather simple. Add a home field to the IO handle's struct in uvio and implement the HomingIO trait. Wrap every IO call in the HomingIO.home_for_io method, which will take care of the scheduling.

I'm not sure if this remains thread safe in the presence of asynchronous IO at the libuv level. If we decide to do that, then this set up should be revisited.
2013-08-20 17:12:09 -07:00
toddaaro
352ac2efdf Fixed a memory leak caused by the singleton idle callback failing to close correctly. The problem was that the close function requires running inside a callback in the event loop, but we were trying to close the idle watcher after the loop returned from run. The fix was to just call run again to process this callback. There is an additional tweak to move the initialization logic fully into bootstrap, so tasks that do not ever call run do not have problems destructing. 2013-08-20 15:48:59 -07:00
bors
293660d443 auto merge of #8519 : msullivan/rust/objects, r=catamorphism
r?
2013-08-20 13:32:00 -07:00
bors
67c954e365 auto merge of #8566 : toddaaro/rust/idle-opt+cleaning, r=catamorphism,brson
Instead of a furious storm of idle callbacks we just have one. This is a major performance gain - around 40% on my machine for the ping pong bench.

Also in this PR is a cleanup commit for the scheduler code. Was previously up as a separate PR, but bors load + imminent merge hell led me to roll them together. Was #8549.
2013-08-20 09:42:00 -07:00
Brian Anderson
0f9ab93642 std: Restore dynamic borrow tracking 2013-08-19 20:39:39 -07:00
Eric Reed
35e844ffc1 Make IO thread-safe.
Each IO handle has a home event loop, which created it.
When a task wants to use an IO handle, it must first make sure it is on that home event loop.
It uses the scheduler handle in the IO handle to send itself there before starting the IO action.
Once the IO action completes, the task restores its previous home state.
If it is an AnySched task, then it will be executed on the new scheduler.
If it has a normal home, then it will return there before executing any more code after the IO action.
2013-08-19 16:31:21 -07:00
Eric Reed
d09412ab89 Homed UDP sockets 2013-08-19 16:26:50 -07:00
Eric Reed
d7b6fcba29 Working homing UDP socket prototype. 2013-08-19 16:26:50 -07:00
Eric Reed
88f718341e Instruct event loops to ignore SIGPIPE when constructed.
libuv does not always catch SIGPIPE.
2013-08-19 16:26:50 -07:00
Eric Reed
f68514c128 Do not execute the callback before cleaning up resources. 2013-08-19 16:26:50 -07:00
Eric Reed
97555e865c Derive Clone for IpAddr and SocketAddr 2013-08-19 16:26:50 -07:00
Graydon Hoare
19f4ae1415 Try to fix mac valgrind bot by disabling thread-heavy activities. 2013-08-19 15:09:20 -07:00
toddaaro
e5ccf13668 clean whitespace :/ 2013-08-19 12:01:13 -07:00
Michael Sullivan
dc9b3e37e2 Rangechange the log message truncation limit. 2013-08-19 09:35:51 -07:00
Niko Matsakis
0479d946c8 Add externfn macro and correctly label fixed_stack_segments 2013-08-19 07:13:15 -04:00
Steven Fackler
b66cdb16fe Delete std::rt::io::net::http
It's an empty stub and as one of the comments notes, doesn't belong in
libstd.
2013-08-18 20:32:35 -04:00
bors
b26e11db86 auto merge of #8560 : kballard/rust/reserve-yield, r=pcwalton
Rename task::yield() to task::deschedule().

Fixes #8494.
2013-08-18 15:02:04 -07:00
bors
3bc6858428 auto merge of #8551 : huonw/rust/speling, r=alexcrichton
(This doesn't add/remove `u`s or change `ize` to `ise`, or anything like that.)
2013-08-18 05:11:58 -07:00
Huon Wilson
6440343a6c More spelling corrections. 2013-08-18 08:28:04 +10:00