Commit Graph

1361 Commits

Author SHA1 Message Date
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
Brian Anderson
ed7d25bb6d rt: Checking port_table.is_empty() requires a lock 2012-03-02 17:10:14 -08:00
Brian Anderson
04d9cc18a5 rt: Protect rust_task::supervisor with a lock 2012-03-02 16:33:33 -08:00
Brian Anderson
f4ce965ce7 rt: Port ref counts are protected by the task lock. Ick. 2012-03-02 16:33:33 -08:00
Brian Anderson
14306756b4 rt: Always delete task stacks on the task thread
There's not a real race here, but it makes helgrind happy and is arguably
less prone to future errrors.
2012-03-02 15:21:59 -08:00
Niko Matsakis
def72bda47 retool inline encoding to handle methods, fix tests 2012-03-02 06:47:25 -08:00
Brian Anderson
96f565492d rt: Make fields of rust_task_thread private where possible 2012-03-01 21:41:11 -08:00
Brian Anderson
b6c57dbba2 rt: rust_task_thread isn't ref counted 2012-03-01 21:19:12 -08:00
Brian Anderson
084a699a7a rt: Remove vec_append.ll
This looks like just a random snippet of llasm.
2012-03-01 18:20:40 -08:00
Brian Anderson
5df44bd066 rt: Remove rust_kernel::live_tasks. Unused 2012-03-01 14:53:20 -08:00
Niko Matsakis
7d0958f70f add the ability to snag the frame so we can verify that we are inlining 2012-02-29 11:54:47 -08:00
Erick Tryzelaar
d3331bce98 rt: strings should escape chars like '\n' as '\n' 2012-02-28 18:05:25 -08:00
Brian Anderson
8d617e638e rt: Reset the stack boundary after returning from crust functions 2012-02-28 17:56:15 -08:00
Jeff Olson
b79b5739c9 add rust_uv_loop_delete to rustrt.def.in 2012-02-28 17:56:15 -08:00
Jeff Olson
b4c88cdcec add uv::loop_delete()
because of the last change, the loop ptr is no longer cleaned up
when the loop exits. This api call addresses that. Sadly, the loop
ptr is not "reusable" across multiple calls to uv::run().
2012-02-28 17:56:15 -08:00
Jeff Olson
0b3a06ab2c correcting for libuv behavior that differs between linux & windows
net complexity increase :/
2012-02-28 17:56:15 -08:00
Jeff Olson
bb5960aa57 moving new uv stuff into uv.rs and rust_uv.cpp
- removing the remains of uvtmp.rs and rust_uvtmp.rs
- removing the displaced, low-level libuv bindings
in uv.rs and rust_uv.cpp
2012-02-28 17:56:15 -08:00
Jeff Olson
cf08ed6458 fzzzy's patch for rustrt.def.in
adds new c/c++ methods bound in rust for uvtmp::uv
2012-02-28 17:56:15 -08:00
Jeff Olson
1d3e08d8c6 finishing up simple uv_timer impl
as it stands, basic async nad timer support is added
2012-02-28 17:56:15 -08:00
Jeff Olson
b68eb507da cleaning up uv_async stuff and stubbing uv_timer 2012-02-28 17:56:14 -08:00
Jeff Olson
974c23cbeb removed hello world and added uv_async_* 2012-02-28 17:56:14 -08:00
Jeff Olson
ffad8d7f0c everything is laid out and working through a basic hw
the core impl is there, with a async handle in place
to take incoming operations from user code. No actual
uv handle/operations are implemented yet, though.
2012-02-28 17:56:14 -08:00
Niko Matsakis
a1b2f34bd0 remove temp sanity check 2012-02-28 06:31:28 -08:00
Brian Anderson
7e9aa6c3c2 rt: Don't zero new stacks 2012-02-27 16:13:51 -08:00
Brian Anderson
b3f77bf927 rt: Change the way the kernel exits to avoid pthread leaks
This makes the kernel join every scheduler thread before exiting in order to
ensure that all threads are completely terminated before the process exits. On
my machine, for 32-bit targets, this was causing regular valgrind errors.
2012-02-27 14:25:32 -08:00
Brian Anderson
e4c027446e Revert "rt: Reconfigure the C stack for valgrind each time it's used"
This reverts commit 859e025652.

