rust/mk
bors 31a209ca42 auto merge of #9834 : alexcrichton/rust/morestack, r=brson
This commit re-introduces the functionality of __morestack in a way that it was
not originally anticipated. Rust does not currently have segmented stacks,
rather just large stack segments. We do not detect when these stack segments are
overrun currently, but this commit leverages __morestack in order to check this.

This commit purges a lot of the old __morestack and stack limit C++
functionality, migrating the necessary chunks to rust. The stack limit is now
entirely maintained in rust, and the "main logic bits" of __morestack are now
also implemented in rust as well.

I put my best effort into validating that this currently builds and runs successfully on osx and linux 32/64 bit, but I was unable to get this working on windows. We never did have unwinding through __morestack frames, and although I tried poking at it for a bit, I was unable to understand why we don't get unwinding right now.

A focus of this commit is to implement as much of the logic in rust as possible. This involved some liberal usage of `no_split_stack` in various locations, along with some use of the `asm!` macro (scary). I modified a bit of C++ to stop calling `record_sp_limit` because this is no longer defined in C++, rather in rust.

Another consequence of this commit is that `thread_local_storage::{get, set}` must both be flagged with `#[rust_stack]`. I've briefly looked at the implementations on osx/linux/windows to ensure that they're pretty small stacks, and I'm pretty sure that they're definitely less than 20K stacks, so we probably don't have a lot to worry about.

Other things worthy of note:
* The default stack size is now 4MB instead of 2MB. This is so that when we request 2MB to call a C function you don't immediately overflow because you have consumed any stack at all.
* `asm!` is actually pretty cool, maybe we could actually define context switching with it?
* I wanted to add links to the internet about all this jazz of storing information in TLS, but I was only able to find a link for the windows implementation. Otherwise my suggestion is just "disassemble on that arch and see what happens"
* I put my best effort forward on arm/mips to tweak __morestack correctly, we have no ability to test this so an extra set of eyes would be useful on these spots.
* This is all really tricky stuff, so I tried to put as many comments as I thought were necessary, but if anything is still unclear (or I completely forgot to take something into account), I'm willing to write more!
2013-10-19 09:46:18 -07:00
..
clean.mk remove the rusti command 2013-10-16 22:54:38 -04:00
ctags.mk Reliciense makefiles and testsuite. Yup. 2012-12-10 17:32:58 -08:00
dist.mk remove the rusti command 2013-10-16 22:54:38 -04:00
docs.mk rustdoc: Add the ability to input json 2013-09-30 20:31:19 -07:00
host.mk Fix #3225: Incorporate feedback from Graydon. 2013-07-09 13:08:50 +02:00
install.mk remove the rusti command 2013-10-16 22:54:38 -04:00
llvm.mk The purpose of these headers is to fix issues with mingw v4.0, as described in #9246. 2013-09-17 01:06:01 -07:00
perf.mk mk: cleanup - lib and executable suffix handling 2013-03-02 21:25:12 +09:00
platform.mk Use __morestack to detect stack overflow 2013-10-19 09:43:31 -07:00
pp.mk Remove the fuzzer 2013-06-15 16:12:56 -07:00
rt.mk auto merge of #9834 : alexcrichton/rust/morestack, r=brson 2013-10-19 09:46:18 -07:00
rustllvm.mk Fixed makefile to point to the new llvm build directory. 2013-09-05 23:44:10 -07:00
snap.mk mk: Remove CFG_INSTALL_SNAP logic. #2664 2013-07-19 15:35:42 -07:00
stage0.mk Fix for make -j race from #9531 injected by cleanup in b1a22518f0. 2013-09-26 23:56:53 +02:00
target.mk Allow stage0 warnings 2013-10-16 11:53:05 -07:00
tests.mk Remove jemalloc from the runtime 2013-10-18 10:38:21 -07:00
tools.mk remove the rusti command 2013-10-16 22:54:38 -04:00