Brian Anderson
ba8f369f89
rt: Reduce the mac red zone to 2K
2011-12-20 14:24:13 -08:00
Brian Anderson
2e230b1cf9
rt: Reduce the linux red zone to 2K
2011-12-20 14:02:59 -08:00
Brian Anderson
6443a7b513
rt: Do fewer stack canary checks
2011-12-20 13:54:47 -08:00
Brian Anderson
93fef2e113
rt: Parenthesize the red zone macros
2011-12-20 11:57:22 -08:00
Brian Anderson
784713ec68
rt: Add a canary value to the end of every stack
...
Check it on upcall entry and exit, and on stack deletion
2011-12-20 11:48:47 -08:00
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
05bf105c90
rt: Rename asm_call_on_stack to __morestack
...
Newer gdb's will backtrace through functions named __morestack even
if they change the stack.
2011-12-19 22:05:40 -08:00
Brian Anderson
edf6e1ec0e
rt: Zero the bottom frame's return address and base pointer
...
My reading of libunwind leads me to believe this is expected.
Closes #1322
2011-12-19 18:47:39 -08:00
Brian Anderson
1bfc4e2e6c
rt: Save and restore %rax/%eax in __morestack
...
This doesn't matter now since we use an out pointer for return
values but it's sure to show up mysteriously someday.
2011-12-19 18:16:21 -08:00
Brian Anderson
c3569abb8c
rt: Remove some unused stack from i386/morestack.S
2011-12-19 18:16:19 -08:00
Brian Anderson
d2e7336a01
rt: Remove unused saves from __morestack
2011-12-19 16:24:10 -08:00
Brian Anderson
50dc80f617
rt: Give upcall_new_stack the same convention as other upcalls
2011-12-19 16:24:10 -08:00
Brian Anderson
bedcaad97e
rt: Give upcall_del_stack the same convention as other upcalls
2011-12-19 16:24:10 -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
c73eb8ff51
rt: Create different stack-switching paths for upcalls and shims
...
Shims need to play with the stack limit, upcalls don't. Only one upcall,
upcall_fail is allowed to catch, and we need a find a way to get rid of that
catch as well because it results in _Unwind_Resume running off the end of the
Rust stack.
2011-12-18 16:17:55 -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
1a1fdf34b1
rt: Add lots of documentation to __morestack
2011-12-18 02:02:35 -08:00
Brian Anderson
7359fa422b
Revert "rt: Turn on big stacks again. Unwinding still doesn't always succeed on mac"
...
This reverts commit 68f4849f0f
.
2011-12-18 00:42:46 -08:00
Brian Anderson
68f4849f0f
rt: Turn on big stacks again. Unwinding still doesn't always succeed on mac
2011-12-17 17:54:43 -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
471b4d6e58
rt: Use a DWARF CFI scheme that works on mac in __morestack
2011-12-17 14:10:44 -08:00
Brian Anderson
7da8ab8fab
rt: Turn on stack alignment checks for mac
2011-12-17 14:10:40 -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
b5b2ac0ec4
rt: Make 32-bit morestack compatible with fastcc
2011-12-16 18:18:43 -08:00
Brian Anderson
7d51961b6f
rt: Fix saved address of unwinding %rsp in __morestack
...
I haven't thought too deeply about this, but I think I was telling the
unwinder to use the stack pointer for the wrong frame when unwinding. Not sure
how that could have worked at all, but this results in the correct alignment
for cleanups.
2011-12-16 18:18:43 -08:00
Brian Anderson
9d70c1949e
rt: Fix alignment of the call to upcall_del_stack in __morestack
2011-12-16 18:18:43 -08:00
Brian Anderson
23df4de86d
rt: Fix alignment of new stack segments
2011-12-16 18:18:43 -08:00
Brian Anderson
ab4f35c1f1
rt: Only call check_stack_alignment on linux
2011-12-16 18:18:43 -08:00
Brian Anderson
121c420184
rt: Insert stack alignment checks into upcalls
2011-12-16 18:18:43 -08:00
Elly Jones
89e880d613
std: file_is_dir -> path_is_dir, add path_exists
2011-12-16 17:37:21 -05:00
Niko Matsakis
88818334b7
update to not look at descs[], which is not necessarily valid
...
if the input is a statically allocated type_desc
2011-12-16 08:06:45 -08:00
Niko Matsakis
1e3259e119
massive refactor of how closures work
2011-12-15 13:44:06 -08:00
Niko Matsakis
35fe86dab7
export upcall_clone_type_desc
2011-12-14 14:32:25 -08:00
Niko Matsakis
f512e67fb9
clone type desc into exchange heap
2011-12-14 14:32:24 -08:00
Niko Matsakis
6a8cb704d9
get basic code generation working, clone type descs for lambda[send]
2011-12-14 14:32:20 -08:00
Brian Anderson
f0254e1e0d
rt: Add a FIXME to 32-bit __morestack about trashing %eax
2011-12-13 19:13:17 -08:00
Brian Anderson
f332643e7f
rt: Use %ecx instead of %eax during the second half of __morestack
...
If Rust code made use of return values then using %eax here would clobber it
2011-12-13 18:26:56 -08:00
Brian Anderson
32087f5c2a
rt: Don't clobber fastcc argument registers in __morestack
2011-12-13 15:54:14 -08:00
Niko Matsakis
a98dec035f
fix track alloc code
2011-12-12 18:25:17 -08:00
Brian Anderson
1c1bc2f1cd
rt: Remove some duplicated code from 64-bit __morestack
2011-12-12 16:58:21 -08:00
Brian Anderson
887d970fee
rt: Make unwinding through __morestack work on mac
...
Had to bump the min stack size in some of the tests from 256 bytes
to 1024 bytes. Not sure why yet.
2011-12-12 16:15:29 -08:00
Brian Anderson
3e32f6623c
rt: Write CFI instructions that (might) work on mac in __morestack
...
The DW_CFA_val_offset_sf instruction doesn't seem to work on mac,
even after implementing it in the llvm-mc assembler, so now
I'm looking for a different way to communicate the stack pointer
adjustment to the unwinder.
2011-12-12 16:14:17 -08:00
Brian Anderson
7a8e73662d
rt: Make unwinding through __morestack work on mac
...
Had to bump the min stack size in some of the tests from 256 bytes
to 1024 bytes. Not sure why yet.
2011-12-11 18:49:04 -08:00
Brian Anderson
7bc34f63d8
rt: Write CFI instructions that (might) work on mac in __morestack
...
The DW_CFA_val_offset_sf instruction doesn't seem to work on mac,
even after implementing it in the llvm-mc assembler, so now
I'm looking for a different way to communicate the stack pointer
adjustment to the unwinder.
2011-12-11 16:32:36 -08:00
Brian Anderson
b73caec3ce
rt: Call upcall_fail on the C stack
2011-12-11 14:35:18 -08:00
Brian Anderson
5cd08586f6
rt: Add DWARF CFI info to asm_call_on_stack
...
This will allow the unwinder to unwind this function so we can call
upcall_fail on the C stack.
2011-12-11 14:35:09 -08:00
Brian Anderson
4699b6865f
build: Use llvm-mc as our assembler
...
LLVM's assembler understands .cfi pseudo-ops on the mac, which we need in
order to generate frames that can be DWARF-unwound
2011-12-10 18:51:21 -08:00
Brian Anderson
9e6ff44d93
rt: Make __morestack work on win32
2011-12-08 16:47:33 -08:00
Brian Anderson
94b0fee6f1
rt: Reorganize and add documentation for rust_upcall.cpp
2011-12-07 18:50:23 -08:00
Brian Anderson
31fe5d0bd8
rt: Run most upcalls on the C stack
2011-12-07 18:50:23 -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
3d7b89bc4d
rt: Reorganize rust_upcall.cpp a bit
2011-12-06 21:44:19 -08:00
Brian Anderson
00636e3155
rt: Convert log_type and cmp_type upcalls to shim form
2011-12-06 21:44:19 -08:00
Brian Anderson
c11d0b0aa0
rt: Move upcall_cmp_type/upcall_log_type to rust_upcall.cpp
2011-12-06 21:44:18 -08:00
Niko Matsakis
9b7347dd96
modify upcalls to take structs as args
2011-12-06 21:44:18 -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
a731f165df
test: Test hitting the dynamic linker in the red zone
2011-12-05 17:20:59 -08:00
Brian Anderson
3b8bfaf534
rt: Use an out pointer for rust_new_stack
...
upcall_call_shim_on_c_stack does not handle return values
2011-12-05 17:11:35 -08:00
Brian Anderson
98cd96ce96
test: Add more tests for stack growth
2011-12-05 14:44:15 -08:00
Brian Anderson
1720bc2e81
rt: Unwind through __morestack on 32-bit linux
2011-12-05 12:10:55 -08:00
Brian Anderson
52d7dc5e0a
rt: Update 32-bit __morestack for recent LLVM changes
2011-12-04 20:40:34 -08:00
Brian Anderson
292663b8ef
rt: Implement 32-bit __morestack for mac
2011-12-02 17:44:23 -08:00
Brian Anderson
c254936f32
rt: Fix __morestack prologue on x86_64 mac
2011-12-02 15:32:51 -08:00
Brian Anderson
691b517fb9
rt: Fix 64-bit linux __morestack
2011-12-01 20:56:05 -08:00
Brian Anderson
3e5b314c0b
rt: Implement __morestack for 64-bit mac. Doesn't unwind yet
2011-12-01 19:44:14 -08:00
Brian Anderson
8bf3d85b9d
rt: Implement record_sp for 64-bit mac
2011-12-01 19:44:13 -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
7476a39e47
stdlib: Implement some preliminary libuv bindings
...
std::uv is intended to be low-level, exactly mirroring the C API.
Difficult to continue the implementation now without scheduler
improvements.
2011-12-01 10:24:21 -08:00
Brian Anderson
f2de42c39a
rt: Reorganize stack growth code
2011-11-30 20:31:33 -08:00
Brian Anderson
dd48a1af58
rt: Remove redundant defs of RUST_DEL_STACK
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
408d4ec0ef
rt: Remove upcall_alloc_c_stack/call_c_stack, et. al.
...
We are using upcall_call_shim_on_c_stack now
2011-11-30 20:31:32 -08:00
Brian Anderson
037ca7f7cb
rt: Rewrite 32-bit __morestack to use the shim upcall
2011-11-30 20:31:32 -08:00
Brian Anderson
777c3584b9
rt: Request the correct number of bytes on the C stack
2011-11-29 23:01:19 -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
72baf70748
rt: Conditionalize out the 32-bit __morestack for everything but Linux
...
Currently broken everywhere else
2011-11-29 13:52:34 -08:00
Brian Anderson
8cbba79208
rt: Fix the name of the linux macro in x86_64/morestack.S
2011-11-29 13:50:34 -08:00
Brian Anderson
afb8f01741
rt: Fix calculation of stack args location in x86_64/morestack.S
2011-11-29 13:47:54 -08:00
Brian Anderson
9675343dc9
rt: Fix i386/morestack.S for static linking
2011-11-29 13:47:54 -08:00
Brian Anderson
a9967423f8
rt: Make 64-bit __morestack grow and shrink properly
2011-11-28 21:57:52 -08:00
Brian Anderson
5461c61af2
rt: Remove a FIXME frome x86_64/morestack.S
2011-11-28 20:14:12 -08:00
Brian Anderson
ef20afc36c
rt: Get 64-bit Linux __morestack allocating new stacks
2011-11-28 18:39:18 -08:00
Brian Anderson
3a80d7b0e3
rt: Set hidden visibility on __morestack
...
Each crate will have its own copy of this function, which should not be
exported.
2011-11-28 18:01:39 -08:00
Brian Anderson
28745aa07f
rt: Rename L$bail to .L$bail in i386/morestack.S
2011-11-28 17:10:00 -08:00
Brian Anderson
e075412a92
build: Stop linking morestack.S to rt
...
__morestack has to be linked statically. The odd calling convention on x86_64
results in the arguments to __morestack (r10 & r11) being clobbered by the
dynamic linker. gcc links all the __morestack functions statically.
2011-11-28 16:37:29 -08:00
Brian Anderson
cd75c9ce11
rt: Implement part of the 64-bit __morestack
2011-11-28 16:29:52 -08:00
Brian Anderson
020d8f12a0
rt: Implement record_sp for 64-bit linux
2011-11-27 19:00:26 -08:00
Brian Anderson
93e8783496
rt: Make __morestack build on win32
2011-11-22 18:02:13 -08:00
Brian Anderson
0580d4e77a
rt: Add x86_64 record_sp stub
2011-11-22 18:02:12 -08:00