Commit graph

242 commits

Author SHA1 Message Date
Brian Anderson
97aa599b0d Fix circular_buffer growth when _next != 0 2011-01-10 11:31:33 -08:00
Brian Anderson
ebf8638d31 Remove tabs 2011-01-10 11:31:33 -08:00
Brian Anderson
f1df1d1a51 Don't allow circular_buffer to shrink below its original size when unit_sz is not a power of two 2011-01-10 11:31:33 -08:00
Brian Anderson
5f05ae68e5 Don't allow circular_buffer to shrink below it's initial size 2011-01-10 11:31:32 -08:00
Brian Anderson
04056d89c8 Fix the check for growing the circular_buffer 2011-01-10 11:31:32 -08:00
Brian Anderson
a9994a2963 Correctly initialize circular_buffer to a power-of-two bytes 2011-01-07 11:34:14 -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
c0d4e88428 Add std.dbg.trap(str msg) for help debugging. 2010-12-31 10:35:39 -08:00
Patrick Walton
5a1cba7883 Make failing to resolve a symbol an error 2010-12-13 17:59:05 -08:00
Graydon Hoare
4dc98e54d1 Make the ugly detailed leak-spray on rustc failures optional. 2010-11-30 17:10:51 -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
Graydon Hoare
89946609f2 Support a special const-value refcount, use it for const strings. 2010-11-09 14:15:07 -08:00
Graydon Hoare
da13c508d8 First pass on splitting stratum and opacity off of effects. WIP. 2010-11-02 11:11:58 -07:00
Ralph Giles
3b3cd550d4 Cast NULL to uintptr_t when calling rust_task::start().
On gcc 4.5.1 (fedora 14 i686) rust_test_runtime.cpp fails to compile
with the following error:

  rt/test/rust_test_runtime.cpp:57:61: error: passing NULL to non-pointer argument 3 of ‘void rust_task::start(uintptr_t, uintptr_t, uintptr_t, size_t)’

