Commit Graph

1430 Commits

Author SHA1 Message Date
Brian Anderson
70ecfa686a rt: Fix build errors on win 2012-05-30 21:23:34 -07:00
Brian Anderson
3f8223ffc2 rt: Fix vec_from_buf_shared for new vecs 2012-05-30 21:23:34 -07:00
Brian Anderson
ecd4318094 rt: Fix rust_list_files for new vecs 2012-05-30 21:23:34 -07:00
Brian Anderson
09a1b94907 Various changes for self-describing vecs 2012-05-30 21:23:34 -07:00
Brian Anderson
178c5cc4a3 rt: Add yet another allocating upcall
upcall_exchange_malloc_dyn, for allocating unique boxes for types that don't
have a fixed size.
2012-05-30 21:23:34 -07:00
Brian Anderson
654f7e3086 rustc: Make unique boxes self-describing 2012-05-30 21:23:34 -07:00
Brian Anderson
508ccca014 rt: Add upcall_exchange_malloc/free 2012-05-30 21:23:33 -07:00
Eric Holk
6fa1a084f7 A shareable atomically reference counted pointer wrapper.
Needs more tests to ensure safety, and probably some more work on usability too.
2012-05-23 14:58:16 -07:00
Jeff Olson
6c6a47bf22 std: splitting out tcp server API + tests
- we now have two interfaces for the TCP/IP server/listener workflow,
based on different user approaches surrounding how to deal with the
flow of accept a new tcp connection:

1. the "original" API closely mimics the low-level libuv API, in that we
have an on_connect_cb that the user provides *that is ran on the libuv
thread*. In this callback, the user can accept() a connection, turning it
into a tcp_socket.. of course, before accepting, they have the option
of passing it to a new task, provided they *make the cb block until
the accept is done* .. this is because, in libuv, you have to do the
uv_accept call in the span of that on_connect_cb callback that gets fired
when a new connection comes in. thems the breaks..

I wanted to just get rid of this API, because the general proposition of
users always running code on the libuv thread sounds like an invitation
for many future headaches. the API restriction to have to choose to
immediately accept a connection (and allow the user to block libuv as
needed) isn't too bad for power users who could conceive of circumstances
where they would drop an incoming TCP connection and know what they're
doing, in general.

but as a general API, I thought this was a bit cumbersome, so I ended up
devising..

2. an API that is initiated with a call to `net::tcp::new_listener()` ..
has a similar signature to `net::tcp::listen()`, except that is just
returns an object that sort of behaves like a `comm::port`. Users can
block on the `tcp_conn_port` to receive new connections, either in the
current task or in a new task, depending on which API route they take
(`net::tcp::conn_recv` or `net::tcp::conn_recv_spawn` respectively).. there
is also a `net::tcp::conn_peek` function that will do a peek on the
underlying port to see if there are pending connections.

