Commit Graph

6820 Commits

Author SHA1 Message Date
Marijn Haverbeke
8e2b5de90e Fix typo in tutorial 2011-11-21 13:20:02 +01:00
Stefan Plantikow
2524636dbd std: declared fns in math to be pure; requires calling libc via unsafe 2011-11-21 13:00:00 +01:00
Stefan Plantikow
68839c3dda Added logarithm functions for floats to std::math
Thanks to marijn for helping with #[link_name]
2011-11-21 12:59:59 +01:00
Marijn Haverbeke
a6b2a2cdb1 Separate vec::map and vec::map_mut
The safe-reference checker requires a copy of each mapped-over element
only when the vector is mutable. Let's not pay that cost for immutable
vectors.
2011-11-21 12:07:41 +01:00
Marijn Haverbeke
12f6e868f7 Add explanation of kinds to tutorial 2011-11-21 12:07:41 +01:00
Marijn Haverbeke
02574a5bdb Close hole in safe-reference analysis 2011-11-21 12:07:40 +01:00
Marijn Haverbeke
b4217b383b Add a pass that checks that blocks are only used in safe ways
Closes #1188
2011-11-21 11:01:15 +01:00
Marijn Haverbeke
86c1f16a10 Fix bad interaction between last-use finding and references
The last-use pass now takes input from the alias pass to not mark things
as last uses that are still accessed through a reference.

Issue #925
2011-11-21 09:25:42 +01:00
Stefan Plantikow
ff04cb1eb0 Added a little sudoku solver to test/bench for everone's puzzle solving needs 2011-11-20 01:53:12 +01:00
Brian Anderson
134f7b7611 .gitignore a bunch of artifacts of in-tree builds 2011-11-19 13:49:49 -08:00
Stefan Plantikow
25b44a8973 Added CFG_NOTIDY flag to the build
This should allow a small speedup for test builds; unset by default
2011-11-18 21:19:18 -08:00
Niko Matsakis
b6af844f3a re-enable tests for #1058 and #1059 2011-11-18 16:32:19 -08:00
Niko Matsakis
12a67af81d add test for issue #1174 2011-11-18 16:32:19 -08:00
Niko Matsakis
9fa44a41e6 get pure wrappers approach running 2011-11-18 16:32:19 -08:00
Niko Matsakis
6072ddad33 sketch out design 2011-11-18 16:32:19 -08:00
Brian Anderson
d6ab8ebb07 rt: Add more comments to rust_task_sleep 2011-11-18 16:02:48 -08:00
Brian Anderson
9aa67052e1 rt: Remove some stack-wasting macros from rust_task::yield 2011-11-18 15:59:10 -08:00
Brian Anderson
71bcba6815 intrinsics: Remove declaration of port_recv 2011-11-18 15:37:14 -08:00
Brian Anderson
1e58049da2 rt: Remove fail calls from rust_task::yield 2011-11-18 15:36:48 -08:00
Brian Anderson
792068d871 rt: Remove unblock call from rust_task::yield 2011-11-18 14:45:48 -08:00
Brian Anderson
0f339b481a rt: Remove a lock from task_start_wrapper that does nothing 2011-11-18 13:38:20 -08:00
Brian Anderson
3cfcdb4bb2 rt: Replace two uses of yield with ctx->swap
These uses aren't really doing a full yield. They are just giving up control
to the scheduler and will never return.
2011-11-18 13:38:18 -08:00
Brian Anderson
57b43b53f9 rt: Add comments to rust_task::yield 2011-11-18 13:28:12 -08:00
Brian Anderson
d1ef29ab37 rt: rust_task::conclude_failure doesn't need to call unblock 2011-11-18 13:23:27 -08:00
Brian Anderson
3a6320f71b intrinsics: Eliminate recv intrinsic
This intrinsic existed just to get ahold of the return pointer. I replaced it
with a call_with_retptr intrinsic that grabs the return pointer and passes it
to another Rust function, thereby eliminating the need to call C functions on
the Rust stack.
2011-11-18 12:48:54 -08:00
Brian Anderson
93931311ff rt: Add FIXMEs about races in rust_task 2011-11-18 10:32:27 -08:00
Brian Anderson
0dfa1410d3 rt: Remove task::on_wakeup. Unused 2011-11-18 10:32:27 -08:00
Brian Anderson
63d40b8ab6 rt: Remove some unnecessary setting of rust_task::killed
The value of this variable doesn't matter after the task fails.
2011-11-18 10:32:27 -08:00
Brian Anderson
d52888f0ba rt: Remove rust_task::yield. Unused 2011-11-18 10:32:27 -08:00
Brian Anderson
5e9f9e8c48 rt: Add some comments about methods that run on the Rust stack 2011-11-18 10:32:27 -08:00
Brian Anderson
21865ddce6 intrinsics: Remove the call to get_task from task_sleep 2011-11-18 10:32:27 -08:00
Brian Anderson
eecbc815ac intrinsics: Add some comments 2011-11-18 10:32:27 -08:00
Brian Anderson
3feaecd757 intrinsics: Move the call to upcall_fail out of rust_intrinsic_cast 2011-11-18 10:32:27 -08:00
Brian Anderson
44aebb978c Add tests for unsafe::reinterpret_cast 2011-11-18 10:32:27 -08:00
Brian Anderson
9ca2005959 rt: Remove size_of and align_of functions. Now written in Rust 2011-11-18 10:32:27 -08:00
Brian Anderson
a9f7cbe240 stdlib: Add tests for sys::size_of and sys::align_of 2011-11-18 10:32:27 -08:00
Brian Anderson
1f74af505f stdlib: Add some useful fields to the definition of type_desc 2011-11-18 10:32:27 -08:00
Marijn Haverbeke
0e21df4610 Add some comments to kind.rs and last_use.rs 2011-11-18 17:09:36 +01:00
Marijn Haverbeke
8cf3ca3b55 Make sure by-copy arguments take last-use into account 2011-11-18 16:43:30 +01:00
Marijn Haverbeke
1cccefd8bb Register snapshot, finishing kind system transition
Closes #1177
2011-11-18 16:17:37 +01:00
Marijn Haverbeke
a7573af59d Add some tests for new kind system
Issue #1177
2011-11-18 16:15:46 +01:00
Marijn Haverbeke
196b2b920f Make sure trans translates record fields in the order they appear in code
This prevents surprising side-effect orders, and makes them easier for
the other passes to deal with.
2011-11-18 15:59:47 +01:00
Marijn Haverbeke
68db68c4cc Make trans use last_use info to not actually generate copies
Issue #925
2011-11-18 15:56:53 +01:00
Marijn Haverbeke
f6491bb426 Update stdlib, compiler, and tests to new kind system
This involved adding 'copy' to more generics than I hoped, but an
experiment with making it implicit showed that that way lies madness --
unless enforced, you will not remember to mark functions that don't
copy as not requiring copyable kind.

