Commit Graph

25071 Commits

Author SHA1 Message Date
Patrick Walton
02f13adaa3 librustc: De-@mut the trait_methods_cache 2013-12-26 13:01:22 -08:00
Patrick Walton
214d6bc34a librustc: De-@mut the trait_method_def_ids table. 2013-12-26 13:01:22 -08:00
Patrick Walton
f15f9388dc librustc: De-@mut the type context's methods table 2013-12-26 13:01:22 -08:00
Patrick Walton
386300d4b0 librustc: De-@mut the node_type_substs table 2013-12-26 13:01:22 -08:00
Patrick Walton
fffbe7a8cd librustc: De-@mut the type interner 2013-12-26 13:01:22 -08:00
Patrick Walton
09589aae4f librustc: De-@mut FnCtxt. 2013-12-26 13:01:21 -08:00
Patrick Walton
c9432327c4 librustc: Change @mut Block to @Block. 2013-12-26 13:01:21 -08:00
Erick Tryzelaar
1da9112be9 std: result::collect to take an iterator, add option::collect 2013-12-26 15:12:00 -05:00
Erick Tryzelaar
daf4fa720c std: remove some test warnings 2013-12-26 15:11:59 -05:00
bors
f74b8f0d3a auto merge of #11148 : alexcrichton/rust/snapshots, r=luqmana
C++ is gone for good and `crate_id` is the new `pkgid`.
2013-12-26 11:36:37 -08:00
Alex Crichton
ab431a20c0 Register new snapshots 2013-12-26 11:30:23 -08:00
Huon Wilson
2ca0b58f60 std::hashmap: add an example to mangle. 2013-12-27 00:29:02 +11:00
Huon Wilson
2277d78d33 std::rand: remove the fn main() from the examples. 2013-12-26 23:43:23 +11:00
bors
1f34f50ce6 auto merge of #11127 : huonw/rust/vec-docs, r=alexcrichton 2013-12-26 04:31:50 -08:00
bors
9477c49a7b auto merge of #10965 : alexcrichton/rust/libgreen, r=brson
This pull request extracts all scheduling functionality from libstd, moving it into its own separate crates. The new libnative and libgreen will be the new way in which 1:1 and M:N scheduling is implemented. The standard library still requires an interface to the runtime, however, (think of things like `std::comm` and `io::println`). The interface is now defined by the `Runtime` trait inside of `std::rt`.

The booting process is now that libgreen defines the start lang-item and that's it. I want to extend this soon to have libnative also have a "start lang item" but also allow libgreen and libnative to be linked together in the same process. For now though, only libgreen can be used to start a program (unless you define the start lang item yourself). Again though, I want to change this soon, I just figured that this pull request is large enough as-is.

This certainly wasn't a smooth transition, certain functionality has no equivalent in this new separation, and some functionality is now better enabled through this new system. I did my best to separate all of the commits by topic and keep things fairly bite-sized, although are indeed larger than others.

As a note, this is currently rebased on top of my `std::comm` rewrite (or at least an old copy of it), but none of those commits need reviewing (that will all happen in another pull request).
2013-12-26 01:01:54 -08:00
Alex Crichton
6cad8f4f14 Test fixes and rebase conflicts
* vec::raw::to_ptr is gone
* Pausible => Pausable
* Removing @
* Calling the main task "<main>"
* Removing unused imports
* Removing unused mut
* Bringing some libextra tests up to date
* Allowing compiletest to work at stage0
* Fixing the bootstrap-from-c rmake tests
* assert => rtassert in a few cases
* printing to stderr instead of stdout in fail!()
2013-12-25 23:10:46 -08:00
bors
d975060de6 auto merge of #11146 : sfackler/rust/cleanup, r=alexcrichton
I also deleted a test which has apparently not been needed for a very long time.
2013-12-25 21:46:41 -08:00
Steven Fackler
c7cf5dc270 Method-ify CStore 2013-12-25 21:50:36 -07:00
bors
cab6af55ff auto merge of #11139 : alexcrichton/rust/fix-snapshots, r=luqmana
It only really makes sense to run tests for the build target anyway because it's
not guaranteed that you can execute other targets.

This is blocking the next snapshot
2013-12-25 13:01:49 -08:00
Steven Fackler
4d5243dd08 Remove out of date test
The associated issue has been closed for 2 years!
2013-12-25 10:58:03 -07:00
Alex Crichton
1c648fcea4 rustc: Strip struct fields and enum variants
Closes #11085
2013-12-24 23:26:40 -08:00
Alex Crichton
70ff5f7033 mk: Fix doc tests for multiple targets
It only really makes sense to run tests for the build target anyway because it's
not guaranteed that you can execute other targets.

