Commit Graph

1026 Commits

Author SHA1 Message Date
Brian Anderson
fa13fd9d64 rt: Remove set_min_stack 2012-01-29 21:27:37 -08:00
Brian Anderson
6548cdd59b rt: Make the initial segment of the main task's stack 1MB
This is a trick to fool microbenchmarks. Closes #1681
2012-01-29 21:20:39 -08:00
Brian Anderson
fc5ec630d4 rt: Remove unused variable 2012-01-27 18:45:43 -08:00
Donovan Preston
3d76922f97 Implement timers. 2012-01-27 14:04:13 -08:00
Donovan Preston
9e39219d9b Shuffle around to work with rust-spidermonkey 2012-01-26 16:01:26 -08:00
Brian Anderson
ab223e0618 Merge pull request #1627 from graydon/win32-quoting
Fix win32 command-line quoting on rust_run_program.
2012-01-25 14:33:10 -08:00
Jyun-Yan You
c2bf9b7726 freebsd clang support 2012-01-24 11:48:36 -08:00
Graydon Hoare
7da3733c73 Fix win32 command-line quoting on rust_run_program. 2012-01-23 18:37:26 -08:00
Brian Anderson
07f8555b3e std: Add some hacks to use libuv 2012-01-22 20:06:58 -08:00
Niko Matsakis
cac46eac4b revert accidental commits 2012-01-20 09:34:15 -08:00
Niko Matsakis
b7811e613d small fixes for building dist on windows 2012-01-20 08:59:07 -08:00
Niko Matsakis
7bc2930cfa roll back commit 1c7a62 2012-01-17 20:21:09 -08:00
Niko Matsakis
a83ad1b9e6 encode variant names and have log print them out. 2012-01-17 10:33:28 -08:00
Marijn Haverbeke
1c7a62c93b Use a memset upcall to zero things without static alignment
This fixes issues #843 and #1546. The cost of an upcall is
unfortunate, though. I assume there must be a way to simply manually
compute the pointer or size, using something akin to the formula in
`align_to` in `rust_util.h`. I could not get this to work,
unfortunately.
2012-01-17 14:04:55 +01:00
Jyun-Yan You
e4d553c534 use correct size for logging mod_entry state fields
The compiler outputs 32-bit values for these and on 64-bit FreeBSD
the runtime was scribbling on some state used by getenv and segfaulting.
2012-01-16 00:41:14 -08:00
Brian Anderson
f5f36e8b49 rt: Allow console logging to be turned off 2012-01-13 13:44:09 -08:00
Brian Anderson
0616cba62b libcore: Add sys::set_exit_status
Sets the process exit code
2012-01-12 22:24:27 -08:00
Niko Matsakis
263f4c58a0 add tydescs into shape, rewrite walk_fn_contents() 2012-01-12 13:47:38 -08:00
Niko Matsakis
e55aa6e5ef free uniq data we encounter on the sweep, walk thru them otherwise 2012-01-12 13:47:38 -08:00
Niko Matsakis
09869cd056 update iface cc code to not walk contents (as with other boxes) 2012-01-11 18:28:09 -08:00
Brian Anderson
94c389a25b rt: Add RUST_MAX_STACK env var with 8MB default
Closes #1489
2012-01-11 13:57:11 -08:00
Niko Matsakis
c68345e57e add a log_str() function and allow '%?' in fmt strings to use it 2012-01-11 10:32:54 -08:00
Marijn Haverbeke
87253cf3a9 Revert some iface shape code, fix a few more things in it
We can now run the compiler with an iface-based hashtable
implementation.
2012-01-11 11:46:44 +01:00
Niko Matsakis
441a42c5d2 update shape code to handle iface instances 2012-01-10 19:05:28 -08:00
Patrick Walton
d4a4b82973 rt: Export upcall_s_shared_malloc since the SpiderMonkey bindings need it 2012-01-10 10:44:26 -08:00
Niko Matsakis
110c3ccdca add rust_task_is_unwinding predicate and do not kill if already unwinding 2012-01-09 19:53:32 -08:00
Brian Anderson
7e8974305c rt: Set Linux red zone to 20K again
With runtime logging on it smashes the stack
2012-01-09 11:44:36 -08:00
Marijn Haverbeke
1ee9a83de0 Fix bug in iface shape code
Issue #1437
2012-01-09 15:12:18 +01:00
Marijn Haverbeke
47cfeba467 Add cases for iface values to rust_shape.h
They appear to log okay now, but I can't promise much beyond that.