The explicit cast works around the error.
2010-10-28 10:13:30 -07:00
Patrick Walton
28d43678b6 Add a virtual destructor to rust_thread in sync.h, to quiet the compiler 2010-10-20 10:32:36 -07:00
Patrick Walton
5177898db1 Use new and delete instead of alloca(). Should put out the burning tinderbox. 2010-10-11 17:11:59 -07:00
Patrick Walton
94cec74096 Try to print backtraces on failure 2010-10-11 16:40:18 -07:00
Patrick Walton
246e72b0fb Use RTLD_GLOBAL when loading libraries. This is needed to get LLVM working on the Mac in rustc. 2010-10-05 11:37:46 -07:00
Graydon Hoare
2e0d075407 Fix bug in bind thunks failing top drop unbound args; add test and adjust rustc to use bind again. 2010-09-30 17:39:37 -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
1bd331b7aa Fixed deadlock caused by the message pump not being notified of new message sends. 2010-09-16 00:51:03 -07:00
Michael Bebenita
a493350eb5 Cleanup, refactoring, and some runtime tests. 2010-09-10 14:38:31 -07:00
Michael Bebenita
f985fded3e Added lock_and_signal::signal_all(), and made the rust_kernel::join() use wait instead of yield. 2010-09-10 14:38:31 -07:00
Michael Bebenita
c877f31730 Fixed lost signal notifications. 2010-09-08 22:20:31 -07:00
Michael Bebenita
743ca289b6 Cache task handles. 2010-09-08 21:25:16 -07:00
Graydon Hoare
616b7afb72 Tidy up the sync dir, remove dead or mis-designed code in favour of OS primitives, switch rust_kernel to use a lock/signal pair and wait rather than spin. 2010-09-08 19:13:49 -07:00
Graydon Hoare
13d6f87431 XFAIL many.rs since it crashes on win32, and add a time-slice sleep to the kernel message loop to get tests to finish in a sane time. 2010-09-08 15:48:18 -07:00
Michael Bebenita
388f8ce520 Cleaned up locking in the kernel. 2010-09-08 15:17:09 -07:00
Michael Bebenita
7f6d8b95bd Fixed race in the rust kernel. 2010-09-07 23:37:51 -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
Michael Bebenita
a6aebdaedd Started work on a framework for writing runtime tests, added some simple test cases. 2010-09-07 18:41:08 -07:00
Michael Bebenita
5375b39160 Small updates to util classes. 2010-09-07 18:41:08 -07:00
Michael Bebenita
b03812af2b Change signature of array_list::pop(). 2010-09-07 18:41:08 -07:00
Michael Bebenita
6b7ba50e17 Added "new" inline operators to memory regions. 2010-09-07 18:41:08 -07:00
Michael Bebenita
066c14009b Added a .cpp file for rust_proxy to help avoid .h file dependencies in the future. 2010-09-07 18:41:08 -07:00
Michael Bebenita
9b74129a4f Added a thread utility class to factor out operations on threads. 2010-09-07 18:41:07 -07:00
Michael Bebenita
f8ff013e3c Added a few utility classes, cleaned up the include order of .h files, and started to make the Rust kernel own domain message queues rather than the Rust domains themselves. 2010-09-07 18:41:07 -07:00
Roy Frostig
cf62b54028 Add a little pointer-cast helper to dbg. 2010-09-06 23:24:01 -07:00
Roy Frostig
4e355aebf7 When vec growth results in a newly allocated (extended) buffer, copy existing elements over via element-wise copy, not flat memcpy. Introduce new vec growth glue to achieve this. 2010-09-03 16:18:32 -07:00
Graydon Hoare
b90e6b93c1 Whitespace churn. 2010-08-31 14:36:51 -07:00
Roy Frostig
47e86a05ae Fix rust_vec constructor assertion failure caused by slow path of upcall_vec_grow. Add testcase. 2010-08-31 13:01:57 -07:00
Michael Bebenita
64ff82ecf9 Implemented an lock free queue based on this paper http://www.cs.rochester.edu/~scott/papers/1996_PODC_queues.pdf, the "lock free queue" we had before wasn't lock free at all. 2010-08-24 21:07:14 -07:00
Roy Frostig
7ccdb88374 Add support in dbg.debug_obj for printing the obj body. 2010-08-24 19:49:39 -07:00
Roy Frostig
d9e3fb2c5d Add std.dbg module for inspecting rust values in memory. 2010-08-24 18:37:42 -07:00
Patrick Walton
fac28ad42f Disable task-growing logic for now until #151 is fixed 2010-08-20 11:05:06 -07:00
Roy Frostig
4a7aa75b5d Make _io.buf_reader read more than 0 bytes at a time. 2010-08-19 17:37:22 -07:00
Michael Bebenita
a4b8c74f9f Added simple deadlock detection in the scheduler. 2010-08-17 23:49:57 -07:00
Michael Bebenita
2c1ec6771b Lots of changes around memory managment in the Runtime. Added memory regions and fixed race caused by calling rust_srv::malloc() from multiple threads when sending messages. 2010-08-17 23:49:57 -07:00
Michael Bebenita
9fa2b53d8c Add a "special" rust_log flag to be used for debugging in cases where the full log output prevents races from occurring. 2010-08-17 23:49:57 -07:00
Michael Bebenita
e20752de68 Added labels to blocking conditions. 2010-08-17 23:49:57 -07:00
Michael Bebenita
7ff39ea448 Fixed deadlock by removing channel flushing. 2010-08-17 23:49:57 -07:00
Michael Bebenita
6e9f0f952d Made the lock_free_queue lock (temporarily, until fixed). 2010-08-17 23:49:57 -07:00
Michael Bebenita
5d98a311e4 Putting out the burning tree on Windows. Turns out you can completely starve threads by not yielding on windows/vmware, really weird. 2010-08-16 18:44:26 -07:00
Michael Bebenita
14f5b5750d Un-xfailed working tests. 2010-08-16 15:05:57 -07:00
Michael Bebenita
b40a9fa787 Pulled rust_srv in its own file. Some cleanup, and added varargs to assertion macros. 2010-08-16 15:05:57 -07:00
Roy Frostig
73ee16b1a4 A little tidy-up that should have gone in with 4e376852e7. 2010-08-12 19:20:29 -07:00
Roy Frostig
445d3fe39c Add vec debugging utility to _vec module. 2010-08-12 13:11:49 -07:00
Michael Bebenita
988695a96c Added support for task sleeping in the scheduler. 2010-08-11 21:24:04 -07:00
Roy Frostig
22719e45b8 Remove commented-out code that slipped in during last commit. 2010-08-11 16:10:44 -07:00
Michael Bebenita
74e12fcef6 Ignore upcall_flush for channels that are disassociated from ports. This makes task-comm-10 break a little less hard, but it still leaks because messages pending in the channel are never freed. 2010-08-11 16:08:45 -07:00
Michael Bebenita
d584de7a37 Made ref_count a word sized value. 2010-08-11 16:08:45 -07:00
Michael Bebenita
ff93e5e196 Print domain and task names in log prefix. 2010-08-11 16:08:45 -07:00
Roy Frostig
f307688bf4 Add native vec[u8] to str converter. Put in workaround for leak in str to vec[u8] converter. Add testcase exercising both. Drive-by fix a potential array-out-of-bounds write on rust_str buffers. 2010-08-11 16:06:45 -07:00
Graydon Hoare
dbe8760af3 Merge commit 'jyasskin/work'
Conflicts:
	src/rt/rust_dom.cpp
	src/rt/rust_upcall.cpp
