Commit Graph

29 Commits

Author SHA1 Message Date
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
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
Patrick Walton
7cac9fe763 librustuv: RAII-ify Local::borrow, and remove some 12 Cells. 2013-12-10 15:13:12 -08:00
Alex Crichton
1686bfabf5 Use the native tls implementation on android
Turns out android doesn't support LLVM's thread_local attribute and accompanying
implementation.

Closes #10686
2013-11-27 11:56:43 -08:00
Patrick Walton
749ee53c6d librustc: Make || lambdas not infer to procs 2013-11-26 08:25:27 -08:00
Patrick Walton
f571e46ddb test: Remove non-procedure uses of do from compiletest, libstd tests,
compile-fail tests, run-fail tests, and run-pass tests.
2013-11-26 08:25:27 -08:00
Patrick Walton
1eca34de7d libstd: Remove all non-proc uses of do from libstd 2013-11-26 08:23:57 -08:00
Patrick Walton
1946265e1a libstd: Change all uses of &fn(A)->B over to |A|->B in libstd 2013-11-19 12:40:19 -08:00
Alex Crichton
b46f60a729 Remove IoFactoryObject for ~IoFactory
This involved changing a fair amount of code, rooted in how we access the local
IoFactory instance. I added a helper method to the rtio module to access the
optional local IoFactory. This is different than before in which it was assumed
that a local IoFactory was *always* present. Now, a separate io_error is raised
when an IoFactory is not present, yet I/O is requested.
2013-10-24 14:21:57 -07:00
Patrick Walton
aac9d6eee9 librustc: Fix merge fallout 2013-08-27 19:09:27 -07:00
Patrick Walton
8693943676 librustc: Ensure that type parameters are in the right positions in paths.
This removes the stacking of type parameters that occurs when invoking
trait methods, and fixes all places in the standard library that were
relying on it. It is somewhat awkward in places; I think we'll probably
want something like the `Foo::<for T>::new()` syntax.
2013-08-27 18:47:57 -07:00
Brian Anderson
761f5fba69 std::rt: Optimize TLS use in change_task_context 2013-08-24 15:46:01 -07:00
Brian Anderson
5402786f94 std: More TLS micro-optimization 2013-08-24 15:45:21 -07:00
Brian Anderson
95badabaaf std: Re-optimize tls access on local allocation path
I did this once but acciddentally undid it in a later patch.
2013-08-12 22:30:32 -07:00
Brian Anderson
ae1ed4fd78 std: Allow spawners to specify stack size 2013-08-07 15:40:27 -07:00
Brian Anderson
75734a9cd3 std::rt: Run the tests for Local in a bare thread
Otherwise interferes with the existing runtime
2013-08-04 15:11:56 -07:00
toddaaro
8e98eabce5 modified local to include an implementation for try_unsafe_borrow::<Task> so that the log methods will work 2013-08-01 15:38:48 -07:00
toddaaro
a5f55b3ead minor tweaks - unboxed the coroutine so that it is no longer a ~ pointer inside the task struct, and also added an assert to verify that send is never called inside scheduler context as it is undefined (BROKEN) if that happens 2013-08-01 15:17:19 -07:00
toddaaro
997719c13d Fixed a race where a scheduler configured to only run tasks pinned to it would "bounch" a regular task in and out of the work queue without allowing a different scheduler to run it. 2013-08-01 15:16:01 -07:00
toddaaro
f7eed22387 A major refactoring that changes the way the runtime uses TLS. In the
old design the TLS held the scheduler struct, and the scheduler struct
held the active task. This posed all sorts of weird problems due to
how we wanted to use the contents of TLS. The cleaner approach is to
leave the active task in TLS and have the task hold the scheduler. To
make this work out the scheduler has to run inside a regular task, and
then once that is the case the context switching code is massively
simplified, as instead of three possible paths there is only one. The
logical flow is also easier to follow, as the scheduler struct acts
somewhat like a "token" indicating what is active.

These changes also necessitated changing a large number of runtime
tests, and rewriting most of the runtime testing helpers.

Polish level is "low", as I will very soon start on more scheduler
changes that will require wiping the polish off. That being said there
should be sufficient comments around anything complex to make this
entirely respectable as a standalone commit.
2013-08-01 15:14:00 -07:00
Brian Anderson
6fb92f8cab std::rt: Do local tests in a bare thread to not interfere with the scheduler 2013-07-09 15:48:22 -07:00
toddaaro
5cfad4b6de Refactored the runtime to view coroutines as a component of tasks, instead of tasks as a component of coroutines. 2013-07-01 16:14:56 -07:00
Brian Anderson
b5fbec9c1e std: Rename abort! to rtabort! to match other macros 2013-06-17 23:24:50 -07:00
toddaaro
d1ec8b5fb8 redesigned the pinning to pin deal with things on dequeue, not on enqueue 2013-06-14 12:17:56 -07:00
toddaaro
d64d26cd39 debugged a compiler ICE when merging local::borrow changes into the main io branch and modified the incoming new file lang.rs to be api-compatible 2013-06-10 15:29:02 -07:00
Brian Anderson
ea633b42ae core::rt: deny(unused_imports, unused_mut, unused_variable) 2013-05-30 13:20:17 -07:00
Brian Anderson
f4ed554ddb Merge remote-tracking branch 'brson/io' into incoming
Conflicts:
	src/libstd/rt/sched.rs
2013-05-29 18:22:28 -07:00
Erick Tryzelaar
dc970c13f4 cleanup warnings from libstd 2013-05-23 17:48:16 -07:00
Patrick Walton
18df18c817 libstd: Fix merge fallout. 2013-05-22 21:57:11 -07:00