Commit graph

883 commits

Author SHA1 Message Date
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
Patrick Walton
3aab46b020 rustc: Mark an obstack fencepost when entering a dynamically-sized frame 2011-08-17 13:16:15 -07:00
Patrick Walton
d8c5bd6195 rt: Implement obstacks, untested as of yet 2011-08-16 19:49:25 -07:00
Eric Holk
8686645aad New channel-based task status notifications. 2011-08-16 16:47:40 -07:00
Eric Holk
3db300b06e Removing port, chan and task shapes. 2011-08-16 12:30:32 -07:00
Eric Holk
89df915a13 Removing task, chan and port upcalls. 2011-08-16 11:22:24 -07:00
Brian Anderson
053b8bff5a Accept main(args: [str]) as main signature 2011-08-16 10:29:08 -07:00
Eric Holk
76aab80e39 Disabling TRACK_ALLOCATIONS 2011-08-16 10:28:09 -07:00
Eric Holk
cf2def46c1 Removed trans_comm.rs from the compiler. Updating aio/sio to work with the new chan and port system, started on a networking module for the standard library. 2011-08-16 09:36:29 -07:00
Brian Anderson
977d8ba0e9 Abort abruptly on failure on windows
Trying to shutdown cleanly results in wierd failures
2011-08-15 19:25:47 -07:00
Eric Holk
5c6790519b Reducing the chances for race conditions in join. 2011-08-15 12:39:55 -07:00
Eric Holk
3fd3f35699 Fixing win32 build. 2011-08-15 10:48:04 -07:00
Eric Holk
d63f8340a5 Properly ref counting to fix valgrind issues on linux. 2011-08-15 09:26:52 -07:00
Eric Holk
be7325073a Removed spawn and task from the parser. Updated all the tests except for the benchmarks. 2011-08-15 09:26:52 -07:00
Eric Holk
b9f1f77622 Fixed memory accounting and task stack creation bugs. 2011-08-15 09:26:51 -07:00
Eric Holk
2f23405a60 Working on more spawn test cases. 2011-08-15 09:26:51 -07:00
Eric Holk
a332043561 Updating to build on Linux and Mac, and hopefully Windows too. 2011-08-15 09:26:51 -07:00
Eric Holk
b2dad8af31 Added a library version of spawn. Before long, we can remove the old version. 2011-08-15 09:26:51 -07:00
Eric Holk
39b16077bb Port ID-based channels. 2011-08-15 09:26:51 -07:00
Eric Holk
04af99ecb0 First step towards port handles. 2011-08-15 09:26:51 -07:00
Brian Anderson
4fc0848a49 Rename rust_list_files_ivec to rust_list_files 2011-08-12 12:14:07 -07:00
Brian Anderson
8561f7654c Remove rust_list_files from std and rt 2011-08-12 12:14:07 -07:00
Brian Anderson
d1b3ed8c3f Remove runtime vector builtins 2011-08-12 12:14:07 -07:00
Brian Anderson
878fbac278 Remove str_from_vec runtime function 2011-08-12 12:08:27 -07:00
Brian Anderson
2e7e58812b Remove vec version of str::bytes, rename bytes_ivec to str::bytes 2011-08-12 12:08:26 -07:00
Patrick Walton
ba7c8f18d4 rustc: Remove unused "trace" upcalls 2011-08-10 18:09:52 -07:00
Patrick Walton
347230b001 rt: Add the last few cases to polymorphic log 2011-08-10 15:45:32 -07:00
Patrick Walton
955ac84da4 rt: Step over type params properly in glue 2011-08-10 15:39:05 -07:00
Patrick Walton
15e1e3185d rt: Allow records and boxes to be logged 2011-08-10 15:36:37 -07:00
Patrick Walton
6affa3264b rt: Allow tags to be logged 2011-08-10 14:57:02 -07:00
Patrick Walton
f5c8c85196 rt: Implement logging of vectors 2011-08-10 14:42:06 -07:00
Patrick Walton
dc720c3aba rt: Implement polymorphic log on strings 2011-08-10 14:35:12 -07:00
Patrick Walton
adce35acd4 rustc: Use polymorphic logging 2011-08-10 14:35:12 -07:00
Brian Anderson
0cd607bcbd rt: Shutdown gracefully on failure
When the kernel fails, kill all tasks and wait for the schedulers to stop
instead of just exiting. I'm sure there are tons of lurking issues here but
this is enough to fail without leaking (at least in the absence of cleanups).
2011-08-10 13:02:31 -07:00
Patrick Walton
f6ad051408 rt: Use _LP64 instead of SIZE_MAX and UINT64_MAX to try to put out the burning tinderbox 2011-08-10 10:55:41 -07:00
Patrick Walton
ceaf02abe1 rt: Attempt to quiet MinGW by including limits.h 2011-08-10 05:17:30 -07:00
Patrick Walton
6fbb7ffdbd rt: Stub code for polymorphic log 2011-08-09 19:01:15 -07:00
Patrick Walton
1f8e0fa083 rt: Implement comparison of functions, objects, ports, channels, and tasks 2011-08-09 17:02:17 -07:00
Patrick Walton
ade998d743 rt: Don't walk vars twice. We self-host with compare glue now. 2011-08-09 17:02:17 -07:00
Patrick Walton
1e1125fcbe rt: Initialize "result" in all constructors for cmp 2011-08-09 17:02:17 -07:00
Patrick Walton
e5533a5d5e rt: Compare exterior vectors 2011-08-09 12:49:52 -07:00
Patrick Walton
b83167cf91 rt: Make comparison through type vars work 2011-08-09 12:19:40 -07:00
Patrick Walton
f9363f01a1 rt: Fix comparison of interior vectors 2011-08-09 12:19:40 -07:00
Patrick Walton
f7749b1608 rt: Add code to walk over interior vectors, untested as of yet 2011-08-08 19:16:33 -07:00
Patrick Walton
7d7f62613a rt: Compare tags 2011-08-08 18:29:20 -07:00
Patrick Walton
e5531504c9 rt: Align when comparing the insides of boxes 2011-08-08 17:30:21 -07:00
Patrick Walton
0459e38bde rt: Align mallocs to 16 byte boundaries 2011-08-08 17:30:21 -07:00
Eric Holk
42b13c1db3 Disabling TRACK_ALLOCATIONS 2011-08-08 17:12:44 -07:00
unknown
44bef5f2cb Introduced task handles.
This is the new way to refer to tasks in rust-land. Currently all they
do is serve as a key to look up the old rust_task structure. Ideally
they won't be ref counted, but baby steps.
2011-08-08 16:55:38 -07:00
Patrick Walton
f4f057ced1 rt: Compare the insides of boxes 2011-08-08 16:52:11 -07:00
Patrick Walton
42daeab7df rt: "const foo const &" == "const foo &", duh. Puts out burning tinderbox. 2011-08-08 14:55:35 -07:00
Patrick Walton
eb7e9dce4d rt: Stub the shape-based cmp upcall 2011-08-08 14:33:06 -07:00
Eric Holk
d9b84a546c Converted the rest of the task-comm-* tests over. Also fixed some
channel lifecycle bugs.
2011-08-08 08:57:52 -07:00
Patrick Walton
0aeddb3673 rt: Stub compare glue 2011-08-05 18:47:12 -07:00
Patrick Walton
d7828e694d rt: Uncomment data<T> 2011-08-05 17:50:59 -07:00
Eric Holk
50670eb426 Removing trailing whitespace in rust_shape.cpp 2011-08-05 17:08:22 -07:00
Patrick Walton
5261bd771f rt: Simplify the signature of walk_tag; stub code for the data walker 2011-08-05 16:47:43 -07:00
Brian Anderson
f918418953 Fix a type in the libuv mingw makefile 2011-08-05 15:48:19 -07:00
Eric Holk
b62e80c1f0 Atomic ref counting for chans. 2011-08-05 15:27:28 -07:00
Eric Holk
200bbcf91b Rewrote receive to return a value. This lets us initialize variables by receiving them. 2011-08-05 15:27:27 -07:00
Graydon Hoare
7da64ae461 Munge libuv makefiles sufficiently to build out of tree. 2011-08-05 11:57:07 -07:00
Brian Anderson
f6d5c56f21 Tweak libuv makefiles so they pick up custom CFLAGS 2011-08-05 11:57:07 -07:00
Brian Anderson
e653520a6f Fix uv_buf_t declaration on win32
The fields of this structure are mysteriously defined in the opposite order
on windows as on unix
2011-08-05 11:57:06 -07:00
Rob Arnold
a4951cab7f Add libuv Makefile 2011-08-05 11:57:06 -07:00
Rob Arnold
8229c3fa75 Update libuv to revision ee599ec1141cc48f895de1f9d148033babdf9c2a 2011-08-05 11:57:06 -07:00
Rob Arnold
f4b87c749f Basic async IO module using libuv 2011-08-05 11:57:06 -07:00
Rob Arnold
b64a52df42 Integrate libuv into the build system 2011-08-05 11:57:06 -07:00
Rob Arnold
904f443fa9 Drop in libuv rev 2b5707d834a6b85b8e589ac04cb61a6db2dab94b 2011-08-05 11:57:06 -07:00
Rob Arnold
b6be83885f Log tags in memory_region::{free,realloc}
Make this useful and consistent with the destructor.
2011-08-05 11:57:06 -07:00
Patrick Walton
6bb6922c28 rt: Change int to uint32_t. Put out burning tinderbox. 2011-08-04 09:50:11 -07:00
Patrick Walton
e351ad762d rt: Stub shape glue and implement shape::print and shape::size_of. 2011-08-03 20:25:44 -07:00
Erick Tryzelaar
a8943f3442 timeout_in_ns was renamed to timeout_in_ms. 2011-08-03 19:28:49 -07:00
Eric Holk
7a2e9f4874 Sleep for a nonzero amount of time on Windows. 2011-08-03 18:21:19 -07:00
Brian Anderson
2298a2b29f Whitespace cleanup 2011-08-03 16:25:38 -07:00
Brian Anderson
4ae6c835cb Add some hacks to get stdin piping working more correctly in windows
The way pipes work in windows is not the same as unix, though I'm not
entirely clear on the differences. This patch changes the windows pipe
method to return non-inheritable fds, and the windows rust_run_program
method to duplicate them before spawning the new process.