@pcwalton If you feel like taking a look, I'd be grateful. Interfaces are
boxes containing a (tydesc, dict, value_of_any_type) tuple, where the leading
tydesc describes the whole tuple.

Issue #1437
2012-01-09 14:44:21 +01:00
Haitao Li
26536e6915 rt: Fix build with clang on non-Mac 2012-01-09 15:34:06 +08:00
Marijn Haverbeke
9a7061dfab Fix some bad code in the dict interner
Issue #1436
2012-01-08 21:57:54 +01:00
Niko Matsakis
5bee80612b fix valgrind error: allocate enough space for all type descs 2012-01-07 08:03:34 -08:00
Niko Matsakis
2f0eb7ae0c add rust_util.h header file 2012-01-06 22:40:32 -08:00
Niko Matsakis
6237368cc2 plug leak: free shared type descrs recursively, as we ought to 2012-01-06 22:40:32 -08:00
Niko Matsakis
8506241f3a fix how we walk functions to match new closure fmt 2012-01-06 22:40:31 -08:00
Niko Matsakis
25e81e34ea rewrite task tests 2012-01-06 22:40:31 -08:00
Niko Matsakis
98f5109cde simplify task impl 2012-01-06 22:40:31 -08:00
Brian Anderson
4632358cbc Revert "rt: Reduce mac red zone to 6K"
This reverts commit d499e739a1.
2012-01-06 18:16:19 -08:00
Brian Anderson
d499e739a1 rt: Reduce mac red zone to 6K 2012-01-06 16:42:26 -08:00
Brian Anderson
2f4c9315af rt: Fail the scheduler immediately on task failure in win32 2012-01-06 16:18:56 -08:00
Marijn Haverbeke
822acdd170 Make binding of fns with bounded type parameters work
Interns non-static dicts to heap-allocated equivalents so that they no
longer have stack scope.

Closes #1436
2012-01-06 17:40:05 +01:00
Niko Matsakis
295df68faf add alignment to i386 for good measure, though we do not yet
save SSE regs in i386 (we ought to, though!)
2012-01-06 07:57:56 -08:00
Niko Matsakis
fefae72a53 fix alignment of registers structure 2012-01-06 07:45:06 -08:00
Jyun-Yan You
21eadbe6f1 add missing library, enable segmented stacks for freebsd 2012-01-01 20:18:55 -08:00
Jyun-Yan You
d4884b6c6e forgot to add parentheses 2012-01-01 20:18:55 -08:00
User Jyyou
a59c4b1b47 freebsd support 2012-01-01 20:18:55 -08:00
Graydon Hoare
5fd0a3be0c Save and restore xmm regs across the call to UPCALL_NEW_STACK during __morestack, close #1388. 2011-12-29 11:49:29 -08:00
Graydon Hoare
884adf38a1 Remove obsolete comments. 2011-12-29 10:21:05 -08:00
Graydon Hoare
5930463faa Tidy up some drift in runtime logging, close #1380. 2011-12-28 11:53:12 -08:00
Brian Anderson
b9b9b3e570 rt: Set the initial obstack size to 128 bytes
Double the size on each allocation
2011-12-25 19:18:05 -08:00
Graydon Hoare
3b61064631 Revert all of yesterday's snapshots and try again. Cursed! 2011-12-22 10:30:04 -08:00
Brian Anderson
dedfef4c4c Revert "wip"
This reverts commit aeadc6269e.
2011-12-20 20:57:04 -08:00
Brian Anderson
854daaec0c rt: Lock before using the random number generator
Seeing crashes here trying to stress test concurrent tasks
2011-12-20 20:56:06 -08:00
Brian Anderson
aeadc6269e wip 2011-12-20 20:15:09 -08:00
Brian Anderson
128621be97 rt: Remove rust_task::grow. Obsolete 2011-12-20 20:02:57 -08:00
Brian Anderson
cab4da70c8 rt: Don't check the stack canary on most upcalls 2011-12-20 16:50:54 -08:00
Brian Anderson
2a490d1cf8 Revert "rt: Reduce the mac red zone to 2K"
This reverts commit ba8f369f89.
2011-12-20 15:17:30 -08:00
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