Commit Graph

1611 Commits

Author SHA1 Message Date
Chris Peterson
9a76d718c7 don't deplete RNG entropy when there is only one runnable task 2013-02-14 22:35:40 -08:00
Chris Peterson
9a78dc93db reseed rust_rng after generating 32KB 2013-02-14 22:33:12 -08:00
Chris Peterson
665e900ede encapsulate isaac RNG in rust_rng struct 2013-02-14 22:31:08 -08:00
Chris Peterson
f4320b6195 move isaac RNG utility functions to new rust_rng.cpp file 2013-02-14 22:30:27 -08:00
Chris Peterson
c531506385 rt: rand.rs expects rust_next() to return uint32_t, not size_t 2013-02-14 22:29:21 -08:00
bors
20fd0c53ed auto merge of #4938 : thestinger/rust/no_zero, r=brson
I removed the unused wrappers methods named `calloc` because they relied on the malloc wrapper having a `bool zero = true` default parameter (which resulted in some accidental zeroing). Perhaps wrapping the actual calloc function would be useful, but I don't know of an existing use case that could use it so I just removed these.

This gives an ~1% performance improvement for TreeMap, which does a lot of small allocations. Vectors use `realloc` which didn't zero before these changes so there's no measurable change in performance.
2013-02-14 18:27:54 -08:00
Daniel Micay
1a41b484bf rm the unused calloc wrapper from memory_region
it doesn't actually call calloc, so it's fairly pointless
2013-02-14 18:28:04 -05:00
Daniel Micay
2e0614750c get rid of unused exchange_alloc calloc method
this isn't actually calloc - it calls the malloc wrapper which no
longer zeroes
2013-02-14 18:24:52 -05:00
Daniel Micay
7103ca95ac rm unused zero param in C++ exchange allocator 2013-02-14 16:04:30 -05:00
Luqman Aden
2c198561dd rt: Fix alignment in debug_opaque 2013-02-13 15:41:38 -05:00
Luqman Aden
c22d0af14c rt: take into account alignment for debug_opaque. Closes #2667 2013-02-13 15:41:38 -05:00
Luqman Aden
d67e144f68 rt: get rid of rust_fn and replace with fn_env_pair plus a little cleanup. 2013-02-13 15:41:38 -05:00
bors
6016214101 auto merge of #4900 : luqmana/rust/core_os_errors, r=graydon
Rewrote the last pull request (#4859) to not require on llvm for core.

Also fixes #2269.
2013-02-12 21:27:22 -08:00
bors
bc2d147847 auto merge of #4858 : z0w0/rust/rm_weak_task_count, r=graydon 2013-02-12 14:36:33 -08:00
Luqman Aden
2180fe2552 rt: remove last_os_error from rustrt.def.in 2013-02-12 00:22:58 -05:00
Luqman Aden
70185fdcc2 rt: remove last_os_error and adjust tests. 2013-02-11 23:49:49 -05:00
Jeff Olson
dfcdb6eb72 rt/std: update of libuv API glue for libuv submodule update 2013-02-10 11:51:05 -08:00
Zack Corr
ebd20b7944 Rename dec/inc_weak_task_count to inc/dec_live_count and remove register_task/unregister_task. Closes #4768 2013-02-09 19:19:31 +10:00
Mark Vian
e2e474767e rt: remove unused 'rust_compare_and_swap_ptr'. Closes #4836 2013-02-08 18:19:36 -06:00
ILyoan
e7c6735e0d Fixed #1531 2013-02-08 14:11:00 +09:00
Brian Anderson
e43c5bdc6b Rewrite the exchange allocator to work without an active scheduler. #4457 2013-02-06 14:27:36 -08:00
Brian Anderson
e91040c704 Make foreign calls work outside of tasks. #4451 2013-02-06 14:27:34 -08:00
Brian Anderson
a8c8bfc7b5 rt: Add rust_try_get_current_task 2013-02-06 11:56:32 -08:00
Brian Anderson
8ebdb1a11b rt: Remove some unused upcalls 2013-02-01 21:58:33 -08:00
Brian Anderson
a50d1fdbda rt: Remove get_frame_glue_fns. Unused 2013-02-01 21:22:49 -08:00
Brian Anderson
02fbd5a164 rt: Remove circular_buffer 2013-02-01 21:22:49 -08:00
Brian Anderson
4f6516969e rt: Remove ports 2013-02-01 21:22:49 -08:00
ILyoan
8ec36d779b fix #2673: avoid visiting the same crate twice 2013-01-29 21:03:05 +09:00
Brian Anderson
1ef83945c1 Merge remote-tracking branch 'brson/nocommupstream'
Conflicts:
	src/libcore/private.rs
	src/libcore/task/mod.rs
	src/libcore/task/spawn.rs
	src/libstd/net_tcp.rs
	src/libstd/uv_global_loop.rs
	src/libstd/uv_iotask.rs
2013-01-25 18:06:30 -08:00
Brian Anderson
cc9ab2c033 Remove old comm-based weak task interface 2013-01-23 17:35:34 -08:00
Brian Anderson
b9608fe423 std: Convert uv_global_loop to use pipes 2013-01-23 17:35:34 -08:00
Brian Anderson
fb9299346a core: Convert getenv/setenv to use a mutex
This much simpler implementation uses a global mutex
and eliminates the kernel environment channel.
2013-01-23 17:35:34 -08:00
Brian Anderson
8852279a9e core: Add new weak task API 2013-01-23 17:35:31 -08:00
Brian Anderson
6b6acde972 Add a license check to tidy. #4018 2013-01-17 23:28:42 -08:00
Brian Anderson
db1abbec4c core: Add private global data interface. #3915 2013-01-17 19:24:50 -08:00
Brian Anderson
ac435af73a Add at_exit function #4450 2013-01-15 18:00:19 -08:00
Brian Anderson
090b247056 Spawn new tasks onto the primary scheduler by default. #3760 2013-01-15 18:00:19 -08:00
Brian Anderson
3d54187890 Win32 build fix 2013-01-13 16:43:39 -08:00
ILyoan
4fb4be8f17 More android support
Conflicts:
	Makefile.in
	cmakeFiles/rustllvm.cmake
2013-01-13 16:43:39 -08:00
kyeongwoon
987f824f23 Support ARM and Android
Conflicts:
	src/libcore/os.rs
	src/librustc/back/link.rs
	src/librustc/driver/driver.rs
	src/librustc/metadata/loader.rs
	src/librustc/middle/trans/base.rs
2013-01-13 16:43:39 -08:00
Brian Anderson
1b1700f44b Add core::private::run_in_bare_thread
This begins executing Rust code in a fresh context with no runtime environment
2013-01-11 14:53:28 -08:00
Brian Anderson
6a2e495d67 rt: Remove unused command line parsing 2013-01-09 15:26:15 -08:00
Brian Anderson
b43e639bf6 Remove unused bigint from runtime 2013-01-08 13:53:45 -08:00
Patrick Walton
6c18c75f2d rt: Stop zeroing out all allocations. Unobservable perf win. Closes #2682. rs=negligible-perf-win 2013-01-05 18:04:29 -08:00
Chris Peterson
e08f304b81 rt: Remove dead code from schedule_task() 2012-12-30 23:12:24 -08:00
Brian Anderson
7f8e302a6a Whitespace 2012-12-15 23:03:45 -08:00
Brian Anderson
20ea37b336 rt: Do some casting to avoid warnings 2012-12-15 22:38:20 -08:00
Brian Anderson
91067e9df4 Long lines 2012-12-15 22:38:20 -08:00
Jesse Jones
81805e0568 Check for oom in a few more places 2012-12-15 22:38:20 -08:00
Jesse Jones
0402360abb Abort instead of throwing on oom 2012-12-15 22:38:20 -08:00
Jesse Jones
e8d2d55900 Made a bunch more classes non-copyable 2012-12-15 22:38:20 -08:00
Jesse Jones
eca23da98b Instead of returning a bool (which everyone ignored) pop asserts 2012-12-15 22:38:20 -08:00
Jesse Jones
6bab226fc5 Check for realloc failure and bad subscripts 2012-12-15 22:38:20 -08:00
Jesse Jones
cf1c3d2da0 polymorphic indexed_list fixes:
1) indexed_list no longer has virtual methods. It's not actually subclassed
and there is very rarely good reason to subclass collection classes.
2) Added a virtual dtor to indexed_list_object which is intended to be
subclassed. This allows derived dtors to be called if the object is
deleted with a indexed_list_object*.
2012-12-15 22:38:20 -08:00
Jesse Jones
fc740a7297 Improvements to array_list, hash_map, and indexed_list:
* Disabled copying.
* Added const where appropiate.
2012-12-15 22:38:19 -08:00
Graydon Hoare
12c32e944d Add license boilerplate to more files. 2012-12-10 17:32:58 -08:00
Tim Chevalier
0027874218 Remove bogus FIXME, closes #2889 2012-12-06 16:14:54 -08:00
Graydon Hoare
00c856c0b1 Update license, add license boilerplate to most files. Remainder will follow. 2012-12-03 17:12:14 -08:00
Brian Anderson
aee0b767bc Add a FIXME about the problems closing /dev/urandom 2012-11-26 12:54:29 -08:00
Jesse Jones
065d642b15 Log errors from close instead of ignoring them.
They shouldn't matter but there have been errors on Macs so logging
them may help root cause the issue.
2012-11-26 12:54:29 -08:00
Jesse Jones
8adacc06aa Some isaac_ssed fixes:
1) Check for eof (shouldn't happen, but if it does we'll fall into an
infinite loop).
2) Use fatal instead of assert (will work if NDEBUG is ever defined
and provides better diagnostics).
3) Ignore errors from close since they shouldn't matter.

