Patrick Walton
a9b77a5011
rt: Remove the locks around upcall_shared_malloc and upcall_shared_free
2011-07-12 11:53:45 -07:00
Patrick Walton
eef61a527d
stdlib: Add addr_of() to the standard library
2011-07-11 14:25:35 -07:00
Patrick Walton
7efb942639
rt: Remove the now-unused upcall_ivec_resize and upcall_ivec_spill, which allocated from the wrong heap
2011-07-10 01:30:45 -07:00
Patrick Walton
d30f22eb65
rt: Remove the _2 prefix from intrinsics; all rust-intrinsics now use explicit return pointers
2011-07-10 01:20:18 -07:00
Patrick Walton
f42c94740a
rustc: Make rust-intrinsics take an explicit return pointer
2011-07-09 21:13:25 -07:00
Patrick Walton
e823ca4965
stdlib: Implement casts. The horror.
2011-07-09 20:14:47 -07:00
Patrick Walton
91d45b91e6
stdlib: Implement str::unsafe_from_bytes_ivec()
2011-07-08 22:23:11 -07:00
Patrick Walton
aa0f6f4961
stdlib: Add an offset function for simple pointer arithmetic on unsafe pointers
2011-07-08 21:56:15 -07:00
Eric Holk
d7db25e8f6
Added an environment variable to override the minimum stack size. Closes #637 .
2011-07-08 11:36:56 -07:00
Eric Holk
3958c72cd8
Some cleanup
2011-07-07 18:32:45 -07:00
Eric Holk
4739953b84
Fixed two races.
...
The first is that the memory_region destructor would complain there is
still an outstanding allocation. This is because circular_buffer from
rust_chan wasn't refing its task, so the task was being destructed too
soon.
The second was where the program could deadlock while joining a
task. The target task would die in the time between checking whether
the task should block and then actually blocking. The fix is to use
the target task's lock.
2011-07-07 18:22:27 -07:00
Eric Holk
f6e37f659c
Made TRACK_ALLOCATIONS add only constant time overhead. This makes it
...
feasible to turn it on and run rustc.
2011-07-07 18:22:27 -07:00
Eric Holk
5d9a5b7d55
Tightened up the scoping for our various new operators, which should
...
make it harder to use the wrong one.
2011-07-07 18:22:27 -07:00
Eric Holk
8acadb17c2
Work on debugging race conditions.
...
Ports and channels have been moved to the kernel pool, since they've
been known to outlive their associated task. This probably isn't the
right thing to do, the life cycle needs fixed instead.
Some refactorying in memory_region.cpp. Added a helper function to
increment and decrement the allocation counter. This makes it easier
to switch between atomic and non-atomic increments. Using atomic
increments for now, although this still does not fix the problem.
2011-07-07 18:22:27 -07:00
Eric Holk
dcd2563a3a
Removing the synchronized memory region from tasks.
2011-07-07 18:22:27 -07:00
Eric Holk
a0f45f4456
Removing most of the locks in rust_upcall.cpp and elsewhere.
2011-07-07 18:22:27 -07:00
Rob Arnold
f6117173c9
Allocate rust_ivec buffers out of the kernel pool
...
The duplication of upcalls is due to the fact that the runtime is
shared between stage0/rustc and stage1/rustc. Once snapshots are
updated, they should be de-duplicated.
2011-07-06 20:41:24 -07:00
Rob Arnold
2e2e1f7cb3
Add realloc method to rust_kernel
2011-07-06 20:37:27 -07:00
Patrick Walton
0391e14fc2
rt: Double stack size
2011-07-06 15:13:00 -07:00
Patrick Walton
91eb63eaee
rt: Add a stack check to upcall_get_type_desc
2011-07-06 15:07:04 -07:00
Eric Holk
111989a626
Removed what seems to be the last of the calls to rand(). Closes #582 .
2011-07-06 11:50:25 -07:00
Eric Holk
bc5d6aefda
Added a task wakeup callback. Closes #599 .
...
The callback happens when a task moves from the "blocked" state to the
"running" state. The callback is also inherited by child tasks. There
is currently only a native API.
This code hasn't been heavily exercised yet.
2011-07-06 11:30:00 -07:00
Patrick Walton
291df4d732
rt: Add missing CDECL to routines in rust_builtin
2011-07-05 14:29:14 -07:00
Rob Arnold
4e59b0be54
Sync rust_chan's deref() method with rustc's code.
...
If the channel is associated with a port then the destructor will assert.
Additionally, destruction of the object is not always appropriate. This brings
the deref() method into sync with the behavior of generated rust code which
only invokes destroy() once the reference count goes to 0.
2011-07-01 16:59:11 -07:00
Rob Arnold
02a5949aba
Add macro for refcounting runtime structures.
...
The macro with the extra dtor parameter is intended for structures like
rust_chan which may not necessarily delete themselves when the ref count
becomes 0. This functionality will be used in an upcoming changeset.
2011-07-01 16:59:10 -07:00
Rob Arnold
73cc624e8e
Move the channel destroy code into rust_chan.
...
This lets native code more easily destroy channels since directly deleting a
channel is not always the right way to destroy it.
2011-07-01 16:59:10 -07:00
Rob Arnold
09921cf86f
Move channel cloning logic into a method on rust_chan.
...
This will allow us to more easily clone channels from native code.
2011-07-01 16:59:10 -07:00
Patrick Walton
be50cdd24a
rt: Add room for the new fill slot when resizing interior vectors
2011-06-30 11:35:05 -07:00
Eric Holk
b4a145e60f
Added a nanosecond timer to time.rs, support for some floating point casts, and a commandline-driven mode for pfib.rs
2011-06-30 11:32:10 -07:00
Eric Holk
b3e5b5bd05
Added inheritance for task pinning. Closes #598 for real.
2011-06-29 18:56:34 -07:00
Eric Holk
63dcd325b9
Adding support for pinning tasks to the currently running thread. Closes #598 .
2011-06-29 18:47:47 -07:00
Graydon Hoare
c796a8f24d
Re-enable tidy (it was broken) and fix various non-tidy things.
2011-06-29 15:14:55 -07:00
Tim Chevalier
1ba85932b1
Add a runtime flag to enable/disable claims en masse
...
Now, if the environment variable CHECK_CLAIMS is set, then all
claims turn into checks. Otherwise, claims are no-ops.
2011-06-29 14:28:02 -07:00
Rafael Ávila de Espíndola
8c535d4aba
Don't enable ssp everywhere.
2011-06-29 16:25:54 -04:00
Patrick Walton
a2ce532337
rt: Remove the lock around upcall_vec_append. Add a test case. Closes #156 .
2011-06-29 10:33:51 -07:00
Patrick Walton
74f8eb51ae
rustc: Move duplicate_heap_parts to copy glue; add a test case
2011-06-28 17:59:30 -07:00
Patrick Walton
dfcfef41df
rustc: Rename take glue to copy glue
2011-06-28 16:52:59 -07:00
Eric Holk
866ee6ecb4
Re-enabling some tests.
2011-06-28 16:12:34 -07:00
Eric Holk
f6f8a06d6b
Resurrecting the runtime unit tests, and modifying them so they compile under the latest refactoring changes.
2011-06-28 16:12:34 -07:00
Eric Holk
657e5a2bd5
Renamed what's left of rust_dom to rust_scheduler
2011-06-28 16:12:33 -07:00
Eric Holk
02f6645fca
Moved win32_require to the kernel.
2011-06-28 16:12:33 -07:00
Eric Holk
2f84987a48
Fixed Win32 compile errors.
2011-06-28 16:12:33 -07:00
Eric Holk
49a8cb34d2
Removed dom_owned, splitting things between task_owned and kernel_owned. Had to re-xfail a few tests brson recently un-xfailed.
2011-06-28 16:12:33 -07:00
Eric Holk
f6f945fed5
Moved thread management to rust_kernel.
2011-06-28 16:12:33 -07:00
Eric Holk
c6d8324830
There is only one domain per kernel now.
2011-06-28 16:12:33 -07:00
Eric Holk
1c852ac9c0
Removing runtime tests. The runtime is tested well enough by the standard library tests, so we might as well have less code to fix during refactoring.
2011-06-28 16:12:33 -07:00
Michael Sullivan
99b4fff4d2
Properly handle the case where src==dst but we have to allocate a new vector.
2011-06-27 12:34:45 -07:00
Michael Sullivan
8ad7f3b56b
Properly handle the case where src==dst in upcall_vec_append.
2011-06-27 12:34:44 -07:00
Graydon Hoare
bc9fa31618
A little tidying in rt.
2011-06-27 10:08:57 -07:00
Eric Holk
022ebc198b
Implementation mising features in lock_and_signal for Win32. Also lowered the minimum stack size to get the pfib benchmark to run without exhausting its address space on Windows.
2011-06-27 09:58:39 -07:00
Eric Holk
681c063ec0
Conservatively serialize nearly all upcalls. Successfuly ran make check with RUST_THREADS=8, so we're probably fairly safe now. In the future we can relax the synchronization to get better performance.
2011-06-27 09:58:39 -07:00
Eric Holk
6367bcf427
Fixed a few concurrency bugs. Still not perfect, but overall it seems much more reliable.
2011-06-27 09:58:39 -07:00
Eric Holk
4d99bf9af2
Added some locking to ports to prevent the case where two threads simultaneously wake up a task blocked on a certain port.
2011-06-27 09:58:39 -07:00
Eric Holk
cb00befff0
Added an environment variable to control how many threads to use.
2011-06-27 09:58:39 -07:00
Eric Holk
4bc773465f
Basic multithreading support. The infinite loops test successfully maxes out the CPU.
2011-06-27 09:58:39 -07:00
Eric Holk
860e8fd98b
Combined set_registers and get_registers into swap_registers.
2011-06-23 20:23:04 -07:00
Eric Holk
98dee91f25
Wrote swap_context in assembly. Closes #548 . This also allows us to re-enable optimization on OSX for both gcc and clang. Also, re-enamed task-comm-1.rs, which was previously broken by optimization.
2011-06-23 18:49:29 -07:00
Eric Holk
a2dcd08cc2
Added string duplication to deep_copy. Closes #520 .
2011-06-20 13:47:02 -07:00
Patrick Walton
8cdef277b2
rt: Fix size miscalculation in ivec_reserve
2011-06-19 18:03:19 -07:00
Patrick Walton
5fb9325848
rustc: Fix a bunch of memory management bugs relating to generic interior vectors. Uncomment all tests in lib-ivec.
2011-06-17 17:31:24 -07:00
Eric Holk
7c57b8baf5
Updating rustrt.def.in so that the path manipulation functions work on OS X.
2011-06-17 15:53:20 -07:00
Eric Holk
a40116b398
stdlib: added getcwd and a convenience function to make relative paths absolute. This will be helpful for #441 .
2011-06-17 15:53:19 -07:00
Patrick Walton
982f51aa95
stdlib: Fix reserve on zero-length interior vectors; uncomment test_unsafe_ptrs()
2011-06-16 18:01:57 -07:00
Patrick Walton
40746fa447
rustc: Implement conversions from interior vector data to unsafe pointers and vice-versa
2011-06-16 17:07:02 -07:00
Patrick Walton
050f62983d
stdlib: Introduce an ivec module into the standard library; add a minimal test case
2011-06-16 16:08:26 -07:00
Eric Holk
6ed6791df4
Removing dead upcall_join. Closes #509 .
2011-06-16 12:23:13 -07:00
Michael Sullivan
bd8f6097a7
Get rid of old vec_append glue.
2011-06-16 11:58:29 -07:00
Patrick Walton
02c0501a61
rt: memory_region::free(NULL) shouldn't touch the live allocation count
2011-06-16 11:16:03 -07:00
Patrick Walton
f9da8b2676
rt: Add an ivec length intrinsic and an ivec reserve function, both untested as of yet
2011-06-16 10:32:52 -07:00
Eric Holk
67360ae618
Fixed a problem where spawn arguments were getting lost again. Also, fixed up stack alignment, which closes #496
2011-06-15 18:16:59 -07:00
Eric Holk
c4f9bd9470
Re-enabled join.
2011-06-15 18:16:59 -07:00
Eric Holk
02018fed42
Step 3 of cdecl conversion.
2011-06-15 16:04:39 -07:00
Eric Holk
92bd35075b
Step 2 of cdecl task transition.
2011-06-15 14:25:53 -07:00
Eric Holk
01ea27b205
Step 1 of moving task startup to always be cdecl.
2011-06-15 12:10:15 -07:00
Patrick Walton
ac743cfcb0
Merge pull request #490 from msullivan/fix_vec_append
...
Move the implementation of vec_append from llvm assembly to a regular upcall
2011-06-14 18:32:04 -07:00
Patrick Walton
c6be352f73
rustc: Implement on-heap resizing for interior vectors
2011-06-14 18:23:13 -07:00
Michael Sullivan
ccd1bcf7a7
Make tydesc glue functions use cdecl.
2011-06-14 16:09:21 -07:00
Michael Sullivan
95def699f1
Implement upcall_vec_append and use it for vector append.
2011-06-14 15:35:09 -07:00
Michael Sullivan
491d110645
Make type_desc fields have useful types and better names. Add in cmp_glue.
2011-06-14 15:35:08 -07:00
Patrick Walton
355c417267
rustc: Add some interior vector spill code, untested as of yet
2011-06-13 19:27:04 -07:00
Patrick Walton
c3bf7d07e9
rustc: Implement simple interior vector append translation
2011-06-13 18:57:25 -07:00
Eric Holk
d1857d30fc
This is the mega-ucontext commit. It replaces the task switching mechanism with a new one inspired by ucontext. It works under Linux, OS X and Windows, and is Valgrind clean on Linux and OS X (provided the runtime is built with gcc).
...
This commit also moves yield and join to the standard library, as requested in #42 . Join is currently a no-op though.
2011-06-13 18:14:13 -07:00
Graydon Hoare
a1bc2b17cc
Make darwin happy.
2011-06-10 18:32:38 -07:00
Graydon Hoare
603ad1748b
Fix printf flags.
2011-06-10 17:59:34 -07:00
Graydon Hoare
1d1010cac0
Move rt:: logging namespace to ::rt:: and implement RUST_LOG=? and RUST_LOG=::help as synonyms that dump the crate logging map. Also warn when some logging specs don't match.
2011-06-10 17:31:48 -07:00
Graydon Hoare
52c4c9014f
Encode meta tags in the crate and start sketching enhanced logic for resolving crate "use" directives.
...
Now with extra "works on OSX" kludging.
2011-06-10 12:57:29 -07:00
Erick Tryzelaar
501201a431
Remove executable bit from lock_and_signal.cpp.
2011-06-09 12:30:57 -07:00
Rafael Ávila de Espíndola
46920e073b
Remove hack now that stage0 doesn't use it.
2011-06-09 14:26:10 -04:00
Rafael Ávila de Espíndola
b1d6f12a05
Don't put a copy of main (the C one) in each binary we produce. This is a step
...
in getting a driver that works on all linux systems.
Sorry for the linker hacks, I will remove them after snapshotting a new compiler.
2011-06-07 16:56:27 -04:00
Rafael Ávila de Espíndola
cc96eeafca
Move rust_vec_append_glue to rt.
2011-05-31 14:32:08 -04:00
Rafael Ávila de Espíndola
697be84d61
Fix the bots.
2011-05-31 13:50:16 -04:00
Rafael Ávila de Espíndola
3dc6c3b737
Remove code that is now dead.
2011-05-31 13:38:10 -04:00
Rafael Ávila de Espíndola
e66f9e46f6
Start finishing up the rust_start signature transition.
2011-05-31 11:17:17 -04:00
Brian Anderson
973b93ee2a
rt: Use new module syntax for logging rt pseudo-modules
...
Now use RUST_LOG=rt::mem instead of RUST_LOG=rt.mem
2011-05-30 17:17:51 -04:00
Eric Holk
8cfc388d40
Switched calling conventions so that spawn with multiple arguments works.
2011-05-27 15:20:58 -07:00
Eric Holk
d49998f0ed
Switching over to wrappers for spawning functions of multiple arguments. Doesn't quite work yet.
2011-05-27 15:20:58 -07:00
Eric Holk
dad426419c
Working on 2 argument spawn. The arguments seem to be copied correctly once, but then they get lost.
2011-05-27 15:20:58 -07:00
Graydon Hoare
79c9e13073
More delicious dead code removal from runtime, upcalls.
2011-05-26 18:21:02 -07:00
Rafael Ávila de Espíndola
4c4a4aee91
Fix non linux bots.
2011-05-25 16:03:50 -04:00
Rafael Ávila de Espíndola
94129c4216
dead argument removal part one.
2011-05-25 15:33:57 -04:00