Commit Graph

1026 Commits

Author SHA1 Message Date
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
Brian Anderson
6bdf347418 rt: Make __morestack (without unwinding) work on 32-bit linux 2011-11-22 18:02:10 -08:00
Niko Matsakis
9fa44a41e6 get pure wrappers approach running 2011-11-18 16:32:19 -08:00
Brian Anderson
d6ab8ebb07 rt: Add more comments to rust_task_sleep 2011-11-18 16:02:48 -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
71bcba6815 intrinsics: Remove declaration of port_recv 2011-11-18 15:37:14 -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
3a6320f71b intrinsics: Eliminate recv intrinsic
This intrinsic existed just to get ahold of the return pointer. I replaced it
with a call_with_retptr intrinsic that grabs the return pointer and passes it
to another Rust function, thereby eliminating the need to call C functions on
the Rust stack.
2011-11-18 12:48:54 -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
Brian Anderson
21865ddce6 intrinsics: Remove the call to get_task from task_sleep 2011-11-18 10:32:27 -08:00
Brian Anderson
eecbc815ac intrinsics: Add some comments 2011-11-18 10:32:27 -08:00
Brian Anderson
3feaecd757 intrinsics: Move the call to upcall_fail out of rust_intrinsic_cast 2011-11-18 10:32:27 -08:00
Brian Anderson
9ca2005959 rt: Remove size_of and align_of functions. Now written in Rust 2011-11-18 10:32:27 -08:00
Niko Matsakis
eff7fae7b9 comparing/walking two pointers still aligns same as 1 ptr 2011-11-17 15:41:45 -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
Niko Matsakis
f597971441 make ref cnts a long not an int 2011-11-17 14:23:48 -08:00
Niko Matsakis
11187437c5 Merge branch 'master' of github.com:graydon/rust 2011-11-17 13:44:04 -08:00
Brian Anderson
6a0e85b81c Remove intrinsic_2 functions 2011-11-17 13:23:35 -08:00
Niko Matsakis
f9231e932c add an extra underscore 2011-11-17 12:02:15 -08:00
Brian Anderson
dd275cd749 Stop using temporary intrinsic_2 functions 2011-11-17 11:55:04 -08:00
Brian Anderson
30871408a6 rt: Remove debug printf in rust_start 2011-11-17 11:48:10 -08:00
Brian Anderson
a92699fe58 rt: Make morestack link on x86_64. Still utterly broken 2011-11-17 11:12:59 -08:00
Brian Anderson
d624e523c9 rt: Make stack growth code build on Linux 2011-11-17 10:53:06 -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
Brian Anderson
5559e149e4 Revert "rt: Make stack growth code build on Linux"
This reverts commit da4b7da4e1.
2011-11-16 18:49:07 -08:00
Brian Anderson
da4b7da4e1 rt: Make stack growth code build on Linux 2011-11-16 18:33:00 -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
Brian Anderson
342dc21d2c Disconnect ports before draining them. Issue #1155 2011-11-16 17:22:14 -08:00
Niko Matsakis
cbcdeb80d9 remove wrappers from intrinsics 2011-11-16 15:27:08 -08:00
Brian Anderson
d2199e8716 Various fixes for x86_64 on linux
Configure LLVM correctly, use the right data layout, add the readlink
function back, fix C constants, etc.
2011-11-16 15:24:56 -08:00
Niko Matsakis
5aaafa704f adjust alignment, size of tag variant id and make it easy to
adjust in the future
2011-11-16 15:16:43 -08:00
Niko Matsakis
26b0662fb8 fix alignment for chan_handle structs; rust equiv is translated
to char[16], not struct{long,long}
2011-11-16 15:16:42 -08:00
Niko Matsakis
69911c2bc1 temp. disable cycle coll. on x86_64 2011-11-16 15:16:41 -08:00
Niko Matsakis
b78c096ebc enum does not have a size consistent with a tag, so use unsigned long instead 2011-11-16 15:16:41 -08:00
Niko Matsakis
59e2a0a9c1 add shim upcall func 2011-11-16 15:16:40 -08:00
Niko Matsakis
3617f0377f correct alignment 2011-11-16 15:16:40 -08:00
Niko Matsakis
85083ec51b begin efforts to use shim functions for c-stack calls 2011-11-16 15:16:40 -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
5b9f76eb7c stdlib: Run cleanups on data that fails to send 2011-11-14 14:07:52 -08:00
Brian Anderson
f619d5e9e2 rt: Add locking invariants to rust_port 2011-11-13 16:38:34 -08:00
Brian Anderson
58e923de6e rt: Perform task notification before killing the parent task 2011-11-13 16:36:47 -08:00
Brian Anderson
138d9ca5d5 Drop enqueued elements when a port is destructed. Closes #1155 2011-11-13 15:43:58 -08:00
Brian Anderson
a6f9f73f06 rt: Make rust_port's ref counting non-atomic
Now that the task lock must be held there's no need for atomicity
2011-11-11 16:12:48 -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
Brian Anderson
2385deaa0d rt: Add locking invariants to rust_task 2011-11-11 12:11:21 -08:00
Brian Anderson
5e0e32faac rt: Remove drop_port. Unused 2011-11-11 12:11:21 -08:00
Brian Anderson
5d1e321ecb rt: Remove rust_chan 2011-11-11 12:11:21 -08:00
Brian Anderson
f705f68121 rt: Remove rust_aio.cpp. Bitrotted. 2011-11-10 18:02:08 -08:00
Brian Anderson
793da65a8e rt: Move rust_chan::send to rust_port::send 2011-11-10 17:53:19 -08:00
Brian Anderson
371574f64b rt: Remove rust_token. Unused 2011-11-10 17:35:21 -08:00
Brian Anderson
f5c4ce79a7 rt: Remove del_chan, take_chan, drop_chan. Unused 2011-11-10 17:28:28 -08:00
Brian Anderson
e4f980810b rt: Simplify channel-port association
It turns out that there's only ever a single channel per port these days,
and it always has the same lifetime as the port, so we don't need a list or a
complex association protocol.
2011-11-10 17:26:22 -08:00
Brian Anderson
08d0ff38bc rt: Remove new_chan. Not needed 2011-11-10 15:59:31 -08:00
Brian Anderson
0dc8387995 rt: Remove chan_send. Unused. 2011-11-10 15:36:09 -08:00
Niko Matsakis
7baf68b0bd hack around the problem that x86_64 expects first few args in regs.
call on c-stack expects all data to be delivered on the stack.
2011-11-09 20:05:49 -08:00
Niko Matsakis
fc064f4410 use uint64_t when adjusting stack ptr 2011-11-09 20:05:49 -08:00
Niko Matsakis
ff5b319ce5 correct stack alignment 2011-11-08 21:14:09 -08:00
Niko Matsakis
2edd3135ad cleanup, removing comments and dead code 2011-11-08 21:14:09 -08:00
Niko Matsakis
1a28ad4fa4 fix bug in loading argument regs 2011-11-08 21:14:09 -08:00
Niko Matsakis
b30a76ed1b correct calling convention for x86_64 2011-11-08 21:14:09 -08:00
Niko Matsakis
0668eed81e fix alignment of xmm register storage 2011-11-08 21:11:47 -08:00
Niko Matsakis
e24d1dd6f5 rewrite so that memory allocations have 0 overhead by default 2011-11-08 21:11:47 -08:00
Niko Matsakis
75b98a9076 Correct the arithmetic on 64-bit builds. 2011-11-08 21:11:47 -08:00
Erick Tryzelaar
1c87b9708c Removing the baked in libuv. 2011-11-08 19:01:47 -08:00
Brian Anderson
061d2c2f77 Make task_sleep an intrinsic. 2011-11-08 15:58:08 -08:00
Brian Anderson
68f82de817 rt: Remove task_yield builtin
This is just a special case of task_sleep
2011-11-08 14:28:41 -08:00
Erick Tryzelaar
a727bbaf70 Revert "Removing the baked in libuv."
This reverts commit df30663fdd.
2011-11-07 21:38:33 -08:00
Erick Tryzelaar
e8519b5b2f Revert "Reimporting libuv as a submodule."
This reverts commit cbae254d8a.
2011-11-07 21:38:18 -08:00
Erick Tryzelaar
cbae254d8a Reimporting libuv as a submodule.
Closes #1152.
2011-11-07 21:34:17 -08:00
Erick Tryzelaar
df30663fdd Removing the baked in libuv. 2011-11-07 21:34:17 -08:00
Brian Anderson
8857657640 Rename rust_uv.cpp to rust_aio.cpp 2011-11-07 19:35:39 -08:00
Brian Anderson
fdeb5ba304 Upgrade libuv to f1859eb841be2fe48512bc10e64556383f408b01 2011-11-07 19:24:25 -08:00
Brian Anderson
b0c2416270 Clean up logging output. Closes #1088 2011-11-07 14:14:36 -08:00
Niko Matsakis
b578ed9b2a add required symbols 2011-11-02 14:14:20 -07:00
Niko Matsakis
0982c7f78c hastily port so we don't fail to build 2011-11-02 14:14:20 -07:00
Niko Matsakis
f1bc9307d8 get things checking on ia32 2011-11-02 14:14:19 -07:00
Niko Matsakis
f05761ddb3 enable intrinsics for multiple arch 2011-11-02 14:13:22 -07:00
Niko Matsakis
20946e6970 start going back to an i386 build 2011-11-02 14:13:22 -07:00
Niko Matsakis
8011e3fabb hack around on makefiles trying to get a 64 bit build
right now there are many temporary hacks, search for NDM to find them
2011-11-02 14:13:22 -07:00
Niko Matsakis
020cd360e1 modify x64 assembly and so forth 2011-11-02 14:13:22 -07:00
Niko Matsakis
d3e865438f do not preserve caller-saved registers 2011-11-02 14:13:22 -07:00
Niko Matsakis
6a0d86c754 copy over x86-specific code 2011-11-02 14:13:22 -07:00
Patrick Walton
587c118cac rt: Fix long lines 2011-10-31 15:50:15 -07:00
Patrick Walton
956812bda5 rt: Have __morestack conform to the calling convention that LLVM generates on x86 2011-10-31 15:41:19 -07:00
Patrick Walton
c9003d301f Stub a __morestack implementation and stack segment allocation. Untested. 2011-10-31 14:20:56 -07:00
Brian Anderson
17c651b3b0 Remove task::join_id
This is the old, racy way of joining to a task. It is no longer used.
2011-10-26 20:43:47 -07:00
Niko Matsakis
c78b1639b4 fix c-stack-cdecl when used w/ i64 2011-10-24 17:03:18 -07:00
Niko Matsakis
8f2d75d53c switch over sqrt from llvm to c-stack-cdecl, exposing a bug in
the supported return types of upcall_c_stack
2011-10-24 16:06:18 -07:00
Niko Matsakis
c81808a9f7 update intrinsics file 2011-10-24 16:06:18 -07:00
Niko Matsakis
02d7a1e781 move sys fns into c-stack-cdecl and get_type_desc() into rusti
there is one test failure, stdtest/sys.rs, which inexplicably
(thus far) fails to compile because it invokes
sys::rustrt::last_os_error() instead of invoking
sys::last_os_error().  If stdtest/sys.rs is updated to invoke
the wrapper, it passes.  Still tracing the source of this error.
2011-10-24 16:06:17 -07:00
Niko Matsakis
0598635bdc migrate leak 2011-10-24 16:06:17 -07:00
Niko Matsakis
5ddc15e42e migrate debugging funcs 2011-10-24 16:06:17 -07:00
Niko Matsakis
96629d5c21 move rand functions into c-stack-cdecl mode 2011-10-24 16:06:17 -07:00
Niko Matsakis
b13e7e0f3d move fs routines to c-stack-stdlib 2011-10-24 16:06:16 -07:00
Niko Matsakis
4880065429 rip out unused task pointers 2011-10-24 16:06:16 -07:00
Niko Matsakis
d9b23cb022 move comm functions out of rust abi 2011-10-24 16:06:16 -07:00
Austin Seipp
1703e9ec89 Fix an insane rt build error running 'make check -j3' 2011-10-23 19:04:49 -07:00
Brian Anderson
bdbeb75bfb Upgrade libuv to 179f475b2ad64729feb0422f06ce133cb364482a 2011-10-22 17:37:18 -07:00
Brian Anderson
160c56e768 Get 'make tidy' to work rustllvm and rt again 2011-10-21 17:35:52 -07:00
Brian Anderson
739b1b5b53 Cycle-collect objects 2011-10-21 17:21:59 -07:00
Niko Matsakis
67d3d9308f add get_type_desc to list of exported funcs 2011-10-21 16:19:27 -07:00
Niko Matsakis
cdf91bbf9a add get_type_desc function to library 2011-10-21 16:19:27 -07:00
Brian Anderson
7ab6315f5f Free vectors during cc sweep 2011-10-21 16:07:40 -07:00
Brian Anderson
2d713215a8 Record the internal reference count of environment boxes. Closes #981 2011-10-21 14:05:16 -07:00
Brian Anderson
034408c40a Convert DPRINT to LOG in rust_cc.cpp and add more logging 2011-10-20 18:19:06 -07:00
Marijn Haverbeke
ba1c6fcf38 Remove the last vestiges of main.ll
Closes #992
2011-10-20 17:36:28 +02:00
Marijn Haverbeke
ef63f09dcd Don't rely on main.ll anymore
I'll remove the actual file after I register a snapshot.