Closes #3679.
2012-11-26 12:54:29 -08:00
Brian Anderson
187c6c90a1 rt: Don't print backtraces unless the ::rt::backtrace log level is greater than log_err 2012-11-15 15:14:30 -08:00
Graydon Hoare
59a034a63f rt: bump log levels up by one, fix tautological-compare error (and permit turning off logging entirely). 2012-11-15 12:03:54 -08:00
Brian Anderson
53ec6c3f9b rt: Remove shape code 2012-11-05 15:22:35 -08:00
Brian Anderson
1b0c6665d9 Merge remote-tracking branch 'brson/repl'
Conflicts:
	mk/install.mk
	src/rt/rustrt.def.in
2012-11-04 13:42:39 -08:00
Brian Anderson
799eb105b9 Use a linenoise with win32 support 2012-11-04 13:34:14 -08:00
Zack Corr
ea996556b9 rusti: Remove linenoise module, add to rt, remove core::rl 2012-10-30 11:08:36 +10:00
Brian Anderson
759e1c165f rt: Remove unused string upcalls harder 2012-10-23 13:48:09 -07:00
Brian Anderson
8d932160d9 rt: Remove box annihilator 2012-10-23 12:14:46 -07:00
Brian Anderson
a469a3524d rt: Remove unused string upcalls 2012-10-23 12:14:45 -07:00
Luqman Aden
48582b360c Replace rust_atomic_increment/decrement and rust_compare_and_swap_ptr with intrinsics. 2012-10-21 22:43:28 -04:00
Brian Anderson
55e40a1674 Add new uv functions to rustrt.def.in 2012-10-20 17:41:34 -07:00
Luqman Aden
0e2437bf5d uv: implement a way to get client's ip/port. 2012-10-20 17:17:10 -07:00
Brian Anderson
2d5cac960d rt: Remove check_claims from the export list 2012-10-04 15:41:14 -07:00
Brian Anderson
738cd00f1d rt: Remove CHECK_CLAIMS 2012-10-04 14:10:45 -07:00
Graydon Hoare
365f174838 Attempt to fix os::args errors on various platforms. 2012-10-03 15:02:22 -07:00
Patrick Walton
9284179311 libstd: Switch off legacy modes in both core and std. 2012-10-02 12:20:06 -07:00
Brian Anderson
6bb0399df2 rt: Check the results of pthread calls
The stage0 compiler is not working on an x86_64 debian wheezy instance and it
looks like maye pthread_create is failing
2012-09-29 16:29:47 -07:00
Patrick Walton
f41c53667e rustc: Fix calls to the logging function when the must_cast flag is true; stop using shape code for logging 2012-09-25 14:56:17 -07:00
Patrick Walton
ee7fa194fa Revert "rustc: Stop using shape code for logging" due to ICEs
This reverts commit ac822a52be.
2012-09-25 12:17:05 -07:00
Patrick Walton
f813f519a5 rt: Remove the cycle collector 2012-09-25 12:13:20 -07:00
Patrick Walton
ac822a52be rustc: Stop using shape code for logging 2012-09-25 11:44:23 -07:00
Patrick Walton
dbc00ced3a rt: Add a logging function for strings (only).
This will be the shape-free replacement for upcall_log_type.
2012-09-24 20:26:06 -07:00
Patrick Walton
00e3492511 rt: Call the Rust box annihilator; stop calling the cycle collector
This reverts commit 991cbfe42c.
2012-09-24 20:25:56 -07:00
Patrick Walton
991cbfe42c Revert "rt: Call the Rust box annihilator; stop calling the cycle collector" due to crashes
This reverts commit bb0ad11252.
2012-09-24 14:14:03 -07:00
Patrick Walton
bb0ad11252 rt: Call the Rust box annihilator; stop calling the cycle collector 2012-09-24 13:57:48 -07:00
Patrick Walton
3c2b6110dd rustc: Shove the address of the box annihilator into the crate map 2012-09-21 11:42:57 -07:00
Philipp Brüschweiler
d3e0a06578 V2: now with more locks! 2012-09-19 14:01:53 -07:00
Philipp Brüschweiler
68e755b1c2 core: Allocate threads on demand, not on scheduler startup
API change: rust_kernel::create_scheduler() or
rust_scheduler::rust_scheduler() respecitevly now take ownership of the
launch factory argument, it is needed to create new threads on demand.