2010-08-10 13:26:00 -07:00
Michael Bebenita
97d6342bf0 Synthesize a flush_chan upcall right before a channel's ref_count drops to zero. This should only happen in the Rust code and not in the drop glue, or on the unwind path. This change allows the task owning the channel to block on a flush and delete its own channel. This change also cleans up some code around rust_port and rust_chan. 2010-08-09 08:15:34 -07:00
Michael Bebenita
5917ca3519 Fixed deadlock in the scheduler caused by condition variables. 2010-08-09 08:06:08 -07:00
Michael Bebenita
4641fcef61 Added peek() to ptr_vec. 2010-08-09 08:01:40 -07:00
Michael Bebenita
f65c885c83 Made ref_count signed to help detect negative ref_count bugs. 2010-08-09 08:00:04 -07:00
Michael Bebenita
30734a9a7b Some pretty printing in the runtime. 2010-08-09 07:52:07 -07:00
Michael Bebenita
9ff6a3d031 Added class to abstract away platform specific thread primitives. 2010-08-09 07:42:06 -07:00
Michael Bebenita
56cd4e458a Made the runtime keep track of all live domains and print their state. 2010-08-09 07:34:11 -07:00
Michael Bebenita
c5744c8aef Added the RUST_SEED env variable to seed the Rust task scheduler -- helpful when debugging task race conditions within a single thread domain. 2010-08-09 07:30:48 -07:00
Michael Bebenita
0e422c748b Added "none" option to rust_log env string to disable all log output. 2010-08-09 07:07:00 -07:00
Michael Bebenita
d2c2fbe7ca Added timed_wait to condition variables. 2010-08-09 07:04:38 -07:00
Michael Bebenita
76ba8f1d84 Changed array_list::replace() return behavior. 2010-08-09 06:59:46 -07:00
Jeffrey Yasskin
b71340552f Add names to tasks and domains. These can either be an explicit literal string
after the "spawn" keyword, or implicitly the call expression used to start the
spawn.
2010-08-09 11:43:16 +02:00
Jeffrey Yasskin
3f6e8ffe64 Implement _str.len() to return the number of bytes, rename it to byte_len(),
and add a test.
2010-08-06 17:29:21 -07:00
Roy Frostig
1a8d609e89 Add a buffered writer to stdlib _io module. 2010-08-04 12:59:48 -07:00
Graydon Hoare
0b9c882d66 Log join-wait count under rust_log::TASK bits, not ::ALL. 2010-07-29 10:41:22 -07:00
Michael Bebenita
fa70212c86 Log dead tasks when dom is just waiting for refcounts to drop. 2010-07-28 20:30:29 -07:00
Michael Bebenita
a5b7a5202c Note that we keep running the main loop until all task refcounts are zero. 2010-07-28 20:30:29 -07:00
Michael Bebenita
4246d567b7 Move ports out into their own file, add data_message and make communication system use it (and proxies) instead of existing token scheme. 2010-07-28 20:30:29 -07:00
Michael Bebenita
4ff8e15128 Move notification-messages out into their own file and unify into notify_message, make them use proxies, cache task proxies in dom. 2010-07-28 20:30:29 -07:00
Michael Bebenita
defd8a66ea Rename rust_proxy_delegate to maybe_proxy, flesh out logic in it. Add strong-ref distinction on rust_proxy. 2010-07-28 20:30:29 -07:00
Michael Bebenita
30b3f8a117 Add rust_dom::log_state, for logging the running/blocked/dead vectors per scheduling iteration. 2010-07-28 20:30:29 -07:00
Michael Bebenita
5db5eb0c55 Null rust_task::cond on wakeup, add asserts and logging to block/wakeup. 2010-07-28 20:30:29 -07:00
Michael Bebenita
e327aa5093 Teach task_owned and dom_owned to find their dom via consistent interface. 2010-07-28 20:30:29 -07:00
Michael Bebenita
9fe4b0d404 Add modeline / file-local emacs var blocks. 2010-07-28 20:30:29 -07:00
Michael Bebenita
6c0ce25dbf Move rust_cond. 2010-07-28 20:30:29 -07:00
Michael Bebenita
06b52b70db Fix typos in comments, delete obsolete comments and dead commented code. 2010-07-28 20:30:29 -07:00
Michael Bebenita
cc4906ba79 Wrap long lines. 2010-07-28 20:30:29 -07:00
Michael Bebenita
436efdcb4f Add C++ wrapper around uthash. 2010-07-28 20:30:29 -07:00
Michael Bebenita
dbcc9b36b1 Let circular buffers actually grow to max sz, reset _next when resizing. 2010-07-28 20:30:29 -07:00
Michael Bebenita
c1795a1046 Change unread-on-destroy condition for circular buffer to merely a warning. 2010-07-28 20:30:29 -07:00
Michael Bebenita
c5e0ea7276 Add comment explaining NULL case in circular_buffer::enqueue and add logging to ::dequeue. 2010-07-28 20:30:29 -07:00
Michael Bebenita
d6cba83322 Add peek method to circular buffer. 2010-07-28 20:30:29 -07:00
Michael Bebenita
17fa6bfd9a Change _unit_sz to unit_sz and make public in circular_buffer. 2010-07-28 20:30:28 -07:00
Michael Bebenita
60b0486c11 Make circular buffer use only power-of-two sizes, cheaper arithmetic. 2010-07-28 20:30:28 -07:00
Michael Bebenita
d786469785 Add a warning interface to rust_srv. 2010-07-28 20:30:28 -07:00
Michael Bebenita
6afb6c767e Move allocation-tracking into rust_srv. 2010-07-28 20:30:28 -07:00
Michael Bebenita
712249d6b8 Log a separator when logging switches between threads. 2010-07-28 20:30:28 -07:00
Michael Bebenita
7ead107290 array_list improvements. 2010-07-28 20:30:28 -07:00
Roy Frostig
a9ad2e98e3 Refer to issue #136 at the offending source point. 2010-07-28 14:11:56 -07:00
Roy Frostig
596d19e2ea Test the deque a bit. Give it a get-by-index method. Fix two uncovered state-calculation bugs --- one decently, the other with an ugly hack. Bug on the latter coming right up. 2010-07-28 14:00:44 -07:00
Roy Frostig
085cd2ee7d vec_alloc takes four arguments these days, not three. 2010-07-25 22:21:07 -07:00
Roy Frostig
beca62e2e3 Attempt 2. This time actually reading my own diffs before committing. 2010-07-25 22:07:21 -07:00
Roy Frostig
b9f82d85f9 Attempt number 1 at extinguishing the windows tree remotely (apologies to those hacking on Sunday evening PST). 2010-07-25 22:05:39 -07:00
Roy Frostig
5b6e714d05 Expose an RNG (the one used by our runtime) to Rust via std. 2010-07-25 21:45:09 -07:00
Roy Frostig
1730d2e037 Notify copy glue of dst-initialization and fix _vec.alloc issues in lib and runtime. Closes #109. 2010-07-22 17:47:32 -07:00
Graydon Hoare
7ff2094496 Back out too-platform-fussy bits in preempt-test work. I hate this test. 2010-07-22 15:39:41 -07:00
Graydon Hoare
0f220ecae9 Beat up on the preempt test a bit more, as it keeps hanging under valgrind. 2010-07-22 15:05:35 -07:00
Jeffrey Yasskin
068c71f11c Fix -Wnon-virtual-destructor, which apple's gcc-4.0 seems to turn on by default. 2010-07-22 01:11:34 +08:00
Graydon Hoare
aca5082273 Back out "::ALL" default logbits. 2010-07-20 18:38:06 -07:00
Graydon Hoare
bf3528342a Be a little more careful before assuming we have crate debuginfo and abbrevs to read. 2010-07-20 17:42:49 -07:00
Michael Bebenita
66181ce2cc Fixed Windows build. 2010-07-20 15:44:21 -07:00
Graydon Hoare
9935a48e95 Fix message formatting in runtime library. 2010-07-20 15:16:09 -07:00
Michael Bebenita
c80483d582 Fixed circular buffer resizing bug. 2010-07-19 17:33:50 -07:00
Michael Bebenita
00d1465d13 Added a message passing system based on lock free queues for inter-thread communication. Channels now buffer on the sending side, and no longer require blocking when sending. Lots of other refactoring and bug fixes. 2010-07-19 14:05:18 -07:00
Graydon Hoare
5d8430afa7 Fix a couple fails with wrong arg count (new arg from last gc change); expand vec_grow logging a bit. 2010-07-15 18:59:31 -07:00
Roy Frostig
5d10a264de Add another null byte preceding commandline args passed to the root task, in position of closure/obj pointer. 2010-07-15 12:30:46 -07:00
Roy Frostig
7c8c98a6d7 Adjust call args laid out by fake frame created in rust_task::start to reflect new position of closure-or-obj pointer. 2010-07-15 12:30:46 -07:00
Graydon Hoare
7c837b8c9b Correct doubly-linked list management logic; bug exposed during conversation on issue #106. 2010-07-12 13:26:28 -07:00
Chris Double
2fcd99c3e6 Fix for compile error when using gcc 4.5.0 2010-07-11 11:10:56 +08:00
Graydon Hoare
b1eeb9b825 Change from 'spawner' to 'supervisor' in rust_task, and add an unsupervise call. 2010-07-05 14:43:40 -07:00
Graydon Hoare
fdf2eaac91 Divide vec fill by element size when reporting vec len. 2010-07-05 14:40:01 -07:00
Graydon Hoare
b0aba6510a Teach the dwarf readers to handle udata, so we can link with util.option; add util.rs to std.rc. 2010-07-05 14:38:02 -07:00
Graydon Hoare
75f0c36931 Perform valgrind-specific timing tweaks in a platform-sensitive manner. 2010-07-04 22:41:42 -07:00
Graydon Hoare
2a413070c6 Preempt works on non-windows, just needed a little valgrind love to complete in a reasonable time. 2010-07-04 21:18:47 -07:00
Graydon Hoare
f2861448ab Fix bug in win32 command-line arg processing. 2010-07-04 20:06:18 -07:00
Graydon Hoare
1fa468460d Fix typo in upcall_recv log message. 2010-07-04 02:15:11 -07:00
Graydon Hoare
b2692ef2ec Actually link GC allocations onto the gc_alloc_chain, der. 2010-07-02 08:17:41 -07:00
Graydon Hoare
c7ef0ded81 Improve logging on upcall_malloc. 2010-07-02 08:17:09 -07:00
Graydon Hoare
c33a522097 Handle DW_FORM_blcok4 in runtime dwarf reader, which we started emitting a while ago. 2010-07-02 08:16:34 -07:00
Graydon Hoare
113c31a26d Trap missing attr forms during dwarf-scan and shut down dwarf reader, don't crash. 2010-07-02 08:16:04 -07:00
Graydon Hoare
99be02a28d Indent/outdent when logging dwarf at runtime. 2010-07-02 08:15:27 -07:00
Graydon Hoare
5abc483d9a Move more of the GC logic into the runtime. 2010-06-28 18:53:43 -07:00
Graydon Hoare
7ea416f4c3 Add callable gc method exposed to user code, use it in mlist-cycle.rs test (still not quite working; some memory corruption in the recursive tag constructors, not the GC) 2010-06-25 23:57:30 -07:00
Graydon Hoare
37426e42cf Add sever-glue, for missing first stage of sweep. 2010-06-25 21:57:46 -07:00
Graydon Hoare
eed5c0aa24 Add rust_task::gc(size_t args) method that drops us back into the GC glue. 2010-06-25 16:54:03 -07:00
Graydon Hoare
67d1f0a9aa Emit gc glue and rearrange crate glue offsets slightly to have a regular order. 2010-06-25 15:43:55 -07:00
Graydon Hoare
4a1f86ccd7 Merge timer loop functions, fix win32 build broken by logger change. 2010-06-24 08:52:52 -07:00
Graydon Hoare
d6b7c96c3e Populate tree. 2010-06-23 21:03:09 -07:00