Erick Tryzelaar
b199e9da92
Expose STDERR to rust.
2011-08-31 20:40:00 -07:00
Marijn Haverbeke
b099b1e3f7
Make std::istr::push_byte efficient
...
It used to allocate two (!) heap values per pushed byte. It now goes through
a runtime function that simply grows the istr and writes the byte.
2011-08-29 22:46:49 +02:00
Marijn Haverbeke
14567c5eb0
Factor vector reserve code in runtime into its own function
2011-08-29 22:35:29 +02:00
Marijn Haverbeke
c9c5ee252a
Implement non-internal ivecs
...
Vectors are now similar to our old, pre-internal vectors, except that
they are uniquely owned, not refcounted.
Their name should probably change too, then. I've renamed them to vec
in the runtime, will do so throughout the compiler later.
2011-08-29 09:07:53 +02:00
Patrick Walton
d0171913aa
rt: Remove rustboot's GC infrastructure
2011-08-19 19:17:05 -07:00
Brian Anderson
0467fa6a00
Rename rust_vec to rust_evec
2011-08-18 14:43:17 -07:00
Eric Holk
ae89ea223d
Making more of the rust_task structure directly accessible from Rust.
2011-08-17 14:42:40 -07:00
Eric Holk
cf2def46c1
Removed trans_comm.rs from the compiler. Updating aio/sio to work with the new chan and port system, started on a networking module for the standard library.
2011-08-16 09:36:29 -07:00
Eric Holk
d63f8340a5
Properly ref counting to fix valgrind issues on linux.
2011-08-15 09:26:52 -07:00
Eric Holk
b9f1f77622
Fixed memory accounting and task stack creation bugs.
2011-08-15 09:26:51 -07:00
Eric Holk
2f23405a60
Working on more spawn test cases.
2011-08-15 09:26:51 -07:00
Eric Holk
b2dad8af31
Added a library version of spawn. Before long, we can remove the old version.
2011-08-15 09:26:51 -07:00
Eric Holk
39b16077bb
Port ID-based channels.
2011-08-15 09:26:51 -07:00
Brian Anderson
4fc0848a49
Rename rust_list_files_ivec to rust_list_files
2011-08-12 12:14:07 -07:00
Brian Anderson
8561f7654c
Remove rust_list_files from std and rt
2011-08-12 12:14:07 -07:00
Brian Anderson
d1b3ed8c3f
Remove runtime vector builtins
2011-08-12 12:14:07 -07:00
Brian Anderson
878fbac278
Remove str_from_vec runtime function
2011-08-12 12:08:27 -07:00
Brian Anderson
2e7e58812b
Remove vec version of str::bytes, rename bytes_ivec to str::bytes
2011-08-12 12:08:26 -07:00
unknown
44bef5f2cb
Introduced task handles.
...
This is the new way to refer to tasks in rust-land. Currently all they
do is serve as a key to look up the old rust_task structure. Ideally
they won't be ref counted, but baby steps.
2011-08-08 16:55:38 -07:00
Eric Holk
d9b84a546c
Converted the rest of the task-comm-* tests over. Also fixed some
...
channel lifecycle bugs.
2011-08-08 08:57:52 -07:00
Eric Holk
b62e80c1f0
Atomic ref counting for chans.
2011-08-05 15:27:28 -07:00
Eric Holk
939bca0d84
Added send and receive to comm library.
2011-08-01 15:58:39 -07:00
Eric Holk
b3d9d9b73c
Objectified library chans and ports.
2011-08-01 15:58:30 -07:00
Eric Holk
5a673cc2c9
Started working on a library-based comm system. Creating and deleting ports work.
2011-08-01 15:58:30 -07:00
Brian Anderson
9dbe6941c4
Add sched_threads rt function to get the number of scheduler threads
2011-07-29 21:03:17 -07:00
Brian Anderson
4ef1ec580a
Do all runtime calls to getenv at initialization
...
getenv is not threadsafe and (maybe as a result) it's randomly crashing with
CFLAGS=-g and RUST_THREADS=32. Calls from rust code are still on their
own.
2011-07-28 12:23:01 -07:00
Eric Holk
e697a52359
Adding a function to stdlib to set the min stack size, for programs
...
that absolutely will not succeed with a large default stack. This
should be removed once we have stack grown working.
Also updated word-count to succeed under the new test framework.
2011-07-28 10:47:28 -07:00
Marijn Haverbeke
73e8e49897
More thorough check for interior-ness in str_from_ivec
...
Closes #750
2011-07-27 21:46:14 +02:00
Eric Holk
8878b128ba
More work on word-count.
...
Updated the MapReduce protocol so that it's correct more often. It's
still not perfect, but the bugs repro less often now.
Also found a race condition in channel sending. The problem is that
send and receive both need to refer to the _unread field in
circular_buffer. For now I just grabbed the port lock to send. We can
probably get around this by using atomics instead.
2011-07-22 18:45:34 -07:00
Eric Holk
3ae4dcd41e
Lots of work on memory tracking and channels.
...
We're trying to get closer to doing correct move semantics for channel
operations. This involves a lot of cleanup (such as removing the
unused sched parameter from rust_vec constructor) and making
circular_buffer kernel_owned.
Added tagging for memory allocations. This means we give a string tag
to everything we allocate. If we leak something and TRACK_ALLOCATIONS
is enabled, then it's much easier now to tell exactly what is leaking.
2011-07-21 11:51:22 -07:00
Brian Anderson
a467e8e4e6
Add a huge hack to allow the test runner to continue if a single task leaks
...
This is just until unwinding works. Adds a flag to the runtime to turn
the memory leak checks on task destruction into warnings instead of fatal
errors. I am so sorry.
Issue #428
2011-07-20 10:22:18 -07:00
Brian Anderson
652214d7f9
Fix calculation of sizeof boxed ivec of str in rt. Closes #712
2011-07-19 16:55:45 -07:00
Brian Anderson
20a3adbc08
Revert "Add setenv to standard library"
...
This reverts commit 6fb168b3db
.
2011-07-17 19:16:18 -07:00
Brian Anderson
6fb168b3db
Add setenv to standard library
2011-07-17 18:50:01 -07:00
Brian Anderson
7d475530a0
Remove task_unsupervise from rt builtin functions
...
This was an exact duplicate of the unsupervise function
2011-07-15 10:07:32 -07:00
Brian Anderson
ced8393f20
Modify task::join to indicate how the task terminated
...
This involves sticking yet another field into the task structure
2011-07-15 10:07:29 -07:00
Brian Anderson
01a52d728c
Add an unsupervise builtin and function to std::task
...
Calling task::unsupervise de-parents the current task, with the result
that failures do not propogate up the task tree.
2011-07-14 17:56:59 -07:00
Graydon Hoare
39151f2ad8
Prohibit trailing whitespace under 'tidy' script. Clean up all caught cases.
2011-07-13 15:44:09 -07:00
Graydon Hoare
d39f84d8ec
Trim a few more fail(1)s, not sure how they slipped past.
2011-07-13 14:04:38 -07:00
Graydon Hoare
2e2951305d
Remove obsolete nargs counts from runtime.
2011-07-13 13:43:35 -07:00
Graydon Hoare
01fc165517
Attempt to correct buggy win32 timer code (causing tinderbox failures).
2011-07-13 12:25:36 -07:00
Patrick Walton
598b50e10a
stdlib: Move fs over to interior vectors by introducing a rust_list_files_ivec builtin
2011-07-12 15:14:57 -07:00
Patrick Walton
91d45b91e6
stdlib: Implement str::unsafe_from_bytes_ivec()
2011-07-08 22:23:11 -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
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
Patrick Walton
291df4d732
rt: Add missing CDECL to routines in rust_builtin
2011-07-05 14:29:14 -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
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
Eric Holk
657e5a2bd5
Renamed what's left of rust_dom to rust_scheduler
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
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
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
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
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
c4f9bd9470
Re-enabled join.
2011-06-15 18:16:59 -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
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
Brian Anderson
e35984b6c6
Introduce str_slice runtime function
...
This reduces the time to execute the new lib-str tests from 1:40ish to a few
seconds and will eventually allow the full lib-sha1 test to run in a
reasonable amount of time. XFAIL lib-str in stage0 - it will run very slowly
until the next snapshot.
2011-05-11 01:38:16 -04:00
Patrick Walton
5d3e553141
stdlib: Add a Time module to the standard library
2011-04-29 11:54:06 -07:00
Patrick Walton
180a389832
stdlib/rt: Add an unsafe function to cast immutable vectors to mutable ones
2011-04-27 18:14:56 -07:00
Graydon Hoare
4c7886de80
Fix _str.bytes to trivial version.
2011-04-27 13:06:19 -07:00
Patrick Walton
735435bf96
stdlib: Add a pointer equality function to the standard library and a test case
2011-04-21 16:44:17 -07:00
Marijn Haverbeke
880be6a940
Overhaul logging system in runtime
...
See https://github.com/graydon/rust/wiki/Logging-vision
The runtime logging categories are now treated in the same way as
modules in compiled code. Each domain now has a log_lvl that can be
used to restrict the logging from that domain (will be used to allow
logging to be restricted to a single domain).
Features dropped (can be brought back to life if there is interest):
- Logger indentation
- Multiple categories per log statement
- I possibly broke some of the color code -- it confuses me
2011-04-19 16:57:13 +02:00
Marijn Haverbeke
9a7576fe2c
Move to macro-based logging checks in the C++ code
...
No functions should be called for log statements that turn out to be
inactive.
2011-04-07 15:15:30 -07:00
Marijn Haverbeke
a045514477
Start making the standard-lib utf-8 aware
...
Finally implements _str.is_utf8, adds from_chars, from_char, to_chars,
char_at, char_len, (push|pop|shift|unshift)_char. Also, proper
character I/O for streams.
2011-03-25 08:22:52 -07:00
Graydon Hoare
0f9d460e24
Placate win32 build; no idea how it can be working currently on tinderbox.
2011-03-25 00:16:04 -07:00
Lindsey Kuper
bcc104ce79
A first stab at the 'nbody' demo, with support for calling C sqrt().
2011-03-25 00:15:56 -07:00
Patrick Walton
af3d0d1848
rustc: Open "use"d crates; add a _vec.vec_from_buf() method along the way; XFAIL use-import-export.rs in rustc
2011-03-24 17:22:07 -07:00
Patrick Walton
368eb4bab6
Add some mutable variants of vector functions to the standard library
2011-03-18 13:53:49 -07:00
Patrick Walton
ea7197e2cf
rustc: Add str_from_cstr() and str_from_buf() functions to the standard library, as well as a test case
2011-03-16 18:42:08 -07:00
Marijn Haverbeke
ea5dc54c3f
Add functionality for running external programs to the std lib
...
See lib/run_program.rs.
2011-03-14 14:57:13 -07:00
Marijn Haverbeke
441697ab35
Extend stream functionality
...
Writer and reader streams now come with methods to write and read
little-endian numbers. Whether that is the right place for such
methods is debatable, but for now, that's where they live.
2011-03-14 14:57:13 -07:00
Marijn Haverbeke
c731d625fe
Add basic file-system functionality
...
std.fs.list_dir will list the files in a directory, std.fs.file_is_dir
will, given a pathname, determine whether it is a directory or not.
2011-03-14 14:57:13 -07:00
Graydon Hoare
fe1a4ab23c
Change log buffer butes to a symbolic const in runtime.
2011-01-14 13:41:39 -08:00
Graydon Hoare
c0d4e88428
Add std.dbg.trap(str msg) for help debugging.
2010-12-31 10:35:39 -08:00
Graydon Hoare
89946609f2
Support a special const-value refcount, use it for const strings.
2010-11-09 14:15:07 -08:00
Graydon Hoare
da13c508d8
First pass on splitting stratum and opacity off of effects. WIP.
2010-11-02 11:11:58 -07:00
Graydon Hoare
2e0d075407
Fix bug in bind thunks failing top drop unbound args; add test and adjust rustc to use bind again.
2010-09-30 17:39:37 -07:00
Roy Frostig
cf62b54028
Add a little pointer-cast helper to dbg.
2010-09-06 23:24:01 -07:00
Roy Frostig
7ccdb88374
Add support in dbg.debug_obj for printing the obj body.
2010-08-24 19:49:39 -07:00
Roy Frostig
d9e3fb2c5d
Add std.dbg module for inspecting rust values in memory.
2010-08-24 18:37:42 -07:00
Roy Frostig
4a7aa75b5d
Make _io.buf_reader read more than 0 bytes at a time.
2010-08-19 17:37:22 -07:00
Michael Bebenita
2c1ec6771b
Lots of changes around memory managment in the Runtime. Added memory regions and fixed race caused by calling rust_srv::malloc() from multiple threads when sending messages.
2010-08-17 23:49:57 -07:00
Roy Frostig
73ee16b1a4
A little tidy-up that should have gone in with 4e376852e7
.
2010-08-12 19:20:29 -07:00
Roy Frostig
445d3fe39c
Add vec debugging utility to _vec module.
2010-08-12 13:11:49 -07:00
Michael Bebenita
988695a96c
Added support for task sleeping in the scheduler.
2010-08-11 21:24:04 -07:00
Roy Frostig
22719e45b8
Remove commented-out code that slipped in during last commit.
2010-08-11 16:10:44 -07:00
Roy Frostig
f307688bf4
Add native vec[u8] to str converter. Put in workaround for leak in str to vec[u8] converter. Add testcase exercising both. Drive-by fix a potential array-out-of-bounds write on rust_str buffers.
2010-08-11 16:06:45 -07:00
Jeffrey Yasskin
3f6e8ffe64
Implement _str.len() to return the number of bytes, rename it to byte_len(),
...
and add a test.
2010-08-06 17:29:21 -07:00
Roy Frostig
1a8d609e89
Add a buffered writer to stdlib _io module.
2010-08-04 12:59:48 -07:00
Roy Frostig
085cd2ee7d
vec_alloc takes four arguments these days, not three.
2010-07-25 22:21:07 -07:00
Roy Frostig
5b6e714d05
Expose an RNG (the one used by our runtime) to Rust via std.
2010-07-25 21:45:09 -07:00
Roy Frostig
1730d2e037
Notify copy glue of dst-initialization and fix _vec.alloc issues in lib and runtime. Closes #109 .
2010-07-22 17:47:32 -07:00
Michael Bebenita
00d1465d13
Added a message passing system based on lock free queues for inter-thread communication. Channels now buffer on the sending side, and no longer require blocking when sending. Lots of other refactoring and bug fixes.
2010-07-19 14:05:18 -07:00
Graydon Hoare
b1eeb9b825
Change from 'spawner' to 'supervisor' in rust_task, and add an unsupervise call.
2010-07-05 14:43:40 -07:00
Graydon Hoare
fdf2eaac91
Divide vec fill by element size when reporting vec len.
2010-07-05 14:40:01 -07:00
Graydon Hoare
7ea416f4c3
Add callable gc method exposed to user code, use it in mlist-cycle.rs test (still not quite working; some memory corruption in the recursive tag constructors, not the GC)
2010-06-25 23:57:30 -07:00
Graydon Hoare
d6b7c96c3e
Populate tree.
2010-06-23 21:03:09 -07:00