Also renames rustrt::sched_threads() to rustrt::rust_sched_threads() for
consistency. Added rustrt::rust_max_sched_threads() to return the
maximal number of scheduled threads of the current scheduler.

Fixes #3493.
2012-09-19 14:01:53 -07:00
Philipp Brüschweiler
62b51d9152 rt: Implement ThreadPerCore scheduling mode
Fixes #3465.
2012-09-13 20:48:33 +02:00
Elliott Slaughter
244b95490b gc: Refactoring. 2012-09-07 09:21:22 -07:00
Elliott Slaughter
8d17308eca rt: Add rust_gc_metadata to rustrt.def.in. 2012-09-07 09:21:22 -07:00
Elliott Slaughter
5637126449 rt: Fix GC metadata for 64-bit systems. 2012-09-07 09:21:22 -07:00
Elliott Slaughter
961bd48724 gc: Fix for GC missing stack frames across segment boundaries. 2012-09-07 09:21:22 -07:00
Elliott Slaughter
3f0d207b32 gc: Add stack walker for new garbage collector.
Safe points are exported in a per-module list via the crate map. A C
runtime call walks the crate map at startup and aggregates the list of
safe points for the program.

Currently the GC doesn't actually deallocate memory on malloc and
free. Adding the GC at this stage is primarily of testing value.

