Commit Graph

74 Commits

Author SHA1 Message Date
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
Rafael Ávila de Espíndola d6deeffd95 Change the setup so that rust_activate_glue returns to rust_exit_task_glue
and rust_exit_task_glue calls the rust main.

This is simpler since we only need to setup one frame. It also matches
what ld.so does, so gdb is happy and stops a backtrace at rust_exit_task_glue
instead of continuing past whatever function happened to be before
rust_exit_task_glue is the object file.

This is the rt part and should be merged after the rust0 part.
2011-05-05 15:46:10 -07:00
Graydon Hoare 895ec07453 Try to fail nicely, again. 2011-05-04 15:04:53 +00:00
Rafael Ávila de Espíndola 5617462388 Remove unused variable. 2011-05-03 11:06:57 -04:00
Rafael Ávila de Espíndola a3ff02f126 Split start into rustc and rustboot versions. This introduces a bit of
duplication, but we will hopefully drop the rustboot one soon.

This is also a preparation for changing the rustc one to have the activate glue
return to the exit glue which will then call the main function.

This (returning to the function that calls main) matches what happens when
loader stats a program or a new thread. It lets gdb produce good backtraces
and should help with EH too.
2011-05-03 10:24:18 -04:00
Marijn Haverbeke 880be6a940 Overhaul logging system in runtime
See https://github.com/graydon/rust/wiki/Logging-vision

The runtime logging categories are now treated in the same way as
modules in compiled code. Each domain now has a log_lvl that can be
used to restrict the logging from that domain (will be used to allow
logging to be restricted to a single domain).

Features dropped (can be brought back to life if there is interest):
  - Logger indentation
  - Multiple categories per log statement
  - I possibly broke some of the color code -- it confuses me
2011-04-19 16:57:13 +02:00
Patrick Walton fee88f79f5 rt: Remove half-baked, incomplete, commented-out print_stack_trace() stub 2011-04-14 11:35:22 -07:00
Patrick Walton 65b7578851 rustc: Remove generalize_ty. Instead, maintain an explicit type parameter substitution list. 2011-04-14 11:24:25 -07:00
Marijn Haverbeke 973023030e add -O2 when compiling rt, fix warnings triggered by optimizer 2011-04-08 00:41:52 +02:00
Marijn Haverbeke 9a7576fe2c Move to macro-based logging checks in the C++ code
No functions should be called for log statements that turn out to be
inactive.
2011-04-07 15:15:30 -07:00
Graydon Hoare a154c5b656 Um, that'd be, align the word *before* retpc. Addresses point to the low part of a word. Un-XFAIL nbody on Darwin. 2011-03-30 14:10:06 -07:00
Graydon Hoare 3e7b991d49 Ensure task stacks start out with a 16-byte aligned entry frame. Should make OSX behave a bit better. 2011-03-30 13:04:18 -07:00
Graydon Hoare af4d6ae76b Add ABI tagging to crates, adjust rustc output and runtime stack-frame setup so access to argv works. 2011-02-22 16:37:27 -08:00
Graydon Hoare aaa6965794 Fix typo in rust_task::start. Should be copying 1 fewer initial arg. 2011-02-21 18:55:08 -08:00
Graydon Hoare d55bee4417 Further corrections to the logging layer in runtime. 2011-01-14 16:50:37 -08:00
Brian Anderson 73fd87baf5 Don't attempt to wake tasks that aren't blocked.
It's possible for a supervised task to kill and wake its supervising
task then immediately try to wake it again if the supervising task
has joined the supervised. This is the easiest way to prevent that.
2011-01-03 10:59:00 -08:00
Graydon Hoare 26ecec4e12 Update frame logic to be compatible with SysV x86 ABI. Improves diagnostics. 2010-11-16 13:51:32 -08:00
Patrick Walton 94cec74096 Try to print backtraces on failure 2010-10-11 16:40:18 -07:00
Graydon Hoare b970563fe3 Patchwork of attempted fixes to effect system and gc system; eventually give up and disable it entirely in the runtime. Will need extensive reworking. 2010-09-29 17:22:13 -07:00
Michael Bebenita a493350eb5 Cleanup, refactoring, and some runtime tests. 2010-09-10 14:38:31 -07:00
Michael Bebenita 743ca289b6 Cache task handles. 2010-09-08 21:25:16 -07:00
Michael Bebenita de611a3090 Lots of design changes around proxies and message passing. Made it so that domains can only talk to other domains via handles, and with the help of the rust_kernel. 2010-09-07 18:44:12 -07:00