This is blocking the next snapshot
2013-12-24 22:59:38 -08:00
bors
a1e68debb1 auto merge of #10961 : brson/rust/lessc, r=alexcrichton 2013-12-24 20:11:33 -08:00
Brian Anderson
f82246f56d Remove rust_globals.h 2013-12-24 20:09:49 -08:00
Alex Crichton
b47ff23673 green: Move a scheduler test inside libgreen
This test also had a race condition in using the cvar/lock, so I fixed that up
as well. The race originated from one half trying to destroy the lock when
another half was using it.
2013-12-24 19:59:55 -08:00
Alex Crichton
7f48345904 std: Remove must deferred sending functions
These functions are all unnecessary now, and they only have meaning in the M:N
context. Removing these functions uncovered a bug in the librustuv timer
bindings, but it was fairly easy to cover (and the test is already committed).

These cannot be completely removed just yet due to their usage in the WaitQueue
of extra::sync, and until the mutex in libextra is rewritten it will not be
possible to remove the deferred sends for channels.
2013-12-24 19:59:54 -08:00
Alex Crichton
1c4af5e3d9 rustuv: Remove the id() function from IoFactory
The only user of this was the homing code in librustuv, and it just manually
does the cast from a pointer to a uint now.
2013-12-24 19:59:54 -08:00
Alex Crichton
3dc38b0c51 std: Stop reexporting the contents of 'mod consts'
This prevents usage of the win32 utf-16 helper functions from outside of libstd.