This ended up not fixing the '0 bytes lost' problem and has some performance
impact.
2012-02-27 14:01:36 -08:00
Brian Anderson
21650d0212 rt: Remove unused forward declaration of rust_realloc_shared 2012-02-26 16:43:42 -08:00
Brian Anderson
7d1e36a315 rt: Remove ptr_vec. Unused 2012-02-26 16:24:37 -08:00
Brian Anderson
4d03e4b711 rt: Remove smart_ptr. Unused 2012-02-26 16:23:37 -08:00
Niko Matsakis
5ee89f3f2a add an option to the final cc so that it prints out/logs unreclaimed ptrs 2012-02-24 20:46:27 -08:00
Brian Anderson
155a67eae7 Revert "rt: Cut the red zone to 10K on mac"
This reverts commit cb7022cfc2.
2012-02-24 12:26:06 -08:00
Brian Anderson
cb7022cfc2 rt: Cut the red zone to 10K on mac 2012-02-23 19:42:59 -08:00
Brian Anderson
7a6498668f rt: Cut the red zone to 2K on linux 2012-02-23 00:23:22 -08:00
Brian Anderson
cd381333b9 rt: Cut the red zone to 4K on linux 2012-02-22 23:50:47 -08:00
Brian Anderson
b5c7997ef5 rt: Switch to the C stack in reset_stack_limit 2012-02-22 23:50:47 -08:00
Brian Anderson
c16bfbe0c3 rt: Stop logging on the Rust stack. Closes #1478 2012-02-22 22:30:21 -08:00
Marijn Haverbeke
b1d7f252a9 Remove unused tydesc argument to upcall_shared_malloc 2012-02-21 17:08:14 +01:00
Brian Anderson
4220dcf1e9 core: New task API 2012-02-20 18:58:04 -08:00
Chris Peterson
fed81c2cfc rt: Add some lock_and_signal assertions
Assert that locks are not reentered on the same thread, unlocked by a
different thread, or deleted while locked.
2012-02-19 23:15:35 -08:00
Chris Peterson
9f49293232 rt: Initialize Windows CRITICAL_SECTION with non-zero spin count
If a CRITICAL_SECTION is not initialized with a spin count, it will
default to 0, even on multi-processor systems. MSDN suggests using
4000. On single-processor systems, the spin count parameter is ignored
and the critical section's spin count defaults to 0.

For Windows >= Vista, extra debug info is allocated for
CRITICAL_SECTIONs but not released in a timely manner. Consider using
InitializeCriticalSectionEx(CRITICAL_SECTION_NO_DEBUG_INFO).
2012-02-19 23:13:31 -08:00
Chris Peterson
159dfd7c3b rt: Delete Windows CRITICAL_SECTION in dtor 2012-02-19 23:11:03 -08:00
Chris Peterson
3d202d7eae rt: rename nano_time() builtin to match time::precise_time_ns() 2012-02-18 01:39:42 -08:00
Chris Peterson
123a920f59 std: Fix Windows system time conversion for get_time() 2012-02-18 01:21:26 -08:00
Brian Anderson
54d7bffbb8 rt: Make upcall_vec_push an intrinsic 2012-02-17 12:08:03 -08:00
Brian Anderson
db62154062 rt: Don't take the lock when reallocing in the kernel memory region 2012-02-17 11:37:17 -08:00
Brian Anderson
d23cd8f52f rt: Don't hit TLS on upcall_vec_push unless necessary 2012-02-17 11:37:17 -08:00
Brian Anderson
a3fdd8c93f rt: Don't log on entry to upcall_vec_push. Also slow 2012-02-17 11:37:17 -08:00
Brian Anderson
fca8e9e621 rt: Don't do the stack canary check in upcall_vec_push. Too slow 2012-02-17 11:37:17 -08:00
Brian Anderson
e0b2fd8417 rt: Simplify upcall_vec_push 2012-02-17 11:37:17 -08:00
Brian Anderson
853e2003b8 rt: Make the stack canary just a word on the stk_seg struct 2012-02-17 11:37:17 -08:00
Brian Anderson
75503570c7 rt: Untabify rust_port_selector.cpp 2012-02-16 12:53:21 -08:00
Brian Anderson
96af6f05a1 rt: Randomize port selection 2012-02-16 12:53:21 -08:00
Brian Anderson
b2cfb7ef82 rt: Add rust_port_select function 2012-02-16 11:12:22 -08:00
Brian Anderson
859e025652 rt: Reconfigure the C stack for valgrind each time it's used 2012-02-14 15:11:56 -08:00
Brian Anderson
a53a08e1b9 rt: Don't allocate a C stack for tasks that already have one 2012-02-14 13:51:15 -08:00
Brian Anderson
d5e7f0d113 rt: Don't kill tasks while they are in a callback from C 2012-02-14 11:24:09 -08:00
Brian Anderson
a393fb3221 rt: Maintain stack ptrs correctly when returning from stack switches 2012-02-14 11:24:09 -08:00
Brian Anderson
214cdd0dee rustc: Translate crust functions 2012-02-14 11:24:09 -08:00
Brian Anderson
4cc1e31f74 rt: Add a Rust callback debugging function 2012-02-14 11:24:09 -08:00
Ted Horst
a7a1152db5 put fflush back in 2012-02-10 19:42:32 -08:00
Ted Horst
36d5074f8f log to stderr instead of stdout
includes rustc diagnostics
runtest updated to check stderr for errors
2012-02-10 19:42:32 -08:00
Brian Anderson
b9e0ee8e7e rt: Add docs to stack functions 2012-02-10 12:58:35 -08:00
Brian Anderson
3af4b2c998 rt: Call register/deregister_valgrind_stack from the stack con/destructors 2012-02-10 12:58:35 -08:00
Brian Anderson
3406da49d9 rt: Extract prepare_valgrind_stack from register_valgrind_stack 2012-02-10 12:58:35 -08:00
Brian Anderson
c42492e6aa rt: Rename config_valgrind_stack to register_valgrind_stack, etc 2012-02-10 12:58:35 -08:00
Brian Anderson
dd0ae80e63 rt: Account for the size of stack_canary in create_stack 2012-02-10 12:58:35 -08:00
Brian Anderson
fc028c30a0 rt: Move the addition of the stack canary into create_stack 2012-02-10 12:58:35 -08:00
Brian Anderson
8e55d3130a rt: Use 100k stacks for scheduler threads 2012-02-10 11:53:30 -08:00
Marijn Haverbeke
d01e7cd340 Represent boxed ifaces in a way similar to functions
They are now a (dictptr, box) pair, where box is a regular boxed
representation of the inner type. This cuts down on some special
case code.