This allows make-check-pretty to work on windows.
2011-08-03 15:09:00 -07:00
Eric Holk
286be2d94e Adding an intrinsic for recv. 2011-08-01 18:43:05 -07:00
Eric Holk
939bca0d84 Added send and receive to comm library. 2011-08-01 15:58:39 -07:00
Eric Holk
6a6d5c669e Enabling logging in circular_buffer again. 2011-08-01 15:58:39 -07:00
Eric Holk
b3d9d9b73c Objectified library chans and ports. 2011-08-01 15:58:30 -07:00
Eric Holk
5a673cc2c9 Started working on a library-based comm system. Creating and deleting ports work. 2011-08-01 15:58:30 -07:00
Brian Anderson
7b87fa3683 Replace a lock/unlock with scoped_lock in rust_scheduler::create_task 2011-08-01 11:01:59 -07:00
Brian Anderson
d552a0b959 Minimize scheduler locking on task creation
This takes my CPU utilization on task-perf-spawnalot from 35% to 55%
2011-07-29 23:02:51 -07:00
Brian Anderson
6657e729de Lock the new task's scheduler when creating a task
Previously we were locking the spawning task's scheduler. I couldn't
see that that was protecting anything. The newborn_task list in the new task's
scheduler though was unprotected from concurrent access. So now we're locking
the new task's scheduler.
2011-07-29 22:43:11 -07:00
Brian Anderson
9dbe6941c4 Add sched_threads rt function to get the number of scheduler threads 2011-07-29 21:03:17 -07:00
Eric Holk
d1dbb99984 Removing proxies and message queues. 2011-07-29 18:54:59 -07:00
robarnold
bdf2daee1e Merge pull request #781 from robarnold/upstream-stable
More useful leak debugging output.
2011-07-29 09:13:20 -07:00
Brian Anderson
3dd522b6b7 Add an assertion about the lock in rust_chan::disassociate 2011-07-28 16:04:49 -07:00
Brian Anderson
73812cd3de Turn off TRACK_ALLOCATIONS 2011-07-28 14:52:50 -07:00
Brian Anderson
4b356097c2 Change the locking rules around channel disassociation again
This prevents port's destructor from accessing a deleted channel
2011-07-28 14:25:20 -07:00
Brian Anderson
5c0fd045ce Fiddle with the locking around channel disassociation
This still looks a bit sketchy to me (why isn't there locking in
port::destroy?) but this manages to get rid of a problem with channels
accessing their task after it's NULL.
2011-07-28 12:53:44 -07:00
Brian Anderson
b54eb0480d No strnlen on mac 2011-07-28 12:53:14 -07:00
Brian Anderson
0fcd72c932 When using the allow leaks hack don't even print a warning about the leak
This is only used for the test runner and in that case it just makes the test
output confusing
2011-07-28 12:23:01 -07:00
Brian Anderson
4ef1ec580a Do all runtime calls to getenv at initialization
getenv is not threadsafe and (maybe as a result) it's randomly crashing with
CFLAGS=-g and RUST_THREADS=32. Calls from rust code are still on their
own.
2011-07-28 12:23:01 -07:00
Brian Anderson
75985ab75e Remove color-related code from rust_log
This is all dead. If someone decides they want color it will be easy to redo.
2011-07-28 12:23:00 -07:00
Eric Holk
3d7016ae95 Updating to work on Windows. 2011-07-28 10:47:29 -07:00
Eric Holk
9618ab67ae Re-enabled the rest of the asserts and things in rust_chan.cpp 2011-07-28 10:47:29 -07:00
Eric Holk
b85dee8d5b Resurrecting some of the logging in rust_chan.cpp 2011-07-28 10:47:28 -07:00
Eric Holk
9ea8476faa Removed outdated comment. 2011-07-28 10:47:28 -07:00
Eric Holk
279844ce9f Atomic reference counting for tasks. 2011-07-28 10:47:28 -07:00
Eric Holk
a5fe66e706 Adding upcalls to to ref() and deref() tasks. This is the first step towards atomic reference counting of tasks. 2011-07-28 10:47:28 -07:00
Eric Holk
5302cde188 Made task threads wait instead of sleep, so they can be woken up. This appears to give us much better parallel performance.
Also, commented out one more unsafe log and updated rust_kernel.cpp to compile under g++
2011-07-28 10:47:28 -07:00
Eric Holk
e697a52359 Adding a function to stdlib to set the min stack size, for programs
that absolutely will not succeed with a large default stack. This
should be removed once we have stack grown working.