Closes #9053
2013-12-24 19:59:54 -08:00
Alex Crichton
0dcdefcf7e make: Fix deps of rmake tests and host files
The rmake tests should depend on the target libraries (for linking), not just
the host libraries (for running). The host file dependencies are also correct
now because HLIBRUSTC_DEFAULT doesn't actually exist.
2013-12-24 19:59:54 -08:00
Alex Crichton
9f005866e5 rustuv: Fix a memory leak (documented inside)
This happened because the environment of a procedure was never deallocated.
2013-12-24 19:59:54 -08:00
Alex Crichton
f25c81a51a rustuv: Fix a use-after-free on destruction
The uv loop was being destroyed before the async handle was being destroyed, so
closing the async handle was causing a use-after-free in the uv loop. This was
fixed by moving destruction of the queue's async handle to an earlier location
and then actually freeing it once the loop has been dropped.
2013-12-24 19:59:54 -08:00
Alex Crichton
962af9198f native: Protect against spurious wakeups on cvars
This is a very real problem with cvars on normal systems, and all of channels
will not work if spurious wakeups are accepted. This problem is just solved with
a synchronized flag (accessed in the cvar's lock) to see whether a signal()
actually happened or whether it's spurious.
2013-12-24 19:59:54 -08:00
Alex Crichton
04c446b4b6 make: Don't have libsyntax depend on librustuv
It doesn't actually and we can get better incremental build times for
modifications to librustuv if libsyntax/librustc don't need to get rebuilt
2013-12-24 19:59:54 -08:00
Alex Crichton
e121d7556c rustuv: Fix a use-after-free bug
The queue has an async handle which must be destroyed before the loop is
destroyed, so use a little bit of an option dance to get around this
requirement.
2013-12-24 19:59:54 -08:00
Alex Crichton
51c03c1f35 green: Properly wait for main before shutdown
There was a race in the code previously where schedulers would *immediately*
shut down after spawning the main task (because the global task count would
still be 0). This fixes the logic by blocking the sched pool task in receving on
a port instead of spawning a task into the pool to receive on a port.

The modifications necessary were to have a "simple task" running by the time the
code is executing, but this is a simple enough thing to implement and I forsee
this being necessary to have implemented in the future anyway.
2013-12-24 19:59:54 -08:00
Alex Crichton
282f3d99a5 Test fixes and rebase problems
Note that this removes a number of run-pass tests which are exercising behavior
of the old runtime. This functionality no longer exists and is thoroughly tested
inside of libgreen and libnative. There isn't really the notion of "starting the
runtime" any more. The major notion now is "bootstrapping the initial task".
2013-12-24 19:59:53 -08:00
Alex Crichton
39dbcd7b01 rustc: Temporarily inject libgreen with librustuv
This measure is simply to allow programs to continue compiling as they once did.
In the future, this needs a more robust solution to choose how to start with
libgreen or libnative.
2013-12-24 19:59:53 -08:00
Alex Crichton
aad9fbf6b6 green: Fixing all tests from previous refactorings 2013-12-24 19:59:53 -08:00
Alex Crichton
1a6d920e3d green: Allow specifying an IoFactory for pools
This allows creation of different sched pools with different io factories.
Namely, this will be used to test the basic I/O loop in the green crate. This
can also be used to override the global default.
2013-12-24 19:59:53 -08:00
Alex Crichton
8be66e212b std: Implement yields on receives for channels
This will prevent a deadlock when a task spins in a try_recv when using channel
communication routines is a clear location for a M:N scheduling to happen.
2013-12-24 19:59:53 -08:00
Alex Crichton
14caf00c92 rustuv: Write homing tests with SchedPool
Use the previous commit's new scheduler pool abstraction in libgreen to write
some homing tests which force an I/O handle to be homed from one event loop to
another.
2013-12-24 19:59:53 -08:00
Alex Crichton
3893716390 Finalize the green::Pool type
The scheduler pool now has a much more simplified interface. There is now a
clear distinction between creating the pool and then interacting the pool. When
a pool is created, all schedulers are not active, and only later if a spawn is
done does activity occur.

There are four operations that you can do on a pool:

1. Create a new pool. The only argument to this function is the configuration
   for the scheduler pool. Currently the only configuration parameter is the
   number of threads to initially spawn.

2. Spawn a task into this pool. This takes a procedure and task configuration
   options and spawns a new task into the pool of schedulers.

3. Spawn a new scheduler into the pool. This will return a handle on which to
   communicate with the scheduler in order to do something like a pinned task.

4. Shut down the scheduler pool. This will consume the scheduler pool, request
   all of the schedulers to shut down, and then wait on all the scheduler
   threads. Currently this will block the invoking OS thread, but I plan on
   making 'Thread::join' not a thread-blocking call.

These operations can be used to encode all current usage of M:N schedulers, as
well as providing a simple interface through which a pool can be modified. There
is currently no way to remove a scheduler from a pool of scheduler, as there's
no way to guarantee that a scheduler has exited. This may be added in the
future, however (as necessary).
2013-12-24 19:59:53 -08:00
Alex Crichton
afd4e2ad8d rustuv: Get all tests passing again after refactor
All tests except for the homing tests are now working again with the
librustuv/libgreen refactoring. The homing-related tests are currently commented
out and now placed in the rustuv::homing module.

I plan on refactoring scheduler pool spawning in order to enable more homing
tests in a future commit.
2013-12-24 19:59:53 -08:00
Alex Crichton
f5d9b2ca6d native: Add tests and cleanup entry points
This adds a few smoke tests associated with libnative tasks (not much code to
test here anyway), and cleans up the entry points a little bit to be a little
more like libgreen.

The I/O code doesn't need much testing because that's all tested in libstd (with
the iotest! macro).
2013-12-24 19:59:53 -08:00
Alex Crichton
018d60509c std: Get stdtest all passing again
This commit brings the library up-to-date in order to get all tests passing
again
2013-12-24 19:59:52 -08:00
Alex Crichton
d830fcc6eb make: Add all the make support for lib{native,green}
This should now begin distribution of lib{green,native} in rlib/dylib format as
well as building them as part of the normal build process.
2013-12-24 19:59:52 -08:00
Alex Crichton
780afeaf0a std: Update std::rt::thread to specify stack sizes
It's now possible to spawn an OS thread with a stack that has a specific size.
2013-12-24 19:59:52 -08:00
Alex Crichton
7554f5c58f std: Fix a bug where Local::take() didn't zero out
In the compiled version of local_ptr (that with #[thread_local]), the take()
funciton didn't zero-out the previous pointer, allowing for multiple takes (with
fewer runtime assertions being tripped).
2013-12-24 19:59:52 -08:00
Alex Crichton
51abdee5f1 green: Rip the bandaid off, introduce libgreen
This extracts everything related to green scheduling from libstd and introduces
a new libgreen crate. This mostly involves deleting most of std::rt and moving
it to libgreen.

Along with the movement of code, this commit rearchitects many functions in the
scheduler in order to adapt to the fact that Local::take now *only* works on a
Task, not a scheduler. This mostly just involved threading the current green
task through in a few locations, but there were one or two spots where things
got hairy.

There are a few repercussions of this commit:

* tube/rc have been removed (the runtime implementation of rc)
* There is no longer a "single threaded" spawning mode for tasks. This is now
  encompassed by 1:1 scheduling + communication. Convenience methods have been
  introduced that are specific to libgreen to assist in the spawning of pools of
  schedulers.
2013-12-24 19:59:52 -08:00
Alex Crichton
6aadc9d188 native: Introduce libnative
This commit introduces a new crate called "native" which will be the crate that
implements the 1:1 runtime of rust. This currently entails having an
implementation of std::rt::Runtime inside of libnative as well as moving all of
the native I/O implementations to libnative.

The current snag is that the start lang item must currently be defined in
libnative in order to start running, but this will change in the future.

Cool fact about this crate, there are no extra features that are enabled.

Note that this commit does not include any makefile support necessary for
building libnative, that's all coming in a later commit.
2013-12-24 14:42:00 -08:00