Also removes some code from trans::base that was moved to shape but
then somehow restored in trans::base through a bad merge.

Starts on issue #1567
2012-02-10 12:36:57 +01:00
Brian Anderson
d493438c98 rt: Disable some expensive asserts 2012-02-09 22:58:40 -08:00
Brian Anderson
d90a9d3da0 rt: Inline everything on the C-stack-switching path 2012-02-09 22:15:15 -08:00
Brian Anderson
dff256cd19 rt: Move valgrind stack configuration out of the hot path 2012-02-09 21:27:50 -08:00
Brian Anderson
81e1564a7d rt: Detach pthreads before exiting
Joinable pthreads need to be either joined or detached and we no
longer join with the scheduler threads.
2012-02-09 19:00:16 -08:00
Brian Anderson
5d8d591ffc rt: Remove sync::yield and sync::sleep 2012-02-09 19:00:16 -08:00
Brian Anderson
421c8db144 rt: Move rust_thread to its own files 2012-02-09 19:00:16 -08:00
Brian Anderson
8ad9cf8087 rt: Add more stack-switching commentary 2012-02-09 19:00:16 -08:00
Brian Anderson
5d2442d89c rt: Add upcall_call_shim_on_rust_stack 2012-02-09 19:00:16 -08:00
Brian Anderson
79b1563abb rt: Use rust_task_thread's C-stack pool for native calls 2012-02-09 19:00:16 -08:00
Brian Anderson
bfb80064d2 rt: Add methods to rust_task_thread for borrowing C stacks 2012-02-09 19:00:16 -08:00
Brian Anderson
8fe506bdca rt: Move more setup code into create_stack 2012-02-09 19:00:16 -08:00
Brian Anderson
ea76d3f454 rt: Add rust_task::call_on_c_stack 2012-02-09 19:00:16 -08:00
Brian Anderson
1e2fe4ab8f rt: Rename call_shim_on_c_stack to call_and_change_stacks 2012-02-09 19:00:15 -08:00
Brian Anderson
0667fb4e63 rt: Make rust_task::ref_count private 2012-02-09 19:00:15 -08:00
Brian Anderson
ae8ea4a78b rt: Add constructors and destructors for stacks 2012-02-09 19:00:15 -08:00
Brian Anderson
b98df86c09 rt: Move some stack manipulation functions into rust_task 2012-02-09 19:00:15 -08:00
Brian Anderson
4bd8f8d936 rt: Rename new_stack to next_stack, del_stack to prev_stack 2012-02-09 19:00:15 -08:00
Brian Anderson
889a783494 rt: Remove rust_task::rust_sp 2012-02-09 19:00:15 -08:00
Brian Anderson
d39ea47746 rt: Remove rust_task_user struct 2012-02-09 19:00:15 -08:00
Brian Anderson
1dad32c015 rt: Remove unused builtins 2012-02-09 19:00:15 -08:00
Brian Anderson
d756b01619 rt: Add a function for configuring task notification 2012-02-09 19:00:15 -08:00
Brian Anderson
e0d5b92b84 rt: Begin moving stack-building functions to rust_stack.cpp 2012-02-09 19:00:15 -08:00
Brian Anderson
2983e77383 rt: Remove unused context functions 2012-02-09 19:00:15 -08:00
Jyun-Yan You
b778dac197 fix build on freebsd 2012-02-09 18:41:57 -08:00
Brian Anderson
149d1d4a6e core: Add a test for blocking in native code 2012-02-08 15:42:51 -08:00
Brian Anderson
35ba9715fa core: Add task::spawn_sched
This function creates a new scheduler with a specified number of threads and
immediately executes a task on it. The scheduler is configured to terminate
when the task dies. This is the minimum API necessary to enable blocking C
calls.
2012-02-08 15:42:51 -08:00
Brian Anderson
2f4e7c157e rt: Export a scheduler API 2012-02-08 15:42:51 -08:00
Brian Anderson
f2a1aa2649 rt: Hold schedulers in a map 2012-02-08 15:42:51 -08:00
Brian Anderson
028af5cb6c rt: Change the lifecycle of tasks and schedulers for various reasons
This is in preparation for giving schedulers their own life cycle separate
from the kernel.