The main difference, with this API, is that the low-level libuv glue is
going to *accept every connection attempt*, along with the overhead that
that brings. But, this is a much more hassle-free API for 95% of use
cases and will probably be the one that most users will want to reach for.
2012-05-22 22:29:17 -07:00
Jeff Olson
e9c6416df6 std: splitting out tcp server API WIP 2012-05-22 22:29:17 -07:00
Jeff Olson
8769409612 rt: adding rust_uv_* binding for kernel malloc and free'ing :/
I need these in the context of doing various malloc/free operations for
libuv structs that need to live in the heap, because of API workflow
(there's no stack to put them in). This has cropped up several times
when impl'ing the high-level API for things like timers, but I've decided
to take the plunge and use this approach for the net::tcp module.

Technically, this can be avoided by spawning a new
task that contains the needed memory structures on its stack and then
having it block for the duration of the time we need that memory to be
valid (this is what I did in std::timer). Exposing this API provides a
much lower overhead way to address
the issue, albeit with safety concerns. The main mitigation policy should
be to use malloc/free with libuv handles only when the handles, are then
associated with a resource or class-with-dtor. So we have a finite lifetime
for the object and can gaurantee a free(), barring a runtime crash (in
which case you have bigger problems!)
2012-05-22 22:29:16 -07:00
Brian Anderson
17dd5650f8 rt: Fix def of isaac_seed on windows 2012-05-21 17:42:32 -07:00
Gareth Daniel Smith
c9f8ae02bc add a seeded random number generator so that sequences of random numbers can be easily reproduced (for https://github.com/mozilla/rust/issues/2379) 2012-05-21 17:38:05 -07:00
Erick Tryzelaar
e7ca3e4db0 expose tzset 2012-05-19 10:08:43 -07:00
Niko Matsakis
f1a46914c4 add a new debugging aid--tracing 2012-05-18 19:07:19 -07:00
Brian Anderson
5d625af9f9 rt: Make task killing synchronization possibly more correct
I could not come up with a test but this looks better to me.
2012-05-15 16:13:42 -07:00
Brian Anderson
7277cd7198 core: Add task::unkillable 2012-05-15 16:13:42 -07:00
Niko Matsakis
adb61e3e99 get preservation of boxes working, at least in simple cases 2012-05-15 13:38:16 -07:00
Niko Matsakis
be48cd87dc make poison-on-free work, disable copying if borrowck is enabled 2012-05-15 11:49:08 -07:00
Brian Anderson
f717100fc7 rt: Start tasks, ports and scheds at 1, assert when we see 0. Closes #2321 2012-05-07 14:32:36 -07:00
Brian Anderson
beb1a59f82 core: Add comm::recv_chan to receive from a channel 2012-05-03 16:38:16 -07:00
Graydon Hoare
6e5c8a7fb8 More shape fixes for evecs. 2012-05-03 14:11:54 -07:00
Graydon Hoare
11a5d10bf2 Implement better shape code for evec, estr. 2012-05-03 13:09:02 -07:00
Brian Anderson
1e410f6206 rt: Fix some record alignment issues on windows 2012-05-02 18:32:20 -07:00
Brian Anderson
e2910bf264 Revert "rt: Fix some record alignment issues on windows"
This reverts commit a2457f5864.
2012-05-02 18:25:22 -07:00
Brian Anderson
a2457f5864 rt: Fix some record alignment issues on windows 2012-05-02 17:55:58 -07:00
Graydon Hoare
f32d9f4853 Remove unused sp_size arg passed through walk_vec{1,2} in shape code. 2012-05-02 14:36:04 -07:00
Graydon Hoare
dc6c3a8946 Make rust_shape.h agree with shape.rs about meaning of shape code #31. 2012-05-02 14:36:04 -07:00
Brian Anderson
46cc11ea88 core: Serialize all access to the environment using a weak global task 2012-04-30 17:34:29 -07:00
Jeff Olson
caab57586a rt/std: whitespace cleanup + work on hl/global_loop docs 2012-04-27 22:19:30 -07:00
Jeff Olson
577b888e4b rt: remove unneccesary c++ functions and rust_kernel data, re: global loop 2012-04-27 22:19:30 -07:00
Jeff Olson
fbaba0f404 std: add ll::loop_refcount binding for uv_loop_refcount 2012-04-27 22:19:30 -07:00
Brian Anderson
bbc4a74dc6 rt: Fix shape alignment of 64-bit ints on x86. Issue #2303 2012-04-26 18:30:58 -07:00
Jeff Olson
a9db0c9efe whitespace cleanup 2012-04-20 15:23:23 -07:00
Jeff Olson
a045e63639 std: get_monitor_task_gl() is global_loop::get() default 2012-04-20 15:23:23 -07:00
Jeff Olson
bea02ee351 adding missing binding to rustrt.def.in 2012-04-20 15:23:22 -07:00
Jeff Olson
253fad7788 replace impl of globa_async_handle with one using atomic compare-and-swap 2012-04-20 15:23:22 -07:00
Jeff Olson
d7a87aa0a1 remove rustrt.def.in entry for no-longer-existent c++ function 2012-04-20 15:23:22 -07:00
Jeff Olson
9a5d1974dc don't use ::malloc for initializing the global_async_handle in rust_kernel 2012-04-20 15:23:22 -07:00
Jeff Olson
e0f110aa12 clean and trying the global loop test as two separate loop lifetimes..
.. seeing an occasional valgrind/barf spew on some invalid read/writes..
need to investigate further.. i think its related to my poor citizen
conduct, re: pointers stashed in rust_kernel..
2012-04-20 15:23:22 -07:00
Jeff Olson
12f2f4c15c rt: whitespace cleanup for existing libuv integration 2012-04-20 15:23:22 -07:00
Jeff Olson
e604c15df1 bindings to get/set data field on uv_loop_t* and debug log cleanup 2012-04-20 15:23:21 -07:00
Jeff Olson
c6667c06c3 add needed fields for global libuv loop + bindings to manage from rust
adding two pointers fields to rust_kernel :(
.. have to do manual malloc/free for one of the fields, which feels wrong
2012-04-20 15:23:21 -07:00
Jeff Olson
bf99a3aa93 adding low-level uv_timer_* stuff to libuv bindings 2012-04-20 15:23:21 -07:00
Jeff Olson
3d004c6df8 making brson's req. cleanups in #2134 plus change printf to LOG in c++ 2012-04-20 15:23:21 -07:00
Brian Anderson
53f5c0c623 rt: Delete some incorrect comments 2012-04-20 14:00:13 -07:00
Brian Anderson
4357e1fd60 rt: Take the weak_task_lock in end_weak_tasks
Don't remember why it's commented out. Probably an oversight.
2012-04-20 13:59:31 -07:00
Niko Matsakis
171c89f4c5 Fix for #1989, #1469: when marking in CC, walk fn@ box like other boxes 2012-04-19 20:34:26 -07:00
Niko Matsakis
21f74be2c1 add a new runtime log (::rt::box) and make boxed_region use it 2012-04-19 20:34:26 -07:00
Brian Anderson
9604544e23 rt: Don't log in the stack switching failure path
The runtime is in an uncertain state here and, instead of thinking
about how to make the logger work correctly, let's just avoid it.

Currently, it ends up hitting an assert saying that we can't log on
the rust stack.
2012-04-18 18:45:24 -07:00
Graydon Hoare
82727b926f Get explicit unique estrs working. 2012-04-16 16:17:51 -07:00
Brian Anderson
564d8e09c7 rt: Fix typo 2012-04-09 16:26:23 -07:00
Brian Anderson
596376ea55 rt: Allow 2x normal stack during unwinding. Closes #2173
Allows room for destructors to run without allowing the stack to grow forever.
2012-04-09 16:03:06 -07:00
Brian Anderson
b42c6d07dc rt: Don't limit the amount of stack available during unwinding. Closes #2144 2012-04-09 15:36:45 -07:00
Brian Anderson
01dc4a8b26 core: Add priv::weaken_task 2012-04-07 19:56:41 -07:00
Brian Anderson
63942c969d core: Add priv::chan_from_global_ptr
This allows singleton, globally accessible tasks to be created
2012-04-06 17:44:26 -07:00
Jeff Olson
82f8d8cb2a removing some unneeded native fn mappingsin uv.rs and misc clean
.. 32bit linux issues persist.
2012-04-06 15:35:50 -07:00
Jeff Olson
6b349f3d11 experimenting with a different uv_buf_init impl to placate 32bit linux 2012-04-06 15:35:50 -07:00
Jeff Olson
ce34ccfec9 removed this binding a few commits back. missed it in rustrt.def.in 2012-04-06 15:35:50 -07:00
Jeff Olson
625c518eec whitespace cleanup after rebase 2012-04-06 15:35:50 -07:00
Jeff Olson
2b606ae5f3 add libuv error msg helpers.. flushing out windows tcp issue. 2012-04-06 15:35:49 -07:00
Jeff Olson
2c26cf7f96 add low-level uv_async bindings for use in tcp test 2012-04-06 15:35:49 -07:00
Jeff Olson
922ed6f947 hello world test for a tcp server in libuv
.. im now going to refactor the tcp request and server tests to utilize
each other, so no more external network ugliness
2012-04-06 15:35:49 -07:00
Jeff Olson
85e26eff6a fixing libuv stuff in win32 (see #2064) .. pass sockaddr_in by-ref, for now 2012-04-06 15:35:49 -07:00
Jeff Olson
f920d38808 adding missing rust_uv_* entries in rustrt.def.in 2012-04-06 15:35:48 -07:00
Jeff Olson
9ad67e8c14 test_uv_tcp_request() fully working on linux
.. up next: windows!
.. impl'd uv::direct::read_stop() and uv::direct::close() to wrap things up
.. demonstrated sending data out of the uv_read_cb via a channel (which
we block on to recv all of it, complete w/ EOF notification) that is
read from after the loop exits.
.. helpers to read the guts of a uv_buf_t
.. an idea im kicking around: starting to pile up all of these hideous
data accessor functions in uv::direct .. I might make impl/iface pairs
for the various uv_* types that I'm using, in order to encapsulate those
data access functions and, perhaps, make the access look a little cleaner
(it still won't be straight field access, but it'll be a lot better)
.. formatting cleanup to satisfy make check
2012-04-06 15:35:48 -07:00
Jeff Olson
877747d0ac wired up uv_read_start and some helper funcs around uv_alloc_cb tasks 2012-04-06 15:35:48 -07:00
Jeff Olson
e0193dac6e uv_buf_t's for uv_write() passed by-val .. no more mallocs or ptr cop-outs
so we're now adhering the libuv C api and passing structs by-val where
it is expected, instead of pulling pointer trickery (or worse having to
malloc structs in c++ to be passed back to rust and then into C again)
2012-04-06 15:35:48 -07:00
Jeff Olson
e5ccc76bc4 fixed by-val from rust->c, use ++ sigil in native fn sig <-- NEVAR FORGET
have to use ++ sigil in rust-side extern fn decls in order to have rust
actually copy the struct, by value, onto the C stack. gotcha, indeed.

also adding a helper method to verify/remind how to pass a struct by-val
into C... check out the rust fn sig for rust_uv_ip4_test_verify_port_val()
for more infos
2012-04-06 15:35:48 -07:00
Jeff Olson
43c82bdb45 fixed passing in uv_buf_t ptr array in uv_write.. return status 0
ways to go, still..
2012-04-06 15:35:48 -07:00
Jeff Olson
f179029296 uv_write works, buffer passing still broke, can get sockaddr_in by val
.. but passing sockaddr_in by val back to C is broken, still passing by
ptr
.. the uv_write_cb is processed, but we have a status -1.. there is
also valgrind spew.. so buf passing is broken, still.
2012-04-06 15:35:48 -07:00
Jeff Olson
da779988d5 impl of rustrt::rust_uv_write in c++ and whitespace cleanup 2012-04-06 15:35:48 -07:00
Jeff Olson
af08aba573 some more stuff for libuv dealing w/ 1402.. should go away soon 2012-04-06 15:35:48 -07:00
Jeff Olson
3817ba7578 adding uv::direct and beginning to work out tcp request case
lots of changes, here.. should've commited sooner.
- added uv::direct module that contains rust fns that map, neatly, to
the libuv c library as much as possible. they operate on ptrs to libuv
structs mapped in rust, as much as possible (there are some notable
exceptions). these uv::direct fns should only take inputs from rust and,
as neccesary, translate them into C-friendly types and then pass to the
C functions. We want to them to return ints, as the libuv functions do,
so we can start tracking status.
- the notable exceptions for structs above is due to ref gh-1402, which
prevents us from passing structs, by value, across the Rust<->C barrier
(they turn to garbage, pretty much). So in the cases where we get back
by-val structs from C (uv_buf_init(), uv_ip4_addr(), uv_err_t in callbacks)
, we're going to use *ctypes::void (or just errnum ints for uv_err_t) until
gh-1402 is resolved.
- using crust functions, in these uv::direct fns, for callbacks from libuv,
will eschew uv_err_t, if possible, in favor a struct int.. if at all
possible (probably isn't.. hm.. i know libuv wants to eventually move to
replace uv_err_t with an int, as well.. so hm).
- started flushing out a big, gnarly test case to exercise the tcp request
side of the uv::direct functions. I'm at the point where, after the
connection is established, we write to the stream... when the writing is
done, we will read from it, then tear the whole thing down.

overall, it turns out that doing "close to the metal" interaction with
c libraries is painful (and more chatty) when orchestrated from rust. My
understanding is that not much, at all, is written in this fashion in the
existant core/std codebase.. malloc'ing in C has been preferred, from what
I've gathered. So we're treading new ground, here!
2012-04-06 15:35:48 -07:00
Patrick Walton
851fde879d rt: Add architecture-specific general-purpose register definitions
This will be used for stack crawling, which in turn will be used for GC and
unwinding.
2012-04-04 21:40:34 -07:00
Erick Tryzelaar
4a4889859e std: add localtime/gmtime support. 2012-04-03 22:43:10 -07:00
Erick Tryzelaar
44c7386376 std: fix a typo. 2012-04-03 22:43:09 -07:00
Erick Tryzelaar
4871f11439 std: change timeval to ns resolution timespec
This lets us use the more precise clock_gettime on posix
machines.
2012-04-03 22:43:08 -07:00
Erick Tryzelaar
7aae7320db std: change time::timeval to be {sec: i64, usec: i32}.
It's possible to have negative times if expressing time before 1970, so
we should use signed types. Other platforms can return times at a higher
resolution, so we should use 64 bits.
2012-04-03 22:43:08 -07:00
Brian Anderson
e325146eb4 Merge remote-tracking branch 'brson/mainthread'
Conflicts:
	src/rt/rust_kernel.cpp
	src/rt/rust_scheduler.cpp
	src/rt/rust_scheduler.h
2012-04-03 20:30:01 -07:00
Brian Anderson
4cf7efc8f7 rt: Fix bugs in the osmain scheduler 2012-04-03 20:24:29 -07:00
Brian Anderson
c0e12854ed rt: Fix bugs in the osmain scheduler 2012-04-03 18:01:13 -07:00
Brian Anderson
81ce090643 rt: Include the correct header for alloca on windows 2012-04-03 17:19:15 -07:00
Brian Anderson
ab2158f070 rt: alloca is spelled differently on win32 2012-04-03 17:12:10 -07:00
Brian Anderson
f4b293f0e3 rt: Fix the 0 bytes lost issue
This is a workaround for #1815. libev uses realloc(0) to
free the loop, which valgrind doesn't like. We have suppressions
to make valgrind ignore them.

Valgrind also has a sanity check when collecting allocation backtraces
that the stack pointer must be at least 512 bytes into the stack (at
least 512 bytes of frames must have come before). When this is not
the case it doesn't collect the backtrace.

Unfortunately, with our spaghetti stacks that valgrind check triggers
sometimes and we don't get the backtrace for the realloc(0), it
fails to be suppressed, and it gets reported as 0 bytes lost
from a malloc with no backtrace.

This fixes the issue by alloca'ing 512 bytes before calling uv_loop_delete
2012-04-03 17:08:33 -07:00
Brian Anderson
4f4b7b10bb rt: Futz with headers to satisfy FreeBSD 2012-04-03 16:02:38 -07:00
Jon Morton
72ffb4b446 fix 'I don't know how C works' 2012-04-03 16:02:38 -07:00
Jon Morton
386069f39e actually remove memory.h; include cleanups 2012-04-03 16:02:38 -07:00
Jon Morton
632a4c9326 Refactor includes structure, getting rid of rust_internal.h
Many changes to code structure are included:
- removed TIME_SLICE_IN_MS
- removed sychronized_indexed_list
- removed region_owned
- kernel_owned move to kernel.h, task_owned moved to task.h
- global configs moved to rust_globals.h
- changed #pragma once to standard guard in rust_upcall.h
- got rid of memory.h
2012-04-03 16:02:38 -07:00
Brian Anderson
bef72447e7 core: Add a scheduler mode, osmain, to spawn onto the main scheduler 2012-04-03 14:28:30 -07:00
Graydon Hoare
28a0e9c999 Construct new strings through upcalls. 2012-04-02 17:38:06 -07:00
Brian Anderson
e1858882a4 rt: Run a single-threaded scheduler on the main thread 2012-04-02 15:35:47 -07:00
Brian Anderson
dd63c5ef1d rt: Add an assert to rust_get_current_task 2012-04-02 14:23:24 -07:00
Jon Morton
fa88d15d63 remove unneeded assert, move get_task_tls to sched_loop 2012-04-02 14:21:09 -07:00
Jon Morton
33a949eed6 Add global rust_get_current_task
Previously two methods existed: rust_sched_loop::get_task and rust_task::get_task_from_tcb. Merge both of them into one, trying the faster one (tcb) first, and if that fails, the slower one from the tls.
2012-04-02 14:21:08 -07:00
Jon Morton
bcb9269d84 rt: cleanup passing around of rust_env 2012-04-02 03:11:58 -05:00
Brian Anderson
bee45f0ef0 rt: rust_env is a struct 2012-04-01 21:07:42 -07:00
Brian Anderson
3232c52a61 rt: Assert things that are true 2012-04-01 20:54:30 -07:00
Brian Anderson
6042aefeeb rt: Convert an old warning to an assert 2012-04-01 20:49:41 -07:00
Jon Morton
128a8b6ed5 remove rust_srv 2012-04-01 22:18:40 -05:00
Jon Morton
413994ea3e replace assertion macros with plain asserts 2012-04-01 21:14:16 -05:00
Brian Anderson
3654ef0078 rt: Introduce rust_manual_sched_launcher_factory. Again, so sorry 2012-04-01 17:35:35 -07:00
Brian Anderson
7c1be236a5 rt: Introduce rust_sched_launcher_factory. Sorry, I need one 2012-04-01 17:27:18 -07:00
Brian Anderson
fb528dd7d6 rt: Allow some schedulers to stay alive even without tasks to execute 2012-04-01 16:57:14 -07:00
Brian Anderson
0a5e9d45e1 rt: Introduce rust_manual_sched_launcher 2012-04-01 16:21:48 -07:00
Brian Anderson
9d5c20ecca rt: rust_sched_launcher needs a virtual destructor 2012-04-01 13:25:49 -07:00
Brian Anderson
ac0381c0bb rt: rust_sched_launcher does not need a join() method 2012-04-01 00:24:25 -07:00
Brian Anderson
e78396850d Merge remote-tracking branch 'brson/mainthread'
Conflicts:
	src/rt/rust_sched_loop.cpp
	src/rt/rust_shape.cpp
	src/rt/rust_task.cpp
2012-04-01 00:15:04 -07:00
Brian Anderson
de47fcfdf9 rt: Extract rust_thread_sched_launcher from rust_sched_launcher 2012-03-31 23:35:41 -07:00
Brian Anderson
21064637ed rt: Fix whitespace 2012-03-31 23:12:06 -07:00
Brian Anderson
a17097a57b rt: Make rust_sched_launcher hide it's thread implementation 2012-03-31 21:48:52 -07:00
Brian Anderson
2d8ef7387e rt: Add some more locking asserts to rust_sched_loop 2012-03-31 19:51:30 -07:00
Brian Anderson
c8dc6fcb4c Revert "rt: Remove lock_held_by_current_thread"
Adds back the ability to make assertions about locks, but only under the
--enable-debug configuration

This reverts commit b247de6458.

Conflicts:

	src/rt/rust_sched_loop.cpp
2012-03-31 19:51:29 -07:00
Brian Anderson
609144f7a6 rt: Extract start_main_loop from rust_sched_loop to rust_sched_driver 2012-03-31 19:51:29 -07:00
Brian Anderson
218dd08469 rt: Introduce rust_sched_reaper
This just moves the responsibility for joining with scheduler threads
off to a worker thread. This will be needed when we allow tasks to be
scheduled on the main thread.
2012-03-31 19:51:29 -07:00
Brian Anderson
771c1be6a6 rt: Refactor the scheduler loop so that it can be driven from without 2012-03-31 19:51:29 -07:00
Brian Anderson
243790836a rt: Rename rust_task_thread to rust_sched_loop
This class no longer represents a thread; it just schedules tasks.
2012-03-31 19:51:29 -07:00
Brian Anderson
6bf8d19712 rt: Extract rust_sched_launcher from rust_task_thread
rust_sched_launcher is actually responsible for setting up the thread and
starting the loop. There will be other implementations that do not actually
set up a new thread, in order to support scheduling tasks on the main OS
thread.
2012-03-31 19:51:29 -07:00
Jon Morton
9851a906a5 initialize cur_thread, first task on thread 0 2012-03-31 13:14:54 -05:00
Jon Morton
8aee42a382 Choose task thread in rust_scheduler by round robin
Remove the random context from rust_scheduler and use a simple round robin system to choose which thread a new task gets put on. Also, some incorrect tab indents around scoped blocks were fixed.
2012-03-31 02:14:44 -05:00
Brian Anderson
b17145b4ae rt: Track backtraces of all allocations with RUSTRT_TRACK_ALLOCATIONS=3 2012-03-29 16:43:18 -07:00
Brian Anderson
3ff01361d5 rt: Make the CC sweep use the box annihilator 2012-03-29 16:43:18 -07:00
Brian Anderson
15de9b3c95 rt: Make the box annihilator walk and delete contents 2012-03-29 16:43:18 -07:00
Brian Anderson
5747fe7a2c rt: For now, only run the box annihilator after task failure 2012-03-29 16:43:18 -07:00
Brian Anderson
7f9ed39040 rustc: Only invoke when there are cleanups 2012-03-29 16:43:18 -07:00
Brian Anderson
3a7a408386 rt: Free all outstanding boxes at task death 2012-03-29 16:43:18 -07:00
Graydon Hoare
e950313155 Remove execvpe use in general, it seems pointless and non-portable. 2012-03-28 20:58:43 -07:00
Graydon Hoare
2aaca455b9 Tidy up multiple declarations and STDC_FOO_MACROS guards in headers. 2012-03-28 14:26:51 -07:00
Graydon Hoare
c141e7a068 Fix some gcc-4.4-isms, should build now on 4.1+. 2012-03-28 13:52:47 -07:00
Graydon Hoare
bd0399863f Disable some advanced (post glibc-2.3) libuv features when building snaps. 2012-03-26 18:03:53 -07:00
Marijn Haverbeke
1b81c5112a Remove last vestiges of old-style intrinsics
Closes #2048
2012-03-23 16:08:01 +01:00
Marijn Haverbeke
52d618a99a Revert removal of intrinsics
Oops. We can't do this yet until the next snapshot.
2012-03-23 12:51:20 +01:00
Marijn Haverbeke
f5024692d4 Remove support for the old-style intrinsics
Closes #2042
Closes #1981
2012-03-23 12:21:55 +01:00
Brian Anderson
f7f1490d6e rt: Run resource destructors during cycle collection 2012-03-22 19:07:31 -07:00
Brian Anderson
d7be4abdae rt: Fix valgrind stack hints 2012-03-21 19:10:32 -07:00
Brian Anderson
9ea3bc614e rt: Shave 16 bytes off the __morestack frame 2012-03-21 19:10:32 -07:00
Brian Anderson
9f89cc9d15 rt: Shave a few instructions off __morestack 2012-03-21 19:10:32 -07:00
Brian Anderson
f5f6135fd0 rt: Stop using large stacks for the main task 2012-03-21 19:10:32 -07:00
Brian Anderson
0639b67290 rt: Use get_task_from_tcb during stack growth calls 2012-03-21 19:10:32 -07:00
Brian Anderson
4ad57f5c39 rt: Add rust_task::get_task_from_tcb 2012-03-21 19:10:32 -07:00
Brian Anderson
08f783ff10 rt: Add a task field to stk_seg and populate it 2012-03-21 19:10:32 -07:00
Brian Anderson
4a0c6c7f41 rt: Add a get_sp_limit function 2012-03-21 19:10:31 -07:00
Brian Anderson
1cb35c9b26 rt: Rename record_sp to record_sp_limit 2012-03-21 19:10:31 -07:00
Brian Anderson
ba322b0a70 rt: Reset the stack limit after catching an exception
This wasn't causing problems but it looked wrong
2012-03-21 19:10:31 -07:00
Brian Anderson
b78af4f7c4 rt: Inline a bunch of stack switching code 2012-03-21 19:10:31 -07:00
Brian Anderson
d5968d9f38 rt: Swap the definition of stk_seg::next and prev 2012-03-21 19:10:31 -07:00
Brian Anderson
6115b13dfc rt: Don't switch to the C stack on the upcall_new_stack fast path 2012-03-21 19:10:31 -07:00
Brian Anderson
8a145a601e rt: Don't swatch stacks during upcall_del_stack 2012-03-21 19:10:31 -07:00
Graydon Hoare
9ba712fb8b Every time you don't use a variable, a kitten scowls. 2012-03-21 19:00:52 -07:00
Graydon Hoare
eba5129978 Quiet unused-result error harder. 2012-03-21 18:53:27 -07:00
Graydon Hoare
d28175b916 Upgrade valgrind headers to 3.7, silencing build breakage on FreeBSD. 2012-03-21 18:40:32 -07:00
Graydon Hoare
a9e7bff731 Remove incorrect uses of NVALGRIND, Close #1435. 2012-03-21 18:21:11 -07:00
Graydon Hoare
855c99ea75 Some tests for passing and returning structures by value on x64. Close #1402. Close #1970. 2012-03-20 16:44:56 -07:00
Brian Anderson
ccaace6587 rt: Remove an unused function 2012-03-19 19:02:54 -07:00
Graydon Hoare
869b2d7064 Send string concatenation to specialized upcall, shave 17s off librustc compile time. 2012-03-19 14:29:39 -07:00
Brian Anderson
7dcac31e4d rt: Remove rust_task_thread::dead_tasks 2012-03-18 18:18:18 -07:00
Brian Anderson
6f6650e726 rt: Remove rust_task_thread::newborn_tasks 2012-03-18 18:18:18 -07:00
Brian Anderson
5d4bf75f56 rt: Convert rust_task_list to a typedef 2012-03-18 18:18:18 -07:00
Brian Anderson
47c1895724 rt: Don't store the name of the task state in rust_task_list 2012-03-18 18:18:15 -07:00
Brian Anderson
05466c6138 rt: Use an enum to represent the task state 2012-03-18 17:41:56 -07:00
Brian Anderson
b247de6458 rt: Remove lock_held_by_current_thread 2012-03-18 17:03:35 -07:00
Brian Anderson
132266b2cb rt: Remove the recursive lock from rust_task_thread 2012-03-17 18:44:41 -07:00
Brian Anderson
35e9970e29 rt: Ports don't need to ref their tasks
Port lifetime is always bounded by their owning task
2012-03-17 17:56:15 -07:00
Brian Anderson
5728a69e78 rt: Remove some bogus pthread settings from rust_task_thread
This is all handled by rust_thread, and 'true' isn't even a valid
value to pass to pthread_attr_setdetachestate
2012-03-17 17:18:24 -07:00
Marijn Haverbeke
22bef74b55 Remove shared tydescs
All tydescs are static now, there's no need to worry about
marshalling them between threads anymore.
2012-03-16 15:38:42 +01:00
Marijn Haverbeke
76d07f4056 Remove dynastack support from runtime
Issue #1982
2012-03-16 00:44:06 +01:00
Marijn Haverbeke
146b61189a Get rid of rust_crate_cache in the runtime
We are no longer generating dynamic tydescs or dicts.

Issue #1982
2012-03-16 00:44:06 +01:00
Brian Anderson
561511e628 core: Channels are just port ids 2012-03-15 11:10:53 -07:00
Brian Anderson
c414b78afe rt: Remove the kernel task table 2012-03-15 11:10:52 -07:00
Brian Anderson
1366d65660 rt: Remove remaining uses of rust_kernel::get_task_by_id 2012-03-15 11:10:52 -07:00
Brian Anderson
b278d675a2 rt: Look up ports through a single port table
Instead of a two-level lookup, just use one big table
2012-03-15 11:10:52 -07:00
Marijn Haverbeke
d0f5e58e95 Zero out dest ptr when port_recv doesn't return a value 2012-03-15 15:08:30 +01:00
Brian Anderson
5c23d21e83 rt: Remove an incorrect assert in lock_and_signal
This assert doesn't hold because it isn't made while holding the lock
2012-03-13 16:12:38 -07:00
Brian Anderson
3de30f4ef2 rt: Change alignof to rust_alignof. Remove -Wno-c++11-compat. Closes #1644 2012-03-12 18:03:48 -07:00
Brian Anderson
db79f3c0a5 rt: Remove arbitrary limit on size of port queue. Closes #1245 2012-03-12 13:24:09 -07:00
Brian Anderson
dc0b9f44e2 rt: Change the rust_port refcounting scheme to avoid races
Hopefully...
2012-03-06 17:14:40 -08:00
Brian Anderson
ee991cae81 rt: Add a hack to fix a port detach bug 2012-03-05 20:02:25 -08:00
Brian Anderson
958c321083 rt: Fix the atomic get_ref_count method to avoid races 2012-03-05 19:39:56 -08:00
Brian Anderson
1347d04bb0 rt: Properly block tasks while waiting for port detach 2012-03-05 19:39:56 -08:00
Brian Anderson
4c4a2320eb rt: Make rust_port_detach less contentious
It still utterly dominates some benchmarks with busy waiting, but at least it
doesn't create lock contention while doing so.
2012-03-05 19:39:56 -08:00
Brian Anderson
0a5603cb58 rt: Make linked failure less prone to deadlock
Still a mess.
2012-03-05 19:39:56 -08:00
Brian Anderson
cc276fe3c9 rt: Be more precise with VALGRIND_MAKE_MEM_UNDEFINED 2012-03-05 19:39:56 -08:00
Brian Anderson
c78da1e170 rt: Stop calling prepare_valgrind_stack when it's not needed 2012-03-05 19:39:56 -08:00
Brian Anderson
f057f00300 rt: Simplify reap_dead_tasks 2012-03-05 19:39:56 -08:00
Brian Anderson
8efe4b8913 rt: Add an assert to the scheduler loop 2012-03-05 19:39:56 -08:00
Brian Anderson
e08f46db68 rt: Move receive code into rust_port 2012-03-05 19:39:56 -08:00
Brian Anderson
77295c56c5 rt: Simplify the recv interface 2012-03-05 19:39:56 -08:00
Brian Anderson
8e0efce0da rt: Move some code from rust_port_detach into rust_port::detach 2012-03-05 19:39:56 -08:00
Brian Anderson
93fa933a19 rt: Move some locking from rust_port to rust_task 2012-03-05 19:39:56 -08:00
Brian Anderson
e3ccac8ed3 rt: Renome rust_task::lock to port_lock 2012-03-05 19:39:55 -08:00
Brian Anderson
fa566ad2fd rt: Make the rust_task_thread lock private 2012-03-05 19:39:55 -08:00
Brian Anderson
2465a63a69 rt: Move transition from rust_task to rust_task_thread 2012-03-05 19:39:55 -08:00
Brian Anderson
237652299e rt: Protect cond and cond_name with the state_lock 2012-03-05 19:39:55 -08:00
Brian Anderson
0432030c27 rt: Don't take the task lock on state transitions 2012-03-05 19:39:55 -08:00
Brian Anderson
b2a075e20d rt: Protect rust_task::state with a lock 2012-03-05 19:39:55 -08:00
Brian Anderson
d7298a797b rt: Protect rust_task::killed with a lock 2012-03-05 19:39:55 -08:00
Graydon Hoare
e400733e90 Extra removal, missed by last commit. 2012-03-05 16:02:38 -08:00
Graydon Hoare
6c87c34277 Remove dead code from rt (debug_obj, rust_obj, rust_closure, rust_box_obj, rust_vtable) 2012-03-05 15:50:11 -08:00
Brian Anderson
3a4c96a196 rt: Remove virtual methods from memory_region, rust_srv 2012-03-05 14:47:24 -08:00
Brian Anderson
38b2b74413 rt: Move RUST_POISON_ON_FREE into rust_env 2012-03-02 20:13:52 -08:00