Issue #1177
2011-11-18 12:49:01 +01:00
Marijn Haverbeke
8f8ebb550c Implement a last-use-of-local finding algorithm
Issue #925
2011-11-18 12:49:01 +01:00
Marijn Haverbeke
0c97fcbf66 Properly check kinds in instantiation of generics
Issue #1177
2011-11-18 12:49:01 +01:00
Marijn Haverbeke
7bef89f9b5 Prevent alias pass from inserting implicit copies for noncopyable types
Issue #1177
2011-11-18 12:49:01 +01:00
Marijn Haverbeke
17b78c4a7a Overhaul the kind-checking pass
Not really useful yet because missing last-use-of-local optimization.

Also: instantiation of type parameters needs to be checked.

Issue #1177
2011-11-18 12:49:01 +01:00
Marijn Haverbeke
cefff237bf Make tag, resource and object constructors take their arguments by copy
Doing something like some([1, 2, 3]) will now no longer create a temporary
copy of the vector. It will also be easier for the kind checker to see that
putting a resource into a data-structure constructor is safe.
2011-11-18 12:49:01 +01:00
Marijn Haverbeke
4e03112141 Add a pass-by-copy parameter passing convention
This is intended to solve the problem of how to pass arguments to
constructor functions -- you want to move in rvalues, but not have to
explicitly copy stuff that is not an rvalue. The by-copy passing
convention will ensure the callee gets its own copy of the value. For
rvalues, it'll just pass off the value. For lvalues, it'll make a
copy.

Issue #1177
2011-11-18 12:49:00 +01:00