Tasks must be deleted before their scheduler thread, so we can't let the
scheduler exit before all its tasks have been cleaned up. In this scheme,
the scheduler will unregister tasks with the kernel when they are reaped,
then drop their ref on the task (there may still be others). When the task
ref count hits zero, the task will request to be unregistered from the
scheduler, which is responsible for deleting the task.

Instead of having the kernel tell the scheduler to exit, let the scheduler
decide when to exit. For now it will exit when all of its tasks are
unregistered.
2012-02-08 15:42:51 -08:00
Brian Anderson
ebc3646c39 rt: Start schedulers immediately upon creation 2012-02-08 15:42:51 -08:00
Brian Anderson
7685e5de94 rt: Refactor the rust_kernel interface a bit 2012-02-08 15:42:47 -08:00
Brian Anderson
ad80823a6c rt: Introduce scheduler ids 2012-02-08 15:33:40 -08:00
Brian Anderson
c76b81cddf rt: Delete schedulers immediately upon release
This will be needed once we support dynamically changing schedulers.
2012-02-08 15:33:40 -08:00
Brian Anderson
f39e64d56a rt: Change the scheme used for terminating the kernel
Instead of joining on the scheduler threads, instead keep a count of active
schedulers. When there are no more schedulers raise a signal for the main
thread to continue.

This will be required once schedulers can be added and removed from the
running kernel.
2012-02-08 15:33:40 -08:00
Brian Anderson
6eafe5d772 rt: Remove is_running flag from rust_thread. Unused 2012-02-08 15:33:40 -08:00
Brian Anderson
fad3de5900 rt: Remove rust_scheduler::rval. Unused 2012-02-08 15:33:40 -08:00
Niko Matsakis
6e680e36a7 deprecate old style box shape strings 2012-02-08 13:10:20 -08:00
Niko Matsakis
a6dde7766e fix bug that causes premature pops from obstack
basically, the alignment step did not check if it walked off
the end of the buffer
2012-02-08 12:55:19 -08:00
Niko Matsakis
526e73d7f8 make shape code use the tydesc found in the box, not the shape str 2012-02-08 09:14:59 -08:00
Brian Anderson
9b01620e8d rt: Don't ignore result of chdir. Fail hard for now with a FIXME
My gcc won't let the result of this function be ignored.
2012-02-07 20:28:57 -08:00
Graydon Hoare
93450abb4b Make process-spawning take environments and working directories, remove procsrv task from compiletest. 2012-02-07 19:57:03 -08:00
Magnus Auvinen
3e9859362b made leak an intrinsic to avoid a c-call. added memmove and memcpy intrinsics 2012-02-07 15:08:54 -08:00
Marijn Haverbeke
47143ee24a Stop storing cmp glue in tydescs
There's no such thing anymore, we can simply call upcalls.cmp_type.
2012-02-07 14:37:10 +01:00
Marijn Haverbeke
b28a5552e3 Reuse monomorphized functions for different box types
The free glue for opaque boxes will pick the actual tydesc out of the
box, and call its glue.

Issue #1736
2012-02-07 14:36:02 +01:00
Brian Anderson
3bd0338c19 Revert "log to stderr instead of stdout"
This is causing mysterious hangs on windows. Issue #1769.