Also updated word-count to succeed under the new test framework.
2011-07-28 10:47:28 -07:00
Eric Holk
62bc6b5113 Per-thread scheduling. Closes #682.
Tasks are spawned on a random thread. Currently they stay there, but
we should add task migration and load balancing in the future. This
should drammatically improve our task performance benchmarks.
2011-07-28 10:47:28 -07:00
Eric Holk
b51f5c395c Made root_task no longer special. 2011-07-28 10:47:28 -07:00
Rob Arnold
f45ac8db07 More useful leak debugging output.
When printing out leaked allocations, print the allocation tag and address of
the returned pointer.
2011-07-28 08:28:32 -07:00
Marijn Haverbeke
73e8e49897 More thorough check for interior-ness in str_from_ivec
Closes #750
2011-07-27 21:46:14 +02:00
Brian Anderson
49a98f1508 Base scheduler threads on number of cores. Closes #739 2011-07-26 11:12:20 -07:00
Graydon Hoare
42e57f64b7 remove datalayout from the intrinsics.ll.in file, silence linkage warning. 2011-07-25 11:50:09 -07:00
Eric Holk
57459ec8ae Fixed another concurrency issue in channels. 2011-07-23 12:21:23 -07:00
Eric Holk
8878b128ba More work on word-count.
Updated the MapReduce protocol so that it's correct more often. It's
still not perfect, but the bugs repro less often now.