The GC does attempt to clean up exchange heap and stack-allocated
resource on failure.

A result of this patch is that the user now needs to be careful about
what code they write in destructors, because the GC and/or failure
cleanup may need to call destructors. Specifically, calls to malloc
are considered unsafe and may result in infinite loops or segfaults.
2012-09-07 09:21:21 -07:00
Niko Matsakis
5e36a99794 Refactor trans to replace lvalue and friends with Datum.
Also:
- report illegal move/ref combos whether or not ref comes first
- commented out fix for #3387, too restrictive and causes an ICE
2012-09-06 06:11:12 -07:00
Patrick Walton
d155410674 rt: Make the boxed region come earlier in the rust_task structure.
This is so that GC can find it more easily.
2012-09-05 20:08:00 -07:00
Brian Anderson
97bb812238 Add rust_annihilate_box to rustrt.def.in 2012-08-31 16:19:02 -07:00
Brian Anderson
a0de6b6d5f Merge remote-tracking branch 'erickt/incoming' 2012-08-31 16:14:18 -07:00
Elliott Slaughter
f022f566a4 rt: Fix box annihilator to deallocate exchange heap boxes properly. 2012-08-31 15:10:52 -07:00
Elliott Slaughter
f8323ac615 rt: Add interface to box annihilator. 2012-08-31 15:10:52 -07:00
Erick Tryzelaar
628b946186 libcore: rewrite str::reserve in pure rust. 2012-08-30 20:40:52 -07:00
Erick Tryzelaar
7bb65848a1 libcore: Rewrite str::unsafe::push_byte in pure rust. 2012-08-30 20:40:52 -07:00
Erick Tryzelaar
0e1a4a4da2 libcore: rewrite vec::unsafe::from_buf in pure rust 2012-08-30 20:40:52 -07:00
Jed Davis
b043349833 Fix MZ_FORCEINLINE define to work with GCC 4.7.1.
Using just __always_inline__ without inline results in several instances
of "error: always_inline function might not be inlinable".
2012-08-29 01:18:00 -07:00
Graydon Hoare
b769e29680 Compress metadata section. Seems a minor speed win, major space win. 2012-08-28 14:50:39 -07:00
Ben Blum
01866fae4e Document task shutdown protocol and justify its concurrency safety. Close #2696. Close bblum's internship. 2012-08-24 19:59:03 -04:00
Ben Blum
5ba7434cb1 Avoid lifecycle_lock traffic in call_on_rust_stack. (close #3270) 2012-08-24 18:28:26 -04:00
Michael Sullivan
dc107898b2 Fix logging code to not sign extend chars being printed in hex. 2012-08-23 12:48:08 -07:00
Michael Sullivan
5f32e18011 Make std::arena run destructors. Closes #2831. 2012-08-21 17:03:00 -07:00
Ben Blum
47cca22d54 Bypass lifecycle_lock in inhibit_kill/allow_kill for 3% to 5% speedup. Close #3213. 2012-08-21 18:03:41 -04:00
Ben Blum
a076c287de Fix issue-506.rs by adding a void-returning stub in the runtime (close #2957) 2012-08-16 21:07:55 -04:00
Ben Blum
bdbad614ac Remove rust_cond_lock and sys::condition (rename to little_lock) 2012-08-07 18:18:48 -04:00
Eric Holk
9f287c211e Refcount tasks in packets to avoid races.
Revert "Once again, revert "Use pipes in compiletest""

Fixes #3098
2012-08-06 09:10:19 -07:00
Eric Holk
86947e47ad More documentation on pipes, and moving assert in runtime. 2012-08-06 09:07:40 -07:00
Ben Blum
4174de8bb9 rt: expose rust_task refcounts to rustland 2012-08-03 21:00:23 -04:00
Eric Holk
01ca0d1f68 Be more defensive in pipes (#3098) 2012-08-03 12:04:18 -07:00
Eric Holk
ce6d6511c7 Set thread name on Mac to make gdb thread info more useful. 2012-08-02 19:26:33 -07:00
Ben Blum
7cb3f3e86a Linked failure: enable unidirectional propagate test; replace FIXMEs with comments (tag #1868). 2012-08-01 23:08:06 -04:00
Lindsey Kuper
439afaa329 Change remaining "iface" occurrences to "trait"; deprecate "iface" 2012-07-31 11:52:16 -07:00
Ben Blum
60d682b577 Fix asserts & short-read bug in isaac_seed (#2870) 2012-07-25 18:03:00 -04:00
Ben Blum
729c37f3cc (minor) remove config_notify from rustrt.def.in 2012-07-25 13:29:50 -04:00
Ben Blum
8d43724087 minor rt cleanup 2012-07-25 13:24:00 -04:00
Ben Blum
c68f2d9aab Remove notification channels in runtime (closes #1078) 2012-07-25 13:22:43 -04:00
Ben Blum
695ab09899 Change yield() and wait_event() to be MUST_CHECK and return the killed flag. (closes #2875) 2012-07-24 18:24:24 -04:00
Ben Blum
2040a5c632 tiny runtime cleanup 2012-07-24 17:35:08 -04:00
Ben Blum
f42a5a1acd Remove unsupervise 2012-07-24 17:31:43 -04:00
Ben Blum
ae094a7adc Add 'do atomically { .. }' for exclusives 2012-07-24 15:28:35 -04:00
Elliott Slaughter
66e5a8ca18 Add rustrt wrapper functions to export list. 2012-07-23 12:21:41 -07:00
Elliott Slaughter
d257382863 Moved malloc and free upcalls into rust runtime. 2012-07-23 10:45:58 -07:00
Elliott Slaughter
de82a9be61 Move fail upcall into rust libcore. 2012-07-23 10:45:58 -07:00
Ben Blum
3dc52da989 [4/4 for #2365, #2671] Reassign one last fixme to #908. Close #2365. Close #2671. 2012-07-20 19:23:19 -04:00
Ben Blum
af7b769465 [3/4 for #2365, #2671] Fix exit/kill race with scheds during rust_kernel::fail 2012-07-20 19:23:19 -04:00
Ben Blum
18c645a883 [2/4 for #2365, #2671] Fix exit/kill race with tasks during rust_kernel::fail 2012-07-20 19:23:19 -04:00
Ben Blum
5bb4a12900 [1/4 for #2365, #2671] Fix create/kill race with schedulers and tasks during rust_kernel::fail 2012-07-20 19:23:19 -04:00
Ben Blum
4cf6b4d3b4 Tasks should not hold a ref to their parent (Close #1789) 2012-07-17 20:45:07 -04:00
Michael Sullivan
aa5b5ab886 Create some infrastructure for building up @-vectors. Work on #2921. 2012-07-17 17:09:25 -07:00
Ben Blum
1f2ee4b384 Oops, switch more TODOs to FIXMEs 2012-07-13 20:33:08 -04:00
Ben Blum
cd38377b1b Add asserts to check fail_sched_loop() only once 2012-07-13 20:13:53 -04:00
Ben Blum
d338879ba5 Reintroduce linked failure (killing runtime)
This reverts commit 5724c64549.
2012-07-13 20:13:53 -04:00
Ben Blum
62575d9c4a Reintroduce linked failure (rust_port locking)
This reverts commit a10f52c579.
2012-07-13 20:13:53 -04:00
Ben Blum
aad184cc57 Reintroduce linked failure (renaming runtime fns)
This reverts commit 3b159c6d5b.
2012-07-13 20:13:53 -04:00
Ben Blum
79a2e9a38a Reintroduce linked failure (lifecycle lock)
This reverts commit 08c40c5eb7.
2012-07-13 20:13:53 -04:00
Ben Blum
df2d2604ca Reintroduce linked failure
This reverts commit acb86921a6.
2012-07-13 20:13:53 -04:00
Tim Chevalier
81ecd272d3 Comments only: TODOs to FIXME in the runtime 2012-07-12 19:06:08 -07:00
Graydon Hoare
18da7fef88 Merge remote-tracking branch 'origin/dist-snap' into incoming 2012-07-12 17:14:55 -07:00
Ben Blum
acb86921a6 Revert linked failure
This reverts commit 5d6d3d0565.
2012-07-12 19:49:49 -04:00
Ben Blum
08c40c5eb7 Revert linked failure (lifecycle lock)
This reverts commit 74f4b8d901.
2012-07-12 19:49:49 -04:00
Ben Blum
3b159c6d5b Revert linked failure (renaming runtime fns)
Revert "Rename runtime *_locked() and *_unlocked() fns to *_inner() (closes #2864)"

This reverts commit b897696a3a.
2012-07-12 19:49:49 -04:00
Ben Blum
a10f52c579 Revert linked failure (rust_port locking)
This reverts commit 343e9de8ef.
2012-07-12 19:49:49 -04:00