Brian Anderson
cd75c9ce11
rt: Implement part of the 64-bit __morestack
2011-11-28 16:29:52 -08:00
Brian Anderson
6bdf347418
rt: Make __morestack (without unwinding) work on 32-bit linux
2011-11-22 18:02:10 -08:00
Brian Anderson
9aa67052e1
rt: Remove some stack-wasting macros from rust_task::yield
2011-11-18 15:59:10 -08:00
Brian Anderson
1e58049da2
rt: Remove fail calls from rust_task::yield
2011-11-18 15:36:48 -08:00
Brian Anderson
792068d871
rt: Remove unblock call from rust_task::yield
2011-11-18 14:45:48 -08:00
Brian Anderson
0f339b481a
rt: Remove a lock from task_start_wrapper that does nothing
2011-11-18 13:38:20 -08:00
Brian Anderson
3cfcdb4bb2
rt: Replace two uses of yield with ctx->swap
...
These uses aren't really doing a full yield. They are just giving up control
to the scheduler and will never return.
2011-11-18 13:38:18 -08:00
Brian Anderson
57b43b53f9
rt: Add comments to rust_task::yield
2011-11-18 13:28:12 -08:00
Brian Anderson
d1ef29ab37
rt: rust_task::conclude_failure doesn't need to call unblock
2011-11-18 13:23:27 -08:00
Brian Anderson
93931311ff
rt: Add FIXMEs about races in rust_task
2011-11-18 10:32:27 -08:00
Brian Anderson
0dfa1410d3
rt: Remove task::on_wakeup. Unused
2011-11-18 10:32:27 -08:00
Brian Anderson
63d40b8ab6
rt: Remove some unnecessary setting of rust_task::killed
...
The value of this variable doesn't matter after the task fails.
2011-11-18 10:32:27 -08:00
Brian Anderson
d52888f0ba
rt: Remove rust_task::yield. Unused
2011-11-18 10:32:27 -08:00
Brian Anderson
5e9f9e8c48
rt: Add some comments about methods that run on the Rust stack
2011-11-18 10:32:27 -08:00
Niko Matsakis
60e93cd1ec
Re-enable cycle coll. on x86_64, seems to work better now.
2011-11-17 14:40:03 -08:00
Patrick Walton
e6c3c4e48c
rt: More work on morestack
2011-11-17 10:52:59 -08:00
Brian Anderson
02cebbb9f1
Revert "rt: More work on morestack"
...
This reverts commit 68aff2ad6d
.
2011-11-16 18:49:19 -08:00
Patrick Walton
68aff2ad6d
rt: More work on morestack
2011-11-16 18:00:57 -08:00
Brian Anderson
8199558443
rt: Remove an unnecessary check from rust_task::yield
2011-11-16 17:55:04 -08:00
Brian Anderson
bae817efe6
rt: Remove rust_task::notify_tasks_wating_to_join
2011-11-16 17:22:14 -08:00
Niko Matsakis
69911c2bc1
temp. disable cycle coll. on x86_64
2011-11-16 15:16:41 -08:00
Patrick Walton
b3cf0c4d1b
Revert "rt: More work on morestack"
...
This reverts commit ced0d4f15e
.
2011-11-14 16:20:53 -08:00
Patrick Walton
ced0d4f15e
rt: More work on morestack
2011-11-14 16:17:08 -08:00
Brian Anderson
58e923de6e
rt: Perform task notification before killing the parent task
2011-11-13 16:36:47 -08:00
Brian Anderson
3d9023fa4d
rt: Take the task lock when dropping port refcounts
...
Sucks, but otherwise there are races when one task drops the refcount to zero
followed by another bumping it again
2011-11-11 16:11:31 -08:00
Brian Anderson
07771ec25b
Fix run-fail/spawnfail
...
Catch the case where a parent is killed immediately before it terminates
normally.
2011-11-11 14:20:00 -08:00
Brian Anderson
2385deaa0d
rt: Add locking invariants to rust_task
2011-11-11 12:11:21 -08:00
Brian Anderson
5d1e321ecb
rt: Remove rust_chan
2011-11-11 12:11:21 -08:00
Brian Anderson
793da65a8e
rt: Move rust_chan::send to rust_port::send
2011-11-10 17:53:19 -08:00
Patrick Walton
c9003d301f
Stub a __morestack implementation and stack segment allocation. Untested.
2011-10-31 14:20:56 -07:00
Marijn Haverbeke
8124846b2c
Get rid of taskpointer-passing throughout the compiler
...
Only intrinsics still take a dummy taskptr. We'll have to do some
makefile stunts to snapshot a version without taskptrs-in-intrinsics.
Issue #466
2011-10-20 14:22:17 +02:00
Marijn Haverbeke
e927df17f7
Remove spawn_wrap and main_wrap kludges
...
This isn't needed now that our functions are cdecl (and was apparently
only still working by accident).
Issue #992
2011-10-20 13:15:09 +02:00
Patrick Walton
5c973142df
rt: Turn on cycle collection at task death; add a test case
2011-09-26 16:59:15 -07:00
Patrick Walton
ad19ab4c6f
rt: Make the logic that moves environments between tasks update the GC alloc chain correctly
2011-09-26 16:59:15 -07:00
Patrick Walton
307957710c
rt: Remove the GC alloc chain
2011-09-20 14:20:16 -07:00
Brian Anderson
25394950ae
Handle the case where a child task tries to kill a parent while it is dying
...
Still looks pretty racy
2011-09-16 10:05:12 -07:00
Brian Anderson
a0ad9a42cd
Unsupervise tasks before the scheduler kills them. Unblock before yield->fail
2011-09-14 17:05:35 -07:00
Brian Anderson
103197bc42
Make failure propagation to dead parents work
...
The failure will basically go 'through' the dead parent and continue
propagating the failure (as if the child was reparented).
2011-09-14 15:48:14 -07:00
Brian Anderson
9505d70513
Make linked task failure work again
2011-09-14 14:20:41 -07:00
Brian Anderson
6f6f36172b
Remove unused task_exit function
...
Issue #236
2011-09-11 17:31:40 -07:00
Brian Anderson
c047cfb710
Unwind the stack on task failure
...
When a task fails, we will throw an exception, then catch it at the bottom of
the stack.
On Windows we don't do this yet because the exception doesn't propagate
correctly.
No cleanups yet.
Issue #236
2011-09-07 10:32:58 -07:00
Brian Anderson
c337fd5467
Child tasks take a ref to their parents
...
This is so that when a child dies after the parent, it still holds a valid
pointer and can call supervisor->kill() safely.
2011-09-07 10:32:58 -07:00
Brian Anderson
25ae3d655c
Rewrite spawn yet again
...
The motivation here is that the bottom of each stack needs to contain a C++
try/catch block so that we can unwind. This is already the case for main, but
not spawned tasks.
Issue #236
2011-09-07 10:32:58 -07:00
Brian Anderson
bb08ffbaf4
Refactor task failure a bit
...
Issue #236
2011-09-07 10:32:58 -07:00
Brian Anderson
abdb6cd71b
Rewrite reap_dead_tasks to never grab the sched lock before a task lock
...
Doing so contradicts the locking order used everywhere else and causes
deadlocks.
Un-XFAIL task-perf-spawnalot
Closes #854
2011-08-20 16:21:27 -07:00
Patrick Walton
d0171913aa
rt: Remove rustboot's GC infrastructure
2011-08-19 19:17:05 -07:00
Eric Holk
ae89ea223d
Making more of the rust_task structure directly accessible from Rust.
2011-08-17 14:42:40 -07:00
Patrick Walton
d8c5bd6195
rt: Implement obstacks, untested as of yet
2011-08-16 19:49:25 -07:00
Eric Holk
8686645aad
New channel-based task status notifications.
2011-08-16 16:47:40 -07:00
Eric Holk
cf2def46c1
Removed trans_comm.rs from the compiler. Updating aio/sio to work with the new chan and port system, started on a networking module for the standard library.
2011-08-16 09:36:29 -07:00
Eric Holk
be7325073a
Removed spawn and task from the parser. Updated all the tests except for the benchmarks.
2011-08-15 09:26:52 -07:00
Eric Holk
b9f1f77622
Fixed memory accounting and task stack creation bugs.
2011-08-15 09:26:51 -07:00
Eric Holk
b2dad8af31
Added a library version of spawn. Before long, we can remove the old version.
2011-08-15 09:26:51 -07:00
Eric Holk
04af99ecb0
First step towards port handles.
2011-08-15 09:26:51 -07:00
unknown
44bef5f2cb
Introduced task handles.
...
This is the new way to refer to tasks in rust-land. Currently all they
do is serve as a key to look up the old rust_task structure. Ideally
they won't be ref counted, but baby steps.
2011-08-08 16:55:38 -07:00
Eric Holk
d1dbb99984
Removing proxies and message queues.
2011-07-29 18:54:59 -07:00
Brian Anderson
4ef1ec580a
Do all runtime calls to getenv at initialization
...
getenv is not threadsafe and (maybe as a result) it's randomly crashing with
CFLAGS=-g and RUST_THREADS=32. Calls from rust code are still on their
own.
2011-07-28 12:23:01 -07:00
Eric Holk
279844ce9f
Atomic reference counting for tasks.
2011-07-28 10:47:28 -07:00
Eric Holk
5302cde188
Made task threads wait instead of sleep, so they can be woken up. This appears to give us much better parallel performance.
...
Also, commented out one more unsafe log and updated rust_kernel.cpp to compile under g++
2011-07-28 10:47:28 -07:00
Eric Holk
e697a52359
Adding a function to stdlib to set the min stack size, for programs
...
that absolutely will not succeed with a large default stack. This
should be removed once we have stack grown working.
Also updated word-count to succeed under the new test framework.
2011-07-28 10:47:28 -07:00
Eric Holk
62bc6b5113
Per-thread scheduling. Closes #682 .
...
Tasks are spawned on a random thread. Currently they stay there, but
we should add task migration and load balancing in the future. This
should drammatically improve our task performance benchmarks.
2011-07-28 10:47:28 -07:00
Eric Holk
b51f5c395c
Made root_task no longer special.
2011-07-28 10:47:28 -07:00
Michael Sullivan
f33309502a
Bump the stack size and make the RUST_MIN_STACK env variable accept hex values.
2011-07-21 14:05:51 -07:00
Eric Holk
3ae4dcd41e
Lots of work on memory tracking and channels.
...
We're trying to get closer to doing correct move semantics for channel
operations. This involves a lot of cleanup (such as removing the
unused sched parameter from rust_vec constructor) and making
circular_buffer kernel_owned.
Added tagging for memory allocations. This means we give a string tag
to everything we allocate. If we leak something and TRACK_ALLOCATIONS
is enabled, then it's much easier now to tell exactly what is leaking.
2011-07-21 11:51:22 -07:00
Brian Anderson
ced8393f20
Modify task::join to indicate how the task terminated
...
This involves sticking yet another field into the task structure
2011-07-15 10:07:29 -07:00
Brian Anderson
4738cf83b0
Move the responsibility for process failure from tasks to the scheduler
...
When the root task fails the process fails. Failures on other tasks propagate
up the task tree. Failures on non-root tasks without parents just
(theoretically) unwind and disappear.
2011-07-14 17:44:39 -07:00
Graydon Hoare
39151f2ad8
Prohibit trailing whitespace under 'tidy' script. Clean up all caught cases.
2011-07-13 15:44:09 -07:00
Graydon Hoare
49116adbe9
Fix compile-command lines in rt.
2011-07-13 13:51:20 -07:00
Graydon Hoare
2e2951305d
Remove obsolete nargs counts from runtime.
2011-07-13 13:43:35 -07:00
Graydon Hoare
01fc165517
Attempt to correct buggy win32 timer code (causing tinderbox failures).
2011-07-13 12:25:36 -07:00
Eric Holk
d7db25e8f6
Added an environment variable to override the minimum stack size. Closes #637 .
2011-07-08 11:36:56 -07:00
Eric Holk
4739953b84
Fixed two races.
...
The first is that the memory_region destructor would complain there is
still an outstanding allocation. This is because circular_buffer from
rust_chan wasn't refing its task, so the task was being destructed too
soon.
The second was where the program could deadlock while joining a
task. The target task would die in the time between checking whether
the task should block and then actually blocking. The fix is to use
the target task's lock.
2011-07-07 18:22:27 -07:00
Eric Holk
8acadb17c2
Work on debugging race conditions.
...
Ports and channels have been moved to the kernel pool, since they've
been known to outlive their associated task. This probably isn't the
right thing to do, the life cycle needs fixed instead.
Some refactorying in memory_region.cpp. Added a helper function to
increment and decrement the allocation counter. This makes it easier
to switch between atomic and non-atomic increments. Using atomic
increments for now, although this still does not fix the problem.
2011-07-07 18:22:27 -07:00
Eric Holk
dcd2563a3a
Removing the synchronized memory region from tasks.
2011-07-07 18:22:27 -07:00
Eric Holk
a0f45f4456
Removing most of the locks in rust_upcall.cpp and elsewhere.
2011-07-07 18:22:27 -07:00
Patrick Walton
0391e14fc2
rt: Double stack size
2011-07-06 15:13:00 -07:00
Eric Holk
bc5d6aefda
Added a task wakeup callback. Closes #599 .
...
The callback happens when a task moves from the "blocked" state to the
"running" state. The callback is also inherited by child tasks. There
is currently only a native API.
This code hasn't been heavily exercised yet.
2011-07-06 11:30:00 -07:00
Eric Holk
b3e5b5bd05
Added inheritance for task pinning. Closes #598 for real.
2011-06-29 18:56:34 -07:00
Eric Holk
63dcd325b9
Adding support for pinning tasks to the currently running thread. Closes #598 .
2011-06-29 18:47:47 -07:00
Eric Holk
657e5a2bd5
Renamed what's left of rust_dom to rust_scheduler
2011-06-28 16:12:33 -07:00
Eric Holk
2f84987a48
Fixed Win32 compile errors.
2011-06-28 16:12:33 -07:00
Eric Holk
49a8cb34d2
Removed dom_owned, splitting things between task_owned and kernel_owned. Had to re-xfail a few tests brson recently un-xfailed.
2011-06-28 16:12:33 -07:00
Eric Holk
f6f945fed5
Moved thread management to rust_kernel.
2011-06-28 16:12:33 -07:00
Graydon Hoare
bc9fa31618
A little tidying in rt.
2011-06-27 10:08:57 -07:00
Eric Holk
022ebc198b
Implementation mising features in lock_and_signal for Win32. Also lowered the minimum stack size to get the pfib benchmark to run without exhausting its address space on Windows.
2011-06-27 09:58:39 -07:00
Eric Holk
681c063ec0
Conservatively serialize nearly all upcalls. Successfuly ran make check with RUST_THREADS=8, so we're probably fairly safe now. In the future we can relax the synchronization to get better performance.
2011-06-27 09:58:39 -07:00
Eric Holk
4d99bf9af2
Added some locking to ports to prevent the case where two threads simultaneously wake up a task blocked on a certain port.
2011-06-27 09:58:39 -07:00
Eric Holk
4bc773465f
Basic multithreading support. The infinite loops test successfully maxes out the CPU.
2011-06-27 09:58:39 -07:00
Eric Holk
67360ae618
Fixed a problem where spawn arguments were getting lost again. Also, fixed up stack alignment, which closes #496
2011-06-15 18:16:59 -07:00
Eric Holk
01ea27b205
Step 1 of moving task startup to always be cdecl.
2011-06-15 12:10:15 -07:00
Eric Holk
d1857d30fc
This is the mega-ucontext commit. It replaces the task switching mechanism with a new one inspired by ucontext. It works under Linux, OS X and Windows, and is Valgrind clean on Linux and OS X (provided the runtime is built with gcc).
...
This commit also moves yield and join to the standard library, as requested in #42 . Join is currently a no-op though.
2011-06-13 18:14:13 -07:00
Eric Holk
d49998f0ed
Switching over to wrappers for spawning functions of multiple arguments. Doesn't quite work yet.
2011-05-27 15:20:58 -07:00
Eric Holk
dad426419c
Working on 2 argument spawn. The arguments seem to be copied correctly once, but then they get lost.
2011-05-27 15:20:58 -07:00
Graydon Hoare
79c9e13073
More delicious dead code removal from runtime, upcalls.
2011-05-26 18:21:02 -07:00
Rafael Ávila de Espíndola
de2e84e5b0
Only one gc glue.
2011-05-24 18:52:31 -04:00
Rafael Ávila de Espíndola
ac836dd79c
There is only one yield glue.
2011-05-24 18:29:08 -04:00
Rafael Ávila de Espíndola
b1292580b9
Remove dead code for unwind_glue.
2011-05-24 17:28:37 -04:00
Rafael Ávila de Espíndola
fe90159b86
"constant propagate" rust_new_exit_task_glue to its only use.
2011-05-24 15:51:22 -04:00
Rafael Ávila de Espíndola
cebc9b359d
Remove dead rustboot code.
2011-05-18 13:48:57 -04:00
Rafael Ávila de Espíndola
8df37716ce
Fix OS X build.
2011-05-05 23:16:59 -04:00