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
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