Issue #992
2011-10-20 17:18:38 +02:00
Marijn Haverbeke
8124846b2c Get rid of taskpointer-passing throughout the compiler
Only intrinsics still take a dummy taskptr. We'll have to do some
makefile stunts to snapshot a version without taskptrs-in-intrinsics.

Issue #466
2011-10-20 14:22:17 +02:00
Marijn Haverbeke
457683c7fe Do not pass taskpointers to "rust" native functions
Issue #466
2011-10-20 14:22:17 +02:00
Marijn Haverbeke
6323a012bd Remove taskptr argument from upcalls
Issue #466
2011-10-20 13:15:21 +02:00
Marijn Haverbeke
e927df17f7 Remove spawn_wrap and main_wrap kludges
This isn't needed now that our functions are cdecl (and was apparently
only still working by accident).

Issue #992
2011-10-20 13:15:09 +02:00
Marijn Haverbeke
243c5c3479 Use snap runtime, and the old main.o, for stage1
This is intended to be reverted again after I register the next
snapshot.
2011-10-20 13:14:28 +02:00
Patrick Walton
8d8b48a901 rt: Make C stack switching Valgrind-clean by warning Valgrind when we're about to write to the C stack from the Rust stack 2011-10-05 16:33:17 -07:00
Niko Matsakis
61c9c46d94 remove pthread_exit() from rust_start()
It was causing OS X Lion to hang and (according to Apple) is undefined
in any case
2011-10-05 16:10:36 -07:00
Patrick Walton
af60cf407c rt: Switch the AIO stuff to the C stack 2011-10-04 12:08:06 -07:00
Patrick Walton
53c9b9a5dd rt: Switch the libuv bindings over to not using explicit task pointers 2011-10-03 18:23:30 -07:00
Patrick Walton
3ad4fa00ac rt: Fix comment typo in rust_uv.cpp 2011-10-03 18:23:30 -07:00
Patrick Walton
a7b44e847a rt: Make the builtins no longer take an explicit task parameter 2011-10-03 18:23:30 -07:00
Patrick Walton
4793a02376 rt: Omit leading underscore on symbol names on Linux 2011-09-30 18:50:05 -07:00
Patrick Walton
e31849fb79 rt: Fix assembler for C calls to work more like a regular function call 2011-09-29 17:34:49 -07:00
Patrick Walton
d8a80cb31f rt: Add a call stub that switches to the C stack, untested as of yet 2011-09-28 12:26:36 -07:00
Patrick Walton
1eaaae860f rt: Add an upcall to allocate space on the C stack. This will be used for native calls on the C stack. 2011-09-28 11:31:44 -07:00
Patrick Walton
e8757ea01f rt: Expose the C stack inside the Rust scheduler so that C calls can switch to it 2011-09-28 10:22:02 -07:00
Patrick Walton
dbf472b0df rustc: Switch to cdecl for all calls. This is needed to make stack growth efficient, as I need to use eax and ecx in the function prologue and can't afford to stomp on incoming arguments. 2011-09-28 10:22:02 -07:00
Patrick Walton
9ba86178ef rt: Store the task in TLS 2011-09-27 18:12:03 -07:00
Patrick Walton
a88d9effbc rt: Don't run arbitrary destructors on cycle collection; that's just broken. 2011-09-26 17:41:22 -07:00
Patrick Walton
5c973142df rt: Turn on cycle collection at task death; add a test case 2011-09-26 16:59:15 -07:00
Patrick Walton
ad19ab4c6f rt: Make the logic that moves environments between tasks update the GC alloc chain correctly 2011-09-26 16:59:15 -07:00
Patrick Walton
81f1863de7 rt: Remove obsolete comment 2011-09-26 10:24:21 -07:00
Patrick Walton
7979bbbf51 rt: Sweep in cycle collection 2011-09-23 17:57:25 -07:00
Patrick Walton
41082c6b83 rt: Whitespace police 2011-09-23 17:57:25 -07:00
Patrick Walton
b995028c47 rt: Turn off some debug code 2011-09-23 17:57:25 -07:00
Patrick Walton
0c4e0fdfae rt: Get rid of the hack that looks for captured type descriptors adjacent to the root one for functions and objects 2011-09-23 17:57:25 -07:00
Erick Tryzelaar
5f066e06b9 Update to libuv commit 3ca382.
This patch changes libuv's gyp build system to
make it's own makefiles. To generate them for rust,
run these commands. They requires python 2.x to
work:

$ mkdir -p src/rt/libuv/build
$ svn co http://gyp.googlecode.com/svn src/rt/libuv/build/gyp
$ ./etc/src/gyp_uv
2011-09-23 16:53:06 -07:00
Patrick Walton
87700adb2f rt: Add missing <stdint.h> in rust_abi.h 2011-09-23 15:14:44 -07:00
Patrick Walton
e036c9d8d2 rt: Add missing const on the Windows path 2011-09-23 15:08:37 -07:00
Patrick Walton
557d641175 rt: Get RUST_TRACK_ORIGINS working. You can now call 'debug::dump_origin' in gdb and get a backtrace saying where a box came from. 2011-09-23 15:06:28 -07:00
Patrick Walton
aabff480c9 rt: Factor out stack walking into rust_abi.cpp 2011-09-23 12:49:20 -07:00
Patrick Walton
82935c2d17 rt: Fix message formatting issues in rust_debug 2011-09-23 12:27:13 -07:00
Patrick Walton
03f0932a6d rt: ifdef out backtrace() on Windows 2011-09-23 12:26:41 -07:00
Patrick Walton
9226ac9ec5 rt: Fix build bustage due to gcc's format string warnings 2011-09-23 12:09:52 -07:00
Patrick Walton
61afef29a1 rt: Add a RUST_TRACK_ORIGINS debug flag to help track down memory corruption 2011-09-23 11:42:20 -07:00
Patrick Walton
dbdeff659f rt: Factor out the logic that handles the various magic debug environment variables 2011-09-23 11:04:14 -07:00
Patrick Walton
f8007b5535 rt: Remove the problematic min()/max()/align()/abs() macros from isaac/standard.h, as they're unused 2011-09-23 11:04:14 -07:00
Brian Anderson
dbd2ee015a Remove is_stateful flag from tydesc. Closes #136 2011-09-22 22:15:25 -07:00
Marijn Haverbeke
aad1342e13 Fix long line 2011-09-22 09:23:07 +02:00
Marijn Haverbeke
5e3d0e304f Fix missing cast in do_cc
Apparently not needed on Mac (clang?), but breaking the win and linux boxes.
2011-09-22 09:17:26 +02:00
Patrick Walton
8c02adc630 rustc: Port the fn and obj traversal logic over from the GC branch. Doesn't actually do anything yet due to lack of support in trans. 2011-09-21 19:08:26 -07:00
Patrick Walton
ad3b9c41b4 rt: Implement cycle collection marking. Simple cycles can now be detected. 2011-09-21 18:14:23 -07:00
Brian Anderson
a993621e43 Log and compare unique boxes
Issue #409
2011-09-21 17:08:40 -07:00
Jesse Ruderman
01ea880196 Re-wrap long line 2011-09-20 19:40:47 -07:00
Patrick Walton
eafb70072a rt: Zero out allocations so that the CC won't die if it happens to run while a box is being constructed.
This is kind of unfortunate.
2011-09-20 19:15:46 -07:00
Patrick Walton
a63cc03a07 rt: Add some debug code (ifdef'd out) for diagnosing marking problems 2011-09-20 19:15:13 -07:00
Patrick Walton
ab76305cb9 rt: Skip over the reference count properly before walking the contents of the box when determining internal reference counts 2011-09-20 19:14:58 -07:00
Patrick Walton
74194df7dd rt: Remove obsolete comment 2011-09-20 19:14:18 -07:00
Patrick Walton
b39c7c4c45 rt: Increase the tolerance of the vector range sanity check 2011-09-20 19:13:45 -07:00
Patrick Walton
e27279d7db rt: Clean up debugging print statements in rust_obstack.cpp 2011-09-20 18:26:09 -07:00
Patrick Walton
be1feaa918 rt: First stab at computing internal reference counts 2011-09-20 17:49:49 -07:00
Patrick Walton
e26b1883dd rt: Stub code for the cycle collector 2011-09-20 16:49:31 -07:00
Patrick Walton
c61691110a rt: Make rust_shape.h able to be included in more contexts 2011-09-20 16:49:31 -07:00
Patrick Walton
77f0101edb rt: Add an on-the-side GC chain 2011-09-20 15:35:14 -07:00
Patrick Walton
5209b19255 rt: Rename rand() to isaac_rand() since the former prevents lots of standard headers from being included 2011-09-20 15:34:47 -07:00
Patrick Walton
307957710c rt: Remove the GC alloc chain 2011-09-20 14:20:16 -07:00
Patrick Walton
45086b7bfd rt: Remove #include "rust_box.h" 2011-09-20 14:07:10 -07:00
Patrick Walton
9a8b4a1be6 Revert "rt: Rename rust_box to rust_box_legacy, as they're about to become self-describing"
This reverts commit f6871e832c.
2011-09-20 13:57:04 -07:00
Patrick Walton
d73a8606c9 rt: Remove rust_box.h; I'm going to switch to an external map. 2011-09-20 13:55:23 -07:00
Patrick Walton
e981abdb01 rt: Remove upcall_malloc_box and upcall_free_box; I don't think they'll be necessary after all 2011-09-20 13:50:15 -07:00
Patrick Walton
3632629acc rt: Introduce a self-describing box representation and functions to create and free them 2011-09-19 11:40:41 -07:00
Brian Anderson
4028a099f5 Yield after send 2011-09-16 11:08:01 -07:00
Patrick Walton
469853d5ff rt: Add a new rust_box structure to the runtime that describes a self-describing box 2011-09-16 10:51:59 -07:00
Patrick Walton
f6871e832c rt: Rename rust_box to rust_box_legacy, as they're about to become self-describing 2011-09-16 10:51:58 -07:00
Brian Anderson
25394950ae Handle the case where a child task tries to kill a parent while it is dying
Still looks pretty racy
2011-09-16 10:05:12 -07:00
Patrick Walton
18cf4d904c rt: Add libunwind.h support on Mac OS X 2011-09-15 12:52:50 -07:00
Brian Anderson
a0ad9a42cd Unsupervise tasks before the scheduler kills them. Unblock before yield->fail 2011-09-14 17:05:35 -07:00
Brian Anderson
103197bc42 Make failure propagation to dead parents work
The failure will basically go 'through' the dead parent and continue
propagating the failure (as if the child was reparented).
2011-09-14 15:48:14 -07:00
Brian Anderson
9505d70513 Make linked task failure work again 2011-09-14 14:20:41 -07:00
Brian Anderson
22001d1dce Remove hack_allow_leaks
Happy to close the loop on this one.

Issue #236
2011-09-11 17:31:40 -07:00
Brian Anderson
0ea55ffdc8 Use a unique exit status when the runtime fails normally
Check for it in run-fail tests
2011-09-11 17:31:40 -07:00
Brian Anderson
6f6f36172b Remove unused task_exit function
Issue #236
2011-09-11 17:31:40 -07:00
Brian Anderson
9f4b4d89ce Add upcall_rust_personality
This just wraps __gxx_personality_v0 with our upcall naming convention

Issue #236
2011-09-11 17:31:38 -07:00
Marijn Haverbeke
139b1d1b31 Get rid of some unused upcalls
I guess these became obsolete when the communication stuff moved into
the stdlib.
2011-09-09 14:02:07 +02:00
Marijn Haverbeke
bd2ec03771 Remove unused logging upcalls from runtime 2011-09-09 13:55:43 +02:00
Patrick Walton
87c6416d0c rt: Don't double-print commas when logging e.g. a vec of boxes 2011-09-08 13:24:21 -07:00
Brian Anderson
c047cfb710 Unwind the stack on task failure
When a task fails, we will throw an exception, then catch it at the bottom of
the stack.

On Windows we don't do this yet because the exception doesn't propagate
correctly.

No cleanups yet.

Issue #236
2011-09-07 10:32:58 -07:00
Brian Anderson
c337fd5467 Child tasks take a ref to their parents
This is so that when a child dies after the parent, it still holds a valid
pointer and can call supervisor->kill() safely.
2011-09-07 10:32:58 -07:00
Brian Anderson
25ae3d655c Rewrite spawn yet again
The motivation here is that the bottom of each stack needs to contain a C++
try/catch block so that we can unwind. This is already the case for main, but
not spawned tasks.

Issue #236
2011-09-07 10:32:58 -07:00
Brian Anderson
bb08ffbaf4 Refactor task failure a bit
Issue #236
2011-09-07 10:32:58 -07:00
Patrick Walton
d3e8887d3c rt: Implement poison-on-free, for debugging memory issues 2011-09-06 14:15:01 -07:00
Brian Anderson
23210a3293 Remove unused runtime functions. Issue #855 2011-09-03 00:50:57 -07:00
Brian Anderson
1b67d211b4 Add a rust_str typedef to the runtime. Issue #855 2011-09-02 22:11:46 -07:00
Brian Anderson
01b254b411 Rename istr-stuff to str in the runtime. Issue #855 2011-09-02 22:11:46 -07:00
Brian Anderson
72c14d5a41 Eliminate const_refcount. Issue #855 2011-09-02 15:13:41 -07:00
Brian Anderson
99ee0fca67 Remove estrs and evecs from runtime. Issue #855 2011-09-02 15:13:41 -07:00
Patrick Walton
00470fef12 rt: Remove evecs from the shape code 2011-09-02 10:49:03 -07:00
Brian Anderson
9c173f17c0 Remove lots of estr code from rustc. Issue #855 2011-09-01 23:25:33 -07:00
Brian Anderson
f07a328c16 Convert rust_list_files to istrs. Issue #855 2011-09-01 15:51:47 -07:00
Brian Anderson
82634cd530 Convert rust_getcwd to istrs. Issue #855 2011-09-01 15:51:47 -07:00
Brian Anderson
372aa4d210 Factor out make_istr utility function in runtime. Issue #855 2011-09-01 15:51:47 -07:00
Brian Anderson
1262df652f Reduce the amount of locking in the kernel's memory region
The only thing here that really needs locking on malloc and free is
access to the allocation list, which is only used for TRACK_ALLOCATIONS.

Improves bench/task-perf-vector-party by 70%.
2011-09-01 14:20:43 -07:00
Marijn Haverbeke
458ac89894 Back out copy-glue
This wasn't a good idea after all.
2011-09-01 22:37:23 +02:00
Brian Anderson
8f531e769a Convert rust_file_is_dir from estrs to cstrs. Issue #855 2011-09-01 13:16:44 -07:00
Brian Anderson
baa1e8790d Check error code in rust_file_is_dir. Prevent comparison of uninitialized mem 2011-09-01 13:16:44 -07:00
Brian Anderson
d0c509ad1b Remove a bunch of string builtins. Issue #855 2011-09-01 12:14:33 -07:00
Patrick Walton
cc08fd1ef9 rt: Allow iteration over the dynastack 2011-09-01 11:47:59 -07:00
Patrick Walton
9d00ef9a46 rt: Make logging more resilient to null vector pointers (useful when debugging GC) 2011-09-01 11:47:58 -07:00
Patrick Walton
bbac2dd768 rt: Make debug string in rust_obstack slightly prettier 2011-09-01 11:47:58 -07:00
Patrick Walton
83ac32e8aa rt: Zero out dynamic allocas for now 2011-09-01 11:47:58 -07:00
Patrick Walton
a6c14964c8 rt: Include rust_shape.h in rust_obstack.cpp and remove the duplicate DPRINT() macro 2011-09-01 11:47:58 -07:00
Patrick Walton
156bc7f012 rt: Add a missing FIXME to rust_obstack.cpp for segmented stacks 2011-09-01 11:47:58 -07:00
Patrick Walton
876142f051 rt: Remove duplicate DPRINT() macro from rust_gc.cpp 2011-09-01 11:47:58 -07:00
Patrick Walton
60137273d2 rt: Disable debug spew in rust_shape 2011-09-01 11:47:58 -07:00
Erick Tryzelaar
b199e9da92 Expose STDERR to rust. 2011-08-31 20:40:00 -07:00
Patrick Walton
614a930c51 rt: Make the dynamic stack self-describing 2011-08-31 19:19:05 -07:00
Patrick Walton
729437d2c0 rt: Set n_params appropriately in upcall_get_type_desc 2011-08-31 18:03:12 -07:00
Patrick Walton
dc6f78561c rt: Prevent trailing commas from showing up when logging oddly aligned arrays 2011-08-31 16:22:19 -07:00
Patrick Walton
dfcbfa61f3 rt: Introduce "end_dp" bailouts in order to avoid marching past the end of oddly aligned vectors 2011-08-31 16:02:17 -07:00
Patrick Walton
143569fce4 rt: Make |align| a member of the shape glue class instead of threading it through every function 2011-08-31 15:25:32 -07:00
Brian Anderson
be2ad97a61 Allow main to take istrs. Issue #855 2011-08-30 23:57:09 -07:00
Patrick Walton
fc0212a63b rt: Override the character interpretation of u8/i8 values when logging 2011-08-30 19:34:27 -07:00
Patrick Walton
b722dc36a5 rt: Fix logging of type-parametric resources 2011-08-30 15:56:42 -07:00
Patrick Walton
05d96f155f rustc: Allow non-type-parametric resources to be logged 2011-08-30 13:50:48 -07:00
Patrick Walton
f1ed03dfa5 rt: Have data::walk_fn be defensive regarding whether the derived implementation of walk_fn moves the data pointer 2011-08-29 16:50:06 -07:00
Patrick Walton
0a4d43379e rt: Move to a custom alignof since __alignof__ returns the "preferred" alignment rather than the one that gets used in structs 2011-08-29 16:24:03 -07:00
Patrick Walton
b16a9a984a rt: Don't dereference a null pointer when traversing a function with no environment 2011-08-29 15:27:55 -07:00
Brian Anderson
3d26665e60 Rename upcall_istr_push to rust_istr_push in rustrt.def.in 2011-08-29 14:18:46 -07:00
Marijn Haverbeke
b099b1e3f7 Make std::istr::push_byte efficient
It used to allocate two (!) heap values per pushed byte. It now goes through
a runtime function that simply grows the istr and writes the byte.
2011-08-29 22:46:49 +02:00
Marijn Haverbeke
14567c5eb0 Factor vector reserve code in runtime into its own function 2011-08-29 22:35:29 +02:00
Marijn Haverbeke
c9c5ee252a Implement non-internal ivecs
Vectors are now similar to our old, pre-internal vectors, except that
they are uniquely owned, not refcounted.

Their name should probably change too, then. I've renamed them to vec
in the runtime, will do so throughout the compiler later.
2011-08-29 09:07:53 +02:00
Patrick Walton
5fe80a0d48 rt: Allow closures to be logged 2011-08-26 17:05:59 -07:00
Patrick Walton
4dd23f24d6 rt: Null check in walk_obj_contents. Prevents marking from crashing when calling object constructors. 2011-08-25 17:14:54 -07:00
Patrick Walton
8bd019bdc8 rt: Remember the number of captured type descriptors for objects in the type descriptor crate cache 2011-08-25 14:21:05 -07:00
Patrick Walton
880fd788eb rustc: Add an extra flag to object tydescs so that shapes know how to find the captured subtydescs 2011-08-25 12:01:10 -07:00
Eric Holk
2f7c583bc1 Cleaning up task and comm exports, updating all the test cases. 2011-08-25 11:21:25 -07:00
Patrick Walton
b371891c7c rt: Fix walk_obj_contents for type-parameteric objects. Hash tables can be logged now. 2011-08-24 16:54:10 -07:00
Patrick Walton
72d78e6a93 rt: Factor out type param construction into from_tydesc and from_obj_shape. (The latter is unimplemented at the moment.) 2011-08-24 15:19:59 -07:00
Patrick Walton
b07968dda4 rt: Print out fields of objects when logging them 2011-08-24 12:09:06 -07:00
Brian Anderson
a0208e3899 Return an error code after fail under win32 2011-08-24 12:03:07 -07:00
Marijn Haverbeke
fa97793139 Revert "Back out copy-glue"
This reverts commit 629ee94a0b.
2011-08-24 20:30:20 +02:00
Marijn Haverbeke
629ee94a0b Back out copy-glue
This wasn't a good idea after all.
2011-08-24 17:05:53 +02:00
Marijn Haverbeke
054914712e Remove rust_start_ivec 2011-08-24 13:59:22 +02:00
Marijn Haverbeke
e58c48bdda Optimize += [x] into a simple push operation
This is a preparation for making vectors always-on-the-heap again,
which would cause way too much malloc traffic for this idiom. I will
add an efficient std::vec::push in the future, and migrate += [x] to
that instead.

Reduces compiler code size by 3%
2011-08-24 13:57:27 +02:00
Marijn Haverbeke
cd5e4c21ee Add skeleton of copy glue that actually copies 2011-08-22 11:41:49 +02:00
Marijn Haverbeke
7588a89553 Rename copy_glue back to take_glue 2011-08-22 10:42:56 +02:00
Marijn Haverbeke
35c962e9a1 Pass structural types by pointer, not by value
If we lose tail calls, this is possible. It simplifies things a lot.

Direct motivation: We want ivecs with pointers pointing into
themselves. When copying those, the pointers have to be adjusted. It
is impossible to this when copying them with Load/Store.
2011-08-22 10:16:09 +02:00
Brian Anderson
6ad5b71ad9 Conditionally define CDECL and FASTCALL on windows
These may already be defined by other includes. Hopefully puts out the windows
fire.
2011-08-20 16:31:38 -07:00
Brian Anderson
7dad31d11c Fix comment typos 2011-08-20 16:30:27 -07:00
Brian Anderson
abdb6cd71b Rewrite reap_dead_tasks to never grab the sched lock before a task lock
Doing so contradicts the locking order used everywhere else and causes
deadlocks.

Un-XFAIL task-perf-spawnalot

Closes #854
2011-08-20 16:21:27 -07:00
Patrick Walton
25416bfae1 rustc: Introduce ABI versioning so we can change value representations without breaking the compiler 2011-08-20 14:22:09 -07:00
Patrick Walton
2f650038ad rt: Move the GetProcAddress/dlsym stuff out of rust_gc.cpp into rust_abi.h 2011-08-20 14:06:04 -07:00
Brian Anderson
4aa165553b Move bump_dp, get_dp from rust_shape.cpp to rust_shape.h
Put out the darwin fire for real
2011-08-20 10:51:31 -07:00
Brian Anderson
6751d40c60 Revert "Add another 'using namespace shape' inside namespace shape"
This reverts commit 09f4cd90a8.
2011-08-20 10:33:41 -07:00
Brian Anderson
09f4cd90a8 Add another 'using namespace shape' inside namespace shape
Try again to put out the darwin tinderbox
2011-08-20 10:28:30 -07:00
Brian Anderson
2c54b46408 Revert "Shuffle around definitions in rust_shape.h"
This reverts commit d09b421d55.
2011-08-20 10:19:45 -07:00
Brian Anderson
d09b421d55 Shuffle around definitions in rust_shape.h
Try to put out darwin tinderbox fire
2011-08-20 09:48:00 -07:00
Patrick Walton
d0171913aa rt: Remove rustboot's GC infrastructure 2011-08-19 19:17:05 -07:00
Patrick Walton
8fa86672ab rt: Implement stack crawling 2011-08-19 18:52:36 -07:00
Patrick Walton
a3f4a1b6ad rt: Split out shapes into rust_shape.cpp and rust_shape.h so that shape code can be written outside of rust_shape.cpp 2011-08-19 18:52:35 -07:00
Brian Anderson
e417e78e2b Add missing struct keyword to rust_gc 2011-08-19 18:42:33 -07:00
Patrick Walton
907ab4a11b rt: Find roots on the stack; stub mark and sweep routines 2011-08-19 17:42:58 -07:00
Patrick Walton
d1836034e2 rt: Attempt to put out burning tinderbox by fully qualifying gc::gc(). 2011-08-19 15:21:48 -07:00
Patrick Walton
cede5e53b3 rt: Call maybe_gc on mallocs 2011-08-19 14:30:01 -07:00
Patrick Walton
4d03b7b1fb rt: Remove "TODO: Windows" 2011-08-18 18:52:11 -07:00
Patrick Walton
9c2abb8253 rt: Fix the calculation of the location of GC safe points 2011-08-18 18:51:49 -07:00
Patrick Walton
396f6b4f59 rustc: Stub GC routines 2011-08-18 18:48:32 -07:00
Patrick Walton
0fedea39ce rt: Remove rust_alarm dead code 2011-08-18 18:21:03 -07:00
Michael Sullivan
ddc2076902 Make windows respect RUST_SEED. Closes #627. 2011-08-18 16:24:36 -07:00
Michael Sullivan
eb368d1b34 Remove rc_base. Closes #603. 2011-08-18 15:49:58 -07:00
Brian Anderson
223f6017c7 Remove rust_intrinsic_vec_len
I just edited the ll by hand since I don't have clang on hand
2011-08-18 14:51:07 -07:00
Brian Anderson
0467fa6a00 Rename rust_vec to rust_evec 2011-08-18 14:43:17 -07:00
Brian Anderson
504ec8b00d Rename some vec upcalls and trans functions from vec* to evec* 2011-08-18 13:09:50 -07:00
Brian Anderson
7903daf86f Remove upcall_new_vec 2011-08-18 13:09:50 -07:00
Brian Anderson
250cc45c3b Remove oldvecs from runtime command line processing 2011-08-18 13:09:49 -07:00
Brian Anderson
0a8bffceb3 Simplify the _rust_main/rust_start interface
rust_start will always call _rust_main with the command line args, and it is
_rust_main's responsibility to free the args ivec heap. _rust_main will be
generated slightly differently depending on whether main takes an ivec or not:
if so then it's just passed through to main, otherwise it frees the ivec
directly.
2011-08-18 13:09:49 -07:00
Brian Anderson
c2d8a4df35 Continue transition to an ivec-only main
Only generate a single main function. Rename rust_start_ivec to rust_start,
leaving a transitional rust_start_ivec in place.
2011-08-18 13:09:49 -07:00
Patrick Walton
f17edf9829 rustc: Use obstacks in lieu of dynamically-allocated frames only when the frame is actually dynamically-sized 2011-08-17 18:14:57 -07:00
Patrick Walton
df51fe36f1 Revert "rt: Use obstacks in lieu of dynamically-sized frames"
This reverts commit cc5fcfce89.
2011-08-17 17:27:31 -07:00
Patrick Walton
cc5fcfce89 rt: Use obstacks in lieu of dynamically-sized frames 2011-08-17 17:24:57 -07:00
Eric Holk
ae89ea223d Making more of the rust_task structure directly accessible from Rust. 2011-08-17 14:42:40 -07:00
Eric Holk
efac7c9a19 Yet another comm interface. 2011-08-17 14:42:40 -07:00
Patrick Walton
702fe5cdac rustc: Run obstack cleanups at the end of each function 2011-08-17 13:58:49 -07:00