This reverts commit d65eabd5de.
2012-02-06 18:29:58 -08:00
Kevin Cantu
6be25c8a0c Adding str::reserve 2012-02-05 14:56:16 -08:00
Kevin Cantu
d3dfe8758d Making vec::reserve reserve precisely the size given (untested) 2012-02-05 14:56:16 -08:00
Brian Anderson
e818406072 rt: Expand rust_kernel::live_tasks to a uintptr_t 2012-02-04 01:15:00 -08:00
Brian Anderson
9fa950ec53 rt: Stop using atomic ops on rust_kernel::live_tasks
These ops are all done within spitting distance of a suitable lock,
so just protect it with the lock.
2012-02-04 00:31:43 -08:00
Brian Anderson
21d783c338 rt: Make isaac_init not a template 2012-02-03 23:48:12 -08:00
Brian Anderson
f7a727e861 rt: Remove some silly locks in rust_scheduler 2012-02-03 23:48:12 -08:00
Brian Anderson
c7777f4fd9 rt: Add sanity checks when we hit the max task/port id 2012-02-03 23:48:12 -08:00
Brian Anderson
12fa90888e rt: Clean up the way the kernel tracks tasks 2012-02-03 23:48:12 -08:00
Brian Anderson
e7f00b6493 rt: Do all task creation through a scheduler 2012-02-03 23:48:12 -08:00
Brian Anderson
bf250bec7c rt: Create new tasks through the current thread's scheduler 2012-02-03 23:48:12 -08:00
Brian Anderson
3d0e7a7af3 rt: Add a field to rust_task to hold its scheduler 2012-02-03 23:48:12 -08:00
Brian Anderson
8d881967a2 rt: Extract rust_scheduler from rust_task_thread 2012-02-03 23:48:12 -08:00
Brian Anderson
f94339cc1c rt: Rename rust_scheduler to rust_task_thread 2012-02-03 23:48:12 -08:00
Ted Horst
d65eabd5de log to stderr instead of stdout
includes rustc diagnostics
runtest updated to check stderr for errors
2012-02-03 20:55:53 -08:00
Marijn Haverbeke
c1b075d042 Remove experimental GC code
It's been sitting unused long enough to have bitrotted completely.
2012-02-03 11:34:12 +01:00
Brian Anderson
1ea184285e rt: Change the win32 event object to an auto-reset event
The way I read the docs, having this be a manual reset event means
that after the first time it's signalled it stays that way until reset,
and we never, ever reset it.
2012-02-02 18:30:06 -08:00
Brian Anderson
3b4dd26ff1 rt: Remove lock_and_signal::signal_all 2012-02-02 18:29:03 -08:00
Brian Anderson
9c33f2c561 rt: Remove lock_and_signal::timed_wait 2012-02-02 18:25:49 -08:00
Brian Anderson
cd774fc5fa rt: Stop waking up the scheduler on a timer 2012-02-02 18:23:01 -08:00
Brian Anderson
b1a090c7c4 rt: Remove unused arguments in rust_scheduler 2012-02-02 18:17:33 -08:00
Brian Anderson
6c632c71c6 rt: Simplify reap_dead_tasks 2012-02-02 18:10:24 -08:00
Brian Anderson
f719ea552b rt: Remove rust_scheduler::interrupt_flag. Unused 2012-02-02 18:10:24 -08:00
Brian Anderson
aee83d2ff1 rt: Only wake up all schedulers when no tasks are left
At the moment there's not really any reason to be raising this signal,
since they schedulers wake up periodically anyway, but once we remove
the timer this will be how the schedulers know to exit.
2012-02-02 18:10:24 -08:00
Brian Anderson
5c3c8d454d rt: Do all signalling while holding a lock
This will matter once the scheduler is changed to not wake up on a timer
2012-02-02 18:10:24 -08:00
Brian Anderson
5449b886d3 rt: Remove bogus task reaping from the scheduler 2012-02-02 18:10:24 -08:00
Brian Anderson
3978fbff8b rt: Remove rust_task::can_schedule. Does nothing 2012-02-02 18:10:24 -08:00
Brian Anderson
ed3a5ad5ad rt: Remove running_on flag. Does nothing 2012-02-02 18:10:24 -08:00
Brian Anderson
57cad61353 rt: Remove task pinning. Does nothing 2012-02-02 18:10:24 -08:00
Brian Anderson
18de0f2aeb rt: Rename task_sleep intrinsic to task_yield. Remove usec param 2012-02-02 18:10:24 -08:00
Brian Anderson
8693fcc2d7 rt: Remove yield timers 2012-02-02 18:10:24 -08:00
Brian Anderson
7f2980b749 rt: Remove bitrotted tests 2012-02-02 18:10:24 -08:00
Brian Anderson
65f4b0587a rt: Generate intrinsics 2012-02-02 18:10:23 -08:00
Brian Anderson
bda40e2e4a rt: Fix intrinsics bustage
intrinsics.cpp and the file to generate the ll had bitrotted.
2012-02-02 18:10:23 -08:00
Niko Matsakis
196d69beb2 make boxes self-describing (fixes #1493)" (take 2)
this will be used to generate a new snapshot.
2012-02-01 18:52:08 -08:00
Niko Matsakis
3116643806 Revert "make boxes self-describing (fixes #1493)" until a new
snapshot is prepared.
2012-02-01 18:50:19 -08:00
Niko Matsakis
c36207bfb8 make boxes self-describing (fixes #1493) 2012-02-01 18:18:07 -08:00
Brian Anderson
4eb92d4177 rt: Don't access fields on null supervisor task 2012-02-01 16:46:11 -08:00
Brian Anderson
f76e6c39f6 rt: Fix lock_held_by_current_thread
This simplifies the check for thread ownership by removing the _locked flag
and just comparing against the thread ID of the last thread to take the lock.
If the running thread took the lock _holding_thread will be equal to
pthread_self(); if _holding_thread is some other value then the running thread
does not have the lock.

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

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

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

Closes #1436
2012-01-06 17:40:05 +01:00
Niko Matsakis
295df68faf add alignment to i386 for good measure, though we do not yet
save SSE regs in i386 (we ought to, though!)
2012-01-06 07:57:56 -08:00
Niko Matsakis
fefae72a53 fix alignment of registers structure 2012-01-06 07:45:06 -08:00
Jyun-Yan You
21eadbe6f1 add missing library, enable segmented stacks for freebsd 2012-01-01 20:18:55 -08:00
Jyun-Yan You
d4884b6c6e forgot to add parentheses 2012-01-01 20:18:55 -08:00
User Jyyou
a59c4b1b47 freebsd support 2012-01-01 20:18:55 -08:00
Graydon Hoare
5fd0a3be0c Save and restore xmm regs across the call to UPCALL_NEW_STACK during __morestack, close #1388. 2011-12-29 11:49:29 -08:00
Graydon Hoare
884adf38a1 Remove obsolete comments. 2011-12-29 10:21:05 -08:00
Graydon Hoare
5930463faa Tidy up some drift in runtime logging, close #1380. 2011-12-28 11:53:12 -08:00
Brian Anderson
b9b9b3e570 rt: Set the initial obstack size to 128 bytes
Double the size on each allocation
2011-12-25 19:18:05 -08:00
Graydon Hoare
3b61064631 Revert all of yesterday's snapshots and try again. Cursed! 2011-12-22 10:30:04 -08:00
Brian Anderson
dedfef4c4c Revert "wip"
This reverts commit aeadc6269e.
2011-12-20 20:57:04 -08:00
Brian Anderson
854daaec0c rt: Lock before using the random number generator
Seeing crashes here trying to stress test concurrent tasks
2011-12-20 20:56:06 -08:00
Brian Anderson
aeadc6269e wip 2011-12-20 20:15:09 -08:00
Brian Anderson
128621be97 rt: Remove rust_task::grow. Obsolete 2011-12-20 20:02:57 -08:00
Brian Anderson
cab4da70c8 rt: Don't check the stack canary on most upcalls 2011-12-20 16:50:54 -08:00
Brian Anderson
2a490d1cf8 Revert "rt: Reduce the mac red zone to 2K"
This reverts commit ba8f369f89.
2011-12-20 15:17:30 -08:00
Brian Anderson
ba8f369f89 rt: Reduce the mac red zone to 2K 2011-12-20 14:24:13 -08:00
Brian Anderson
2e230b1cf9 rt: Reduce the linux red zone to 2K 2011-12-20 14:02:59 -08:00
Brian Anderson
6443a7b513 rt: Do fewer stack canary checks 2011-12-20 13:54:47 -08:00
Brian Anderson
93fef2e113 rt: Parenthesize the red zone macros 2011-12-20 11:57:22 -08:00
Brian Anderson
784713ec68 rt: Add a canary value to the end of every stack
Check it on upcall entry and exit, and on stack deletion
2011-12-20 11:48:47 -08:00
Brian Anderson
56ec9cb278 rt: Run yet more task_start_wrapper cleanup on the C stack 2011-12-20 10:29:40 -08:00
Brian Anderson
25f7c844df rt: Don't reuse stack segments when they are not big enough 2011-12-19 22:47:28 -08:00
Brian Anderson
05bf105c90 rt: Rename asm_call_on_stack to __morestack
Newer gdb's will backtrace through functions named __morestack even
if they change the stack.
2011-12-19 22:05:40 -08:00
Brian Anderson
edf6e1ec0e rt: Zero the bottom frame's return address and base pointer
My reading of libunwind leads me to believe this is expected.

Closes #1322
2011-12-19 18:47:39 -08:00
Brian Anderson
1bfc4e2e6c rt: Save and restore %rax/%eax in __morestack
This doesn't matter now since we use an out pointer for return
values but it's sure to show up mysteriously someday.
2011-12-19 18:16:21 -08:00
Brian Anderson
c3569abb8c rt: Remove some unused stack from i386/morestack.S 2011-12-19 18:16:19 -08:00
Brian Anderson
d2e7336a01 rt: Remove unused saves from __morestack 2011-12-19 16:24:10 -08:00
Brian Anderson
50dc80f617 rt: Give upcall_new_stack the same convention as other upcalls 2011-12-19 16:24:10 -08:00
Brian Anderson
bedcaad97e rt: Give upcall_del_stack the same convention as other upcalls 2011-12-19 16:24:10 -08:00
Brian Anderson
bd6b80c972 rt: Get rid of the rethrow in upcall_fail
Throwing in upcall_fail ends up running lots of code in the red zone. To avoid
it we have the personality function figure out which stack it's on and switch
as needed.
2011-12-18 17:17:31 -08:00
Brian Anderson
c73eb8ff51 rt: Create different stack-switching paths for upcalls and shims
Shims need to play with the stack limit, upcalls don't. Only one upcall,
upcall_fail is allowed to catch, and we need a find a way to get rid of that
catch as well because it results in _Unwind_Resume running off the end of the
Rust stack.
2011-12-18 16:17:55 -08:00
Brian Anderson
f57fd8de1f rt: Run the cycle collector on the C stack 2011-12-18 15:23:44 -08:00
Brian Anderson
74d5faa86e rt: Give each platform its own red zone definition 2011-12-18 15:23:41 -08:00
Brian Anderson
762d7e43a6 rt: Trim the red zone to 20k on all platforms 2011-12-18 15:22:56 -08:00
Brian Anderson
3fa930f598 rt: Remove a bogus FIXME from ~rust_task 2011-12-18 02:09:41 -08:00
Brian Anderson
1a1fdf34b1 rt: Add lots of documentation to __morestack 2011-12-18 02:02:35 -08:00
Brian Anderson
7359fa422b Revert "rt: Turn on big stacks again. Unwinding still doesn't always succeed on mac"
This reverts commit 68f4849f0f.
2011-12-18 00:42:46 -08:00
Brian Anderson
68f4849f0f rt: Turn on big stacks again. Unwinding still doesn't always succeed on mac 2011-12-17 17:54:43 -08:00
Brian Anderson
fe683dfb80 rt: Get rid of the valgrind guard bytes at the end of the stack
Preventing us from writing beyond our allocations is _what valgrind does_,
so telling valgrind not to let us write to the end of the stack isn't
buying anything.
2011-12-17 16:46:50 -08:00
Brian Anderson
471b4d6e58 rt: Use a DWARF CFI scheme that works on mac in __morestack 2011-12-17 14:10:44 -08:00
Brian Anderson
7da8ab8fab rt: Turn on stack alignment checks for mac 2011-12-17 14:10:40 -08:00
Brian Anderson
4ac345939c rt: Cache an extra stack segment to avoid bad behavior at stack boundaries 2011-12-17 13:45:38 -08:00
Brian Anderson
0ed5117a9d rt: Set the default stack size to 768 bytes. Double on each alloc 2011-12-17 13:45:38 -08:00
Brian Anderson
b5b2ac0ec4 rt: Make 32-bit morestack compatible with fastcc 2011-12-16 18:18:43 -08:00
Brian Anderson
7d51961b6f rt: Fix saved address of unwinding %rsp in __morestack
I haven't thought too deeply about this, but I think I was telling the
unwinder to use the stack pointer for the wrong frame when unwinding. Not sure
how that could have worked at all, but this results in the correct alignment
for cleanups.
2011-12-16 18:18:43 -08:00
Brian Anderson
9d70c1949e rt: Fix alignment of the call to upcall_del_stack in __morestack 2011-12-16 18:18:43 -08:00
Brian Anderson
23df4de86d rt: Fix alignment of new stack segments 2011-12-16 18:18:43 -08:00
Brian Anderson
ab4f35c1f1 rt: Only call check_stack_alignment on linux 2011-12-16 18:18:43 -08:00
Brian Anderson
121c420184 rt: Insert stack alignment checks into upcalls 2011-12-16 18:18:43 -08:00
Elly Jones
89e880d613 std: file_is_dir -> path_is_dir, add path_exists 2011-12-16 17:37:21 -05:00
Niko Matsakis
88818334b7 update to not look at descs[], which is not necessarily valid
if the input is a statically allocated type_desc
2011-12-16 08:06:45 -08:00
Niko Matsakis
1e3259e119 massive refactor of how closures work 2011-12-15 13:44:06 -08:00
Niko Matsakis
35fe86dab7 export upcall_clone_type_desc 2011-12-14 14:32:25 -08:00
Niko Matsakis
f512e67fb9 clone type desc into exchange heap 2011-12-14 14:32:24 -08:00
Niko Matsakis
6a8cb704d9 get basic code generation working, clone type descs for lambda[send] 2011-12-14 14:32:20 -08:00
Brian Anderson
f0254e1e0d rt: Add a FIXME to 32-bit __morestack about trashing %eax 2011-12-13 19:13:17 -08:00
Brian Anderson
f332643e7f rt: Use %ecx instead of %eax during the second half of __morestack
If Rust code made use of return values then using %eax here would clobber it
2011-12-13 18:26:56 -08:00
Brian Anderson
32087f5c2a rt: Don't clobber fastcc argument registers in __morestack 2011-12-13 15:54:14 -08:00
Niko Matsakis
a98dec035f fix track alloc code 2011-12-12 18:25:17 -08:00
Brian Anderson
1c1bc2f1cd rt: Remove some duplicated code from 64-bit __morestack 2011-12-12 16:58:21 -08:00
Brian Anderson
887d970fee rt: Make unwinding through __morestack work on mac
Had to bump the min stack size in some of the tests from 256 bytes
to 1024 bytes. Not sure why yet.
2011-12-12 16:15:29 -08:00
Brian Anderson
3e32f6623c rt: Write CFI instructions that (might) work on mac in __morestack
The DW_CFA_val_offset_sf instruction doesn't seem to work on mac,
even after implementing it in the llvm-mc assembler, so now
I'm looking for a different way to communicate the stack pointer
adjustment to the unwinder.
2011-12-12 16:14:17 -08:00
Brian Anderson
7a8e73662d rt: Make unwinding through __morestack work on mac
Had to bump the min stack size in some of the tests from 256 bytes
to 1024 bytes. Not sure why yet.
2011-12-11 18:49:04 -08:00
Brian Anderson
7bc34f63d8 rt: Write CFI instructions that (might) work on mac in __morestack
The DW_CFA_val_offset_sf instruction doesn't seem to work on mac,
even after implementing it in the llvm-mc assembler, so now
I'm looking for a different way to communicate the stack pointer
adjustment to the unwinder.
2011-12-11 16:32:36 -08:00
Brian Anderson
b73caec3ce rt: Call upcall_fail on the C stack 2011-12-11 14:35:18 -08:00
Brian Anderson
5cd08586f6 rt: Add DWARF CFI info to asm_call_on_stack
This will allow the unwinder to unwind this function so we can call
upcall_fail on the C stack.
2011-12-11 14:35:09 -08:00
Brian Anderson
4699b6865f build: Use llvm-mc as our assembler
LLVM's assembler understands .cfi pseudo-ops on the mac, which we need in
order to generate frames that can be DWARF-unwound
2011-12-10 18:51:21 -08:00
Brian Anderson
9e6ff44d93 rt: Make __morestack work on win32 2011-12-08 16:47:33 -08:00
Brian Anderson
94b0fee6f1 rt: Reorganize and add documentation for rust_upcall.cpp 2011-12-07 18:50:23 -08:00
Brian Anderson
31fe5d0bd8 rt: Run most upcalls on the C stack 2011-12-07 18:50:23 -08:00
Brian Anderson
81f932e7d7 rt: Fix alignment of stacks generated by __morestack 2011-12-07 14:06:46 -08:00
Brian Anderson
9656ceac60 rt: Put 16 guard bytes at the end of the stack 2011-12-06 22:35:42 -08:00
Brian Anderson
5d1a1dc420 rt: Rename stk_seg.limit to stk_seg.end
rust_task is using the word limit it two ways, so one has to change.
2011-12-06 21:45:53 -08:00