Also found a race condition in channel sending. The problem is that
send and receive both need to refer to the _unread field in
circular_buffer. For now I just grabbed the port lock to send. We can
probably get around this by using atomics instead.
2011-07-22 18:45:34 -07:00
Eric Holk
75ee817713 Fixing a use of uninitialized memory error in valgrind. 2011-07-22 16:05:51 -07:00
Michael Sullivan
f33309502a Bump the stack size and make the RUST_MIN_STACK env variable accept hex values. 2011-07-21 14:05:51 -07:00
Eric Holk
d79afd7916 Improving move semantics for channel operations.
This lets us un-XFAIL task-comm-10.rs.
2011-07-21 11:51:22 -07:00
Eric Holk
3ae4dcd41e Lots of work on memory tracking and channels.
We're trying to get closer to doing correct move semantics for channel
operations. This involves a lot of cleanup (such as removing the
unused sched parameter from rust_vec constructor) and making
circular_buffer kernel_owned.

Added tagging for memory allocations. This means we give a string tag
to everything we allocate. If we leak something and TRACK_ALLOCATIONS
is enabled, then it's much easier now to tell exactly what is leaking.
2011-07-21 11:51:22 -07:00
Brian Anderson
a467e8e4e6 Add a huge hack to allow the test runner to continue if a single task leaks
This is just until unwinding works. Adds a flag to the runtime to turn
the memory leak checks on task destruction into warnings instead of fatal
errors. I am so sorry.

Issue #428
2011-07-20 10:22:18 -07:00
Brian Anderson
652214d7f9 Fix calculation of sizeof boxed ivec of str in rt. Closes #712 2011-07-19 16:55:45 -07:00
Brian Anderson
20a3adbc08 Revert "Add setenv to standard library"
This reverts commit 6fb168b3db.
2011-07-17 19:16:18 -07:00
Brian Anderson
6fb168b3db Add setenv to standard library 2011-07-17 18:50:01 -07:00
Patrick Walton
88574c3cea rustc: Implement interior string logging in DPS 2011-07-15 18:37:57 -07:00
Brian Anderson
7d475530a0 Remove task_unsupervise from rt builtin functions
This was an exact duplicate of the unsupervise function
2011-07-15 10:07:32 -07:00
Brian Anderson
ced8393f20 Modify task::join to indicate how the task terminated
This involves sticking yet another field into the task structure
2011-07-15 10:07:29 -07:00
Brian Anderson
f634ab45bc Add task_unsupervise to rustrt.def.in 2011-07-14 19:14:36 -07:00
Brian Anderson
c99e110119 Modify upcall_fail so that failing tasks relinquish control to the scheduler
This is sufficient to let unsupervised tasks that don't allocate fail without
crashing or leaking.
2011-07-14 18:49:18 -07:00
Brian Anderson
01a52d728c Add an unsupervise builtin and function to std::task
Calling task::unsupervise de-parents the current task, with the result
that failures do not propogate up the task tree.
2011-07-14 17:56:59 -07:00
Brian Anderson
4738cf83b0 Move the responsibility for process failure from tasks to the scheduler
When the root task fails the process fails. Failures on other tasks propagate
up the task tree. Failures on non-root tasks without parents just
(theoretically) unwind and disappear.
2011-07-14 17:44:39 -07:00
Graydon Hoare
39151f2ad8 Prohibit trailing whitespace under 'tidy' script. Clean up all caught cases. 2011-07-13 15:44:09 -07:00
Graydon Hoare
d39f84d8ec Trim a few more fail(1)s, not sure how they slipped past. 2011-07-13 14:04:38 -07:00
Graydon Hoare
336a4df778 Remove 'Nop.' comments, add emacs lines, remove obsolete file. 2011-07-13 14:03:18 -07:00
Graydon Hoare
49116adbe9 Fix compile-command lines in rt. 2011-07-13 13:51:20 -07:00
Graydon Hoare
2e2951305d Remove obsolete nargs counts from runtime. 2011-07-13 13:43:35 -07:00
Graydon Hoare
01fc165517 Attempt to correct buggy win32 timer code (causing tinderbox failures). 2011-07-13 12:25:36 -07:00
Patrick Walton
598b50e10a stdlib: Move fs over to interior vectors by introducing a rust_list_files_ivec builtin 2011-07-12 15:14:57 -07:00
Patrick Walton
a9b77a5011 rt: Remove the locks around upcall_shared_malloc and upcall_shared_free 2011-07-12 11:53:45 -07:00
Patrick Walton
eef61a527d stdlib: Add addr_of() to the standard library 2011-07-11 14:25:35 -07:00
Patrick Walton
7efb942639 rt: Remove the now-unused upcall_ivec_resize and upcall_ivec_spill, which allocated from the wrong heap 2011-07-10 01:30:45 -07:00
Patrick Walton
d30f22eb65 rt: Remove the _2 prefix from intrinsics; all rust-intrinsics now use explicit return pointers 2011-07-10 01:20:18 -07:00
Patrick Walton
f42c94740a rustc: Make rust-intrinsics take an explicit return pointer 2011-07-09 21:13:25 -07:00
Patrick Walton
e823ca4965 stdlib: Implement casts. The horror. 2011-07-09 20:14:47 -07:00
Patrick Walton
91d45b91e6 stdlib: Implement str::unsafe_from_bytes_ivec() 2011-07-08 22:23:11 -07:00
Patrick Walton
aa0f6f4961 stdlib: Add an offset function for simple pointer arithmetic on unsafe pointers 2011-07-08 21:56:15 -07:00
Eric Holk
d7db25e8f6 Added an environment variable to override the minimum stack size. Closes #637. 2011-07-08 11:36:56 -07:00
Eric Holk
3958c72cd8 Some cleanup 2011-07-07 18:32:45 -07:00
Eric Holk
4739953b84 Fixed two races.
The first is that the memory_region destructor would complain there is
still an outstanding allocation. This is because circular_buffer from
rust_chan wasn't refing its task, so the task was being destructed too
soon.

The second was where the program could deadlock while joining a
task. The target task would die in the time between checking whether
the task should block and then actually blocking. The fix is to use
the target task's lock.
2011-07-07 18:22:27 -07:00
Eric Holk
f6e37f659c Made TRACK_ALLOCATIONS add only constant time overhead. This makes it
feasible to turn it on and run rustc.
2011-07-07 18:22:27 -07:00