Commit Graph

169 Commits

Author SHA1 Message Date
Brian Anderson
56ec9cb278 rt: Run yet more task_start_wrapper cleanup on the C stack 2011-12-20 10:29:40 -08:00
Brian Anderson
25f7c844df rt: Don't reuse stack segments when they are not big enough 2011-12-19 22:47:28 -08:00
Brian Anderson
bd6b80c972 rt: Get rid of the rethrow in upcall_fail
Throwing in upcall_fail ends up running lots of code in the red zone. To avoid
it we have the personality function figure out which stack it's on and switch
as needed.
2011-12-18 17:17:31 -08:00
Brian Anderson
f57fd8de1f rt: Run the cycle collector on the C stack 2011-12-18 15:23:44 -08:00
Brian Anderson
74d5faa86e rt: Give each platform its own red zone definition 2011-12-18 15:23:41 -08:00
Brian Anderson
762d7e43a6 rt: Trim the red zone to 20k on all platforms 2011-12-18 15:22:56 -08:00
Brian Anderson
3fa930f598 rt: Remove a bogus FIXME from ~rust_task 2011-12-18 02:09:41 -08:00
Brian Anderson
fe683dfb80 rt: Get rid of the valgrind guard bytes at the end of the stack
Preventing us from writing beyond our allocations is _what valgrind does_,
so telling valgrind not to let us write to the end of the stack isn't
buying anything.
2011-12-17 16:46:50 -08:00
Brian Anderson
4ac345939c rt: Cache an extra stack segment to avoid bad behavior at stack boundaries 2011-12-17 13:45:38 -08:00
Brian Anderson
0ed5117a9d rt: Set the default stack size to 768 bytes. Double on each alloc 2011-12-17 13:45:38 -08:00
Brian Anderson
23df4de86d rt: Fix alignment of new stack segments 2011-12-16 18:18:43 -08:00
Brian Anderson
81f932e7d7 rt: Fix alignment of stacks generated by __morestack 2011-12-07 14:06:46 -08:00
Brian Anderson
9656ceac60 rt: Put 16 guard bytes at the end of the stack 2011-12-06 22:35:42 -08:00
Brian Anderson
5d1a1dc420 rt: Rename stk_seg.limit to stk_seg.end
rust_task is using the word limit it two ways, so one has to change.
2011-12-06 21:45:53 -08:00
Brian Anderson
9a738fd61d rt: Various tweaks to make __morestack unwinding work on linux
When unwinding through __morestack the stack limit in the TLS is invalidated
and must be reset. Instead of actually landing at __morestack we're
just going to make all our Rust landing pads call upcall_reset_stack_limit,
which will find the stack segment that corresponds to the current stack
pointer and put the limit in the TLS.

Also massively expand the stack segment red zone to make more room for the
dynamic linker. Will fix in the future.
2011-12-06 16:32:41 -08:00
Austin Seipp
b513a5a500 Make valgrind usage more consistent and less error prone.
I was still having issues with the build system somehow getting confused
as to which set of valgrind headers to use when compiling rt.

This commit moves all the valgrind headers into their own directory
under rt and makes the usage more consistent. The compiler is now passed
the -DNVALGRIND flag when valgrind is not installed, as opposed to
passing -DHAVE_VALGRIND.

We also pass -I src/rt to the compiler when building rt so you can more
easily import what you want. I also cleaned up some erroneous #includes
along the way.

It should be safe to always just import the local valgrind headers and use
them without question. NVALGRIND turns the operations to no-ops when it
is active, and the build and tests run cleanly with or without.
2011-12-06 01:15:29 -06:00
Brian Anderson
58844aee42 rt: Make stack unwinding work more correctly with stack growth 2011-12-05 17:42:58 -08:00
Brian Anderson
52d7dc5e0a rt: Update 32-bit __morestack for recent LLVM changes 2011-12-04 20:40:34 -08:00
Brian Anderson
1974cf9a81 rt: Move RED_ZONE_SIZE to rust_task.cpp 2011-12-01 15:50:00 -08:00
Brian Anderson
249f017bf2 rt: Add FIXME's about future changes to LLVM's __morestack impl 2011-12-01 15:33:15 -08:00
Brian Anderson
6da1a3fcd6 rt: Refactor record_sp into task::record_stack_limit 2011-12-01 15:26:42 -08:00
Brian Anderson
f2de42c39a rt: Reorganize stack growth code 2011-11-30 20:31:33 -08:00
Brian Anderson
e6ef4d929c rt: Remove the stack pointer field of stk_seg 2011-11-30 20:31:33 -08:00
Brian Anderson
06f4cb43f6 rt: Delete the entire stack chain on task destruction
Unwinding through __morestack on 64-bit Linux seems to be no big deal, and
all we have to do is free the stacks to make unwinding work with split stacks.
2011-11-29 22:22:49 -08:00
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