Commit graph

5650 commits

Author SHA1 Message Date
Patrick Walton
3be6cf7ab2 vim: Add pure to the list of keywords 2011-09-29 18:18:37 -07:00
Patrick Walton
dd7ff8dee4 stdlib: Export str::buf 2011-09-29 17:58:51 -07:00
Patrick Walton
a5b422fe6b rustc: Translate calls on the C stack 2011-09-29 17:34:49 -07:00
Patrick Walton
f22601321f rustc: Fix call signature for call_c_stack 2011-09-29 17:34:49 -07:00
Patrick Walton
e31849fb79 rt: Fix assembler for C calls to work more like a regular function call 2011-09-29 17:34:49 -07:00
Patrick Walton
6dece91ed3 stdlib: Add vec::eachi to the standard library 2011-09-29 17:34:49 -07:00
Patrick Walton
c04efec87f rustc: Add upcall stubs for the new C stack upcalls 2011-09-29 17:34:49 -07:00
Patrick Walton
41ab324539 rustc: Generate types in trans for the C-stack native ABI 2011-09-29 17:34:49 -07:00
Marijn Haverbeke
e4436c3a5d Don't build up results for ignored expressions.
Issue #667
2011-09-29 12:02:37 +02:00
Marijn Haverbeke
d74a7a83d7 Fail with an informative error when trying to bind a method
Issue #435
2011-09-29 11:55:29 +02:00
Marijn Haverbeke
d243ea57f5 Move last remaining expression types out of trans_expr
Issue #667
2011-09-29 11:41:45 +02:00
Marijn Haverbeke
f089f533e8 Move expr_cast and expr_copy to DPS style
Issue #667
2011-09-29 10:46:49 +02:00
Marijn Haverbeke
d946e09a72 Move closure construction over to DPS style
Issue #667
2011-09-29 10:36:40 +02:00
Marijn Haverbeke
508c48ce10 Reduce move ops to a construct-in-place when possible 2011-09-29 10:36:40 +02:00
Brian Anderson
15e34deba3 Eliminate glue.o. Closes #990 2011-09-28 15:35:21 -07:00
Brian Anderson
e1ba559c03 Test cases for #985
Other restrictions on pinned kinds happened to fix this

Closes #985
2011-09-28 15:35:21 -07:00
Brian Anderson
cb4e99b688 Don't allow vectors of pinned kinds
Vectors of pinned kinds can't be safe because most interesting uses of vector
perform copies
2011-09-28 15:35:21 -07:00
Brian Anderson
14bac217b0 Make error patterns in some kind tests more specific 2011-09-28 15:35:21 -07:00
Patrick Walton
f7d0c1cec3 rustc: Add a new "C stack cdecl" native ABI 2011-09-28 12:58:33 -07:00
Brian Anderson
657e3ffaf5 xfail-fast run-pass/alt-range.rs 2011-09-28 12:46:29 -07:00
Brian Anderson
381205b747 Revert "Revert "Implement pattern ranges for all numeric types.""
This reverts commit a034f87146.

Conflicts:

	src/comp/middle/check_alt.rs
	src/comp/middle/trans_alt.rs
	src/comp/syntax/ast.rs
	src/comp/syntax/ast_util.rs
	src/comp/syntax/fold.rs
	src/comp/syntax/print/pprust.rs

Conflicts:

	src/comp/middle/trans_alt.rs
2011-09-28 12:46:29 -07:00
Patrick Walton
5fac684af8 vim: const is a keyword 2011-09-28 12:40:34 -07:00
Patrick Walton
d8a80cb31f rt: Add a call stub that switches to the C stack, untested as of yet 2011-09-28 12:26:36 -07:00
Patrick Walton
1eaaae860f rt: Add an upcall to allocate space on the C stack. This will be used for native calls on the C stack. 2011-09-28 11:31:44 -07:00
Patrick Walton
e8757ea01f rt: Expose the C stack inside the Rust scheduler so that C calls can switch to it 2011-09-28 10:22:02 -07:00
Patrick Walton
dbf472b0df rustc: Switch to cdecl for all calls. This is needed to make stack growth efficient, as I need to use eax and ecx in the function prologue and can't afford to stomp on incoming arguments. 2011-09-28 10:22:02 -07:00
Marijn Haverbeke
512cfb4b83 Remove a few kludges that worked around issue #913 2011-09-28 12:59:44 +02:00
Marijn Haverbeke
c94159652a Register new snapshot
It had been a while. I mostly wanted a fix for #913 in stage0.
2011-09-28 12:56:54 +02:00
Marijn Haverbeke
a3a27374bd Don't descend into functions from relax_precond_block
Closes #913
2011-09-28 12:37:28 +02:00
Marijn Haverbeke
759fc101fb Get rid of might_not_init kludge in init_local.
Initializing something is now safe wrt to cleanups (so the cleanup for the
local is only registered after the initialization.)
2011-09-28 11:12:35 +02:00
Marijn Haverbeke
16d5aaa962 Wait with registering cleanups for locals until after the init code ran
Fixes a double-cleanup that was breaking unwind-tup.rs under valgrind.
2011-09-28 10:41:19 +02:00
Marijn Haverbeke
e3626c9405 Use DPS for assignment and local initialization
Issue #667
2011-09-28 09:42:04 +02:00
Wade Mealing
f375391cb6 Patch to error instead of crashing when parsing unmatched double quotes
Patch to error and fail instead of using all available memory
then crashing to detect the error condition of an unmatched
double quote before the end of a file.

I couldn't get it to show nice error messages, so this may not be
the ideal fix.

A test case for this situation has also been added.
2011-09-27 23:20:31 -07:00
Brian Anderson
a96b16e8c3 Make it again possible to initialize resource locals via assignment
Some special cases allow both 'let a <- my_resource(x)' and
'let a = my_resource(x)' to work as expected despite ostensibly being
copies and moves.
2011-09-27 23:20:27 -07:00
Brian Anderson
459353e107 Prevent copies of resources into various things 2011-09-27 21:50:07 -07:00
Patrick Walton
9ba86178ef rt: Store the task in TLS 2011-09-27 18:12:03 -07:00
Brian Anderson
888e22aacc Add more comments about kind checking on local move initializers 2011-09-27 16:03:10 -07:00
Brian Anderson
8217e4bd38 Add xfailed tests that resources can't be copied into various things 2011-09-27 16:03:10 -07:00
Brian Anderson
b8bb663df7 Don't ever raise unique kinds of pinned kinds to shared (again)
So *resource, ~resource, [resource] are all pinned. This is counter to the
design of the kind system, but this way is a much clearer path to type safety.
Once we've established a good baseline with lots of tests, then we can try to
make raising pinned kinds work.
2011-09-27 16:03:10 -07:00
Brian Anderson
e50580aa66 Revert "Use DPS for assignment and local initialization"
This reverts commit b1b202d302.
2011-09-27 16:03:09 -07:00
Brian Anderson
1097463d96 Add an xfailed test for bogus deep copying of things containing resources 2011-09-27 14:28:20 -07:00
Brian Anderson
4bffa5e13a Add an xfailed test for bogus vector addition of typarams 2011-09-27 14:24:28 -07:00
Marijn Haverbeke
04f062f9d4 Fix lurking bug in matching of nil
Which was somehow made visible by the DPS changes.
2011-09-27 22:49:33 +02:00
Marijn Haverbeke
b1b202d302 Use DPS for assignment and local initialization
Issue #667
2011-09-27 20:33:09 +02:00
Marijn Haverbeke
e42f3b8481 Safeguard against self-assignment for unique types 2011-09-27 20:33:09 +02:00
Jesse Ruderman
923aa4744e Test for #924 2011-09-27 11:05:16 -07:00
Marijn Haverbeke
94db38a530 Move expr_unary to DPS style
Issue #667
2011-09-27 17:31:15 +02:00
Marijn Haverbeke
92d63ffa65 Make trans_rec and trans_tup understand overwrite dests
Issue #667
2011-09-27 17:31:15 +02:00
Marijn Haverbeke
8282f7fe80 Move expr_binary into trans_expr_dps
Issue #667
2011-09-27 17:30:54 +02:00
Marijn Haverbeke
806e74fbf5 Move expr_lit and expr_vec into trans_expr_dps
Issue #667
2011-09-27 17:30:45 +02:00
Marijn Haverbeke
8ea72fae99 Move more non-value-returning things to trans_expr_dps.
Issue #667
2011-09-27 17:30:45 +02:00
Brian Anderson
b49f4689f5 Add two xfailed tests for invalid copies into vectors 2011-09-26 23:45:51 -07:00
Brian Anderson
1796abc3ef xfail-win32 -> xfail-fast 2011-09-26 23:34:54 -07:00
Brian Anderson
4f2a0117c7 Try to appease windows by xfail-win32'ing a random test 2011-09-26 23:34:12 -07:00
Brian Anderson
df19b7a13a Test for issue #980 2011-09-26 23:24:53 -07:00
Brian Anderson
6b42ad5ea0 Enforce copy restrictions on let initializers 2011-09-26 22:00:15 -07:00
Brian Anderson
07e13fe447 Make some nocopy tests a bit more futureproof
Turn the let assignment initializers into move initializers since
that assignment is going to become illegal
2011-09-26 22:00:15 -07:00
Jesse Ruderman
20c2d2a999 Distinguish #924 2011-09-26 20:44:57 -07:00
Jesse Ruderman
4ff46a1502 Add a cycle-collection fuzzer 2011-09-26 20:34:07 -07:00
Brian Anderson
3778b6c6a8 Prevent copying of uncopyable things via the copy op 2011-09-26 20:03:30 -07:00
Brian Anderson
755001725a Prevent copying of uncopyable things via compound assignment ops 2011-09-26 20:03:24 -07:00
Brian Anderson
99cbea51a1 Don't allow vectors of pinned kinds to be copied 2011-09-26 19:57:00 -07:00
Brian Anderson
4bee452221 Don't allow copying of unique boxes of pinned kinds
Issue #409
2011-09-26 18:43:49 -07:00
Brian Anderson
2d5e085eb9 Add a test that unique boxes in vectors are copied when the vector is
Issue #409
2011-09-26 17:59:58 -07:00
Patrick Walton
a88d9effbc rt: Don't run arbitrary destructors on cycle collection; that's just broken. 2011-09-26 17:41:22 -07:00
Patrick Walton
5c973142df rt: Turn on cycle collection at task death; add a test case 2011-09-26 16:59:15 -07:00
Patrick Walton
ad19ab4c6f rt: Make the logic that moves environments between tasks update the GC alloc chain correctly 2011-09-26 16:59:15 -07:00
Patrick Walton
47e5ab093a stdlib: Fix typos in comments in lib/test.rs 2011-09-26 16:59:15 -07:00
Brian Anderson
389852b5c0 Fix tags of unique boxes
Issue #409
2011-09-26 14:44:08 -07:00
Brian Anderson
223f5be166 Unique vectors and boxes of pinned are unique kinds. Closes #977 2011-09-26 13:38:46 -07:00
Marijn Haverbeke
8c0918ac18 Construct records and tuples in-place
Issue #667

Now, {a: {b: 10, c: 20}, d: @30} will simply write the values in the right
places, rather than creating intermediary records and then memmoving them.
Cuts about a megabyte off the unoptimized compiler size.
2011-09-26 22:13:08 +02:00
Marijn Haverbeke
5837975f95 Convert more expression types to use DPS
expr_rec, expr_tup, most of the exprs that don't return anything. Make
trans_ret almost trivial by using destination adaptors (trans_save_in,
trans_by_ref).

Issue #667
2011-09-26 21:34:10 +02:00
Marijn Haverbeke
345b5a47bd Add a workaround hack for issue #913
I can't figure out what the real cause of this bug is, but I want
to be able to use blocks inside loops again.
2011-09-26 21:34:10 +02:00
Patrick Walton
37cf7b92c8 test: Fix more typos in weird-exprs.rs. 2011-09-26 10:26:30 -07:00
Patrick Walton
2348858995 test: wierd-exprs -> weird-exprs 2011-09-26 10:24:46 -07:00
Patrick Walton
81f1863de7 rt: Remove obsolete comment 2011-09-26 10:24:21 -07:00
Graydon Hoare
93f0e9bac3 Refine notes in kind.rs some more. Add a fixme to ty.rs.
Kinds are still pretty wobbly. See thread starting at
https://mail.mozilla.org/pipermail/rust-dev/2011-September/000807.html
2011-09-25 21:20:17 -07:00
Jesse Ruderman
798b3531a6 Enable hammertime 2011-09-25 21:13:52 -07:00
Jesse Ruderman
73898351d2 Test for #973 2011-09-25 21:01:50 -07:00
Jesse Ruderman
60ec49b121 Test for #942 2011-09-25 20:57:44 -07:00
Jesse Ruderman
56410b2fb6 Remove FIXME test that's covered by run-pass/unreachable-code.rs 2011-09-25 20:56:19 -07:00
Marijn Haverbeke
8911aef798 Make return-by-ref function headers pretty-print safely
Closes #972
2011-09-26 04:11:35 +02:00
Marijn Haverbeke
1e988f228d Don't call trans_bind_thunk in an unreachable context
Closes #973
2011-09-26 04:08:45 +02:00
Marijn Haverbeke
4c5e42a139 Make 'fail fail;' compile.
Closes #972
2011-09-26 03:57:08 +02:00
Marijn Haverbeke
6164b72402 Fix bug in mutability-checking pass
It wasn't properly handling function arguments.
2011-09-26 03:56:39 +02:00
Jesse Ruderman
203bc16e7b Fuzzer: stop ignoring fixed bugs 2011-09-25 12:24:42 -07:00
Brian Anderson
98db2febd3 Handle ~fail. Closes #968 2011-09-24 23:52:22 -07:00
Brian Anderson
895674b6eb Add a test for assignment of unique boxes of generics
Closes #976

Issue #409
2011-09-24 21:31:28 -07:00
Brian Anderson
4f7ecce7d1 Support non-immediates in trans_uniq::copy_val
Issue #409
2011-09-24 21:28:58 -07:00
Jesse Ruderman
2b15aefffe Fuzzer: ignore more bugs 2011-09-24 21:01:39 -07:00
Lindsey Kuper
822ed2c6d3 Small refactors.
Factor out some shared code from the start of process_fwding_mthd and
process_bkwding_mthd; get rid of unneeded temp variable.
2011-09-24 23:38:47 -04:00
Jesse Ruderman
3b5b29c7ec Reduce and clarify abuse of 'pure' in interner 2011-09-24 16:33:26 -07:00
Jesse Ruderman
0125532106 Don't iloop (future-proof test against improved reachability computations) 2011-09-24 16:13:32 -07:00
Jesse Ruderman
c29f1af17e Remove irrelevant parts of test 2011-09-24 16:11:50 -07:00
Jesse Ruderman
064f52fa96 Mark some fns as pure so type_is_unique_box doesn't need to be unchecked 2011-09-24 15:36:09 -07:00
Jesse Ruderman
48c2c9b3a7 Mark vec::len as pure 2011-09-24 15:10:03 -07:00
Brian Anderson
9029416e28 Tweak random thing to make windows build succeed. Awesome.
So, a recent commit made syntax-extension-fmt fail under check-fast.
This commit disables lots-a-fail under check-fast and voila! *grumble*
2011-09-24 14:44:42 -07:00
Brian Anderson
e804352de4 Move a previous run-pass test for kind-lowered unique boxes to compile-fail
This test tries to swap unique boxes containing resources, which is not
allowed.

Issue #409
2011-09-24 12:36:51 -07:00
Brian Anderson
c5877450e6 Tweak the type allocated for unique pointers
Seems to be more correctish...

Issue #409
2011-09-24 12:36:51 -07:00
Brian Anderson
777a536313 Support non-immediates in unique-box type glue
Issue #409
2011-09-24 12:36:51 -07:00
Brian Anderson
856acbf66d Vectors containing pinned kinds become pinned
Otherwise they could be copied
2011-09-24 12:36:51 -07:00
Brian Anderson
e5d5682065 Unique pointers containing pinned kinds become pinned
Issue #409
2011-09-24 12:36:51 -07:00
Brian Anderson
97629727b1 Add tests for swapping unique boxes
Issue #409
2011-09-24 12:36:50 -07:00
Jesse Ruderman
fbe00fc236 Add rand_util.rs 2011-09-23 23:24:43 -07:00
Jesse Ruderman
3bac3378ae Fuzzer: use different exclusions when testing pretty-printer than when testing compiler 2011-09-23 23:23:04 -07:00
Jesse Ruderman
3a7a2943dd Add vec::filter 2011-09-23 19:10:48 -07:00
Patrick Walton
7979bbbf51 rt: Sweep in cycle collection 2011-09-23 17:57:25 -07:00
Patrick Walton
41082c6b83 rt: Whitespace police 2011-09-23 17:57:25 -07:00
Patrick Walton
b995028c47 rt: Turn off some debug code 2011-09-23 17:57:25 -07:00
Patrick Walton
0c4e0fdfae rt: Get rid of the hack that looks for captured type descriptors adjacent to the root one for functions and objects 2011-09-23 17:57:25 -07:00
Erick Tryzelaar
6164de90e2 Add libuv upgrade instructions to src/etc/gyp-uv 2011-09-23 16:53:07 -07:00
Erick Tryzelaar
5f066e06b9 Update to libuv commit 3ca382.
This patch changes libuv's gyp build system to
make it's own makefiles. To generate them for rust,
run these commands. They requires python 2.x to
work:

$ mkdir -p src/rt/libuv/build
$ svn co http://gyp.googlecode.com/svn src/rt/libuv/build/gyp
$ ./etc/src/gyp_uv
2011-09-23 16:53:06 -07:00
Brian Anderson
d8f6e9f237 Add let destructuring for unique boxes
Issue #409
2011-09-23 16:12:04 -07:00
Brian Anderson
122f714fde Add missing case for pat_uniq to syntax::visit
Issue #409
2011-09-23 16:03:35 -07:00
Brian Anderson
27972a6def Add two tests for sending unique boxes across channels
Issue #409
2011-09-23 15:32:31 -07:00
Brian Anderson
68512f2d9d Actually use unique boxes in run-fail/unwind-unique 2011-09-23 15:23:44 -07:00
Brian Anderson
18b01d5cfe Create a bunch of test cases for unique boxes by copying box tests
XFAIL the ones that don't work

Issue #409
2011-09-23 15:15:30 -07:00
Brian Anderson
2082f67765 Begin to support pattern matching on unique boxes
Issue #409
2011-09-23 15:15:30 -07:00
Patrick Walton
87700adb2f rt: Add missing <stdint.h> in rust_abi.h 2011-09-23 15:14:44 -07:00
Patrick Walton
e036c9d8d2 rt: Add missing const on the Windows path 2011-09-23 15:08:37 -07:00
Patrick Walton
557d641175 rt: Get RUST_TRACK_ORIGINS working. You can now call 'debug::dump_origin' in gdb and get a backtrace saying where a box came from. 2011-09-23 15:06:28 -07:00
Jesse Ruderman
7b1a3bb8e6 Add more unreachable-code tests. Closes #935 2011-09-23 15:01:19 -07:00
Marijn Haverbeke
2c7f21c524 Properly mark unreachable alt bodies as unreachable 2011-09-23 23:37:15 +02:00
Marijn Haverbeke
572a4b71d5 Make AddIncomingToPhi take single values rather than arrays 2011-09-23 23:20:19 +02:00
Marijn Haverbeke
64c69aa7b8 Start on a piecemeal conversion to DPS
Issue #667

Wires in a basic framework for destination-passing style, with
backwards-compatibility to the old approach, so that expression types
can be moved over to it one at a time (by moving them from trans_expr
to trans_expr_dps).
2011-09-23 22:49:37 +02:00
Marijn Haverbeke
d114dedf9a Don't return unused values from zero_alloca and trans_stmt 2011-09-23 22:28:05 +02:00
Marijn Haverbeke
abf002ad60 Fix bug where the type of a function's top-level block wasn't fixed up 2011-09-23 22:28:05 +02:00
Patrick Walton
aabff480c9 rt: Factor out stack walking into rust_abi.cpp 2011-09-23 12:49:20 -07:00
Brian Anderson
d10d23f0ad xfail-win32 linked-failure and send-iloop 2011-09-23 12:30:36 -07:00
Patrick Walton
82935c2d17 rt: Fix message formatting issues in rust_debug 2011-09-23 12:27:13 -07:00
Patrick Walton
03f0932a6d rt: ifdef out backtrace() on Windows 2011-09-23 12:26:41 -07:00
Patrick Walton
9226ac9ec5 rt: Fix build bustage due to gcc's format string warnings 2011-09-23 12:09:52 -07:00
Patrick Walton
61afef29a1 rt: Add a RUST_TRACK_ORIGINS debug flag to help track down memory corruption 2011-09-23 11:42:20 -07:00
Patrick Walton
dbdeff659f rt: Factor out the logic that handles the various magic debug environment variables 2011-09-23 11:04:14 -07:00
Patrick Walton
f8007b5535 rt: Remove the problematic min()/max()/align()/abs() macros from isaac/standard.h, as they're unused 2011-09-23 11:04:14 -07:00
Graydon Hoare
18c6cc6371 More steps to arch-specific target libs (#474) 2011-09-23 10:50:16 -07:00
Marijn Haverbeke
5310cf4f30 xfail-pretty unreachable-code.rs 2011-09-23 11:33:27 +02:00
Marijn Haverbeke
348cd86d87 Properly check types of do-while condition expr
Closes #956
2011-09-23 11:19:15 +02:00
Marijn Haverbeke
0bbde048a4 Make sure no dynamic allocas are used before they are allocated
Closes #965
2011-09-23 11:11:37 +02:00
Marijn Haverbeke
49813cffb1 Use a slightly nicer hack to get zero-length strings in trans_build
Wrapping calls in str::by_ref(, ...) heap-allocated an empty string
every time (and looked really bad).
2011-09-23 11:11:37 +02:00
Marijn Haverbeke
420484579d Better handling of unreachable code in trans
The builder functions in trans_build now look at an 'unreachable' flag
in the block context and don't generate code (returning undefined
placeholder values) when this flag is set. Threading the unreachable
flag through context still requires some care, but this seems a more
sane approach than re-checking for terminated blocks throughout the
compiler.

When creating a block, if you use its closest dominator as parent, the
flag will be automatically passed through. If you can't do that,
because the dominator is a scope block that you're trying to get out
of, you'll have to do something like this to explicitly pass on the
flag:

    if bcx.unreachable { Unreachable(next_cx); }

Closes #949. Closes #946. Closes #942. Closes #895. Closes #894.
Closes #892. Closes #957. Closes #958.
2011-09-23 11:09:57 +02:00
Marijn Haverbeke
b029789f02 Remove backward-compatible support for 'mutable' before type.
Closes #966
2011-09-23 09:58:51 +02:00
Brian Anderson
93b9574d32 Remove deprecated mutable type constructor from run-pass/issue-511
This was triggering a warning that was making the pretty-print test fail
2011-09-22 23:08:59 -07:00
Brian Anderson
cee7b4caee Add test for issue #511. Closes #511 2011-09-22 22:50:12 -07:00
Brian Anderson
dbd2ee015a Remove is_stateful flag from tydesc. Closes #136 2011-09-22 22:15:25 -07:00
Brian Anderson
33dd7cc854 Add a test for negative constants. Closes #358 2011-09-22 21:59:09 -07:00
Brian Anderson
0e5f76a718 Fix ty_uniq case in maybe_auto_unbox
Closes #961
Issue #409
2011-09-22 18:14:18 -07:00
Brian Anderson
1a48023a79 Add take glue for unique boxes
Closes #962
Issue #409
2011-09-22 18:05:36 -07:00
Brian Anderson
77fcab043e Remove nonsensical load and store from trans_uniq::copy_val
Issue #409
2011-09-22 17:50:27 -07:00
Brian Anderson
f628003da6 Adda test for returning unique boxes
Issue #409
2011-09-22 17:00:53 -07:00
Brian Anderson
7a76323459 Allow vectors to contain unique boxes. Closes #952
Issue #409
2011-09-22 17:00:53 -07:00
Patrick Walton
e372f943e2 rustc: Write raw type parameters instead of linearized type parameters in object body shapes 2011-09-22 16:13:03 -07:00
Brian Anderson
dfa5bd1114 XFAIL task-comm 2011-09-22 16:09:10 -07:00
Brian Anderson
30a4eab380 Autoderef indexes and fields of unique boxes
Issue #409
2011-09-22 16:06:25 -07:00
Brian Anderson
dff4986f9e Add tests for moving unique boxes
Issue #409
2011-09-22 15:43:08 -07:00
Brian Anderson
d174d917e2 Calculate the correct kind for unique boxes
Issue #409
2011-09-22 15:28:49 -07:00
Brian Anderson
61a14f3df0 Add a test for mutable references to unique boxes as function arguments
Issue #409
2011-09-22 15:03:44 -07:00
Brian Anderson
1367f2b63e Add a test for unique boxes as fn args
Issue #409
2011-09-22 14:55:08 -07:00
Brian Anderson
3bb7035914 Add a test for unique boxes containing shared boxes
Issue #409
2011-09-22 14:39:57 -07:00
Brian Anderson
3f41563cc9 Drop the previous value when copying one unique box local to another
Issue #409
2011-09-22 13:53:34 -07:00
Brian Anderson
7c4fe10f02 Add a test that assignment of unique boxes to locals does a copy
Issue #409
2011-09-22 13:53:34 -07:00
Brian Anderson
67bac873e0 Add assignment to unique box locals
Issue #409
2011-09-22 13:53:33 -07:00
Brian Anderson
268a9fe5fb Initialize unique box locals from other locals
Issue #409
2011-09-22 13:53:33 -07:00
Brian Anderson
5d5136df9f Convert trans_uniq asserts to preconditions
Issue #409
2011-09-22 13:53:33 -07:00
Brian Anderson
c4f02a7925 Sprinkle some asserts through trans_uniq 2011-09-22 13:53:33 -07:00
Brian Anderson
8492eed137 Move uniq trans code to trans_uniq module
Issue #409
2011-09-22 13:53:30 -07:00
Brian Anderson
0f0ba33d82 Factor alloc_uniq from trans_uniq
Issue #409
2011-09-22 13:52:30 -07:00
Brian Anderson
f6ab12a3b1 Don't unify unique boxes with different mutability
Issue #409
2011-09-22 11:10:48 -07:00
Brian Anderson
5ab0840353 XFAIL spawnfail and task-comm-15 2011-09-22 11:06:26 -07:00
Brian Anderson
ea67099234 Add support for mutable unique boxes
Issue #409
2011-09-22 10:26:34 -07:00
Brian Anderson
1b3023e4d0 Convert ty::ty_uniq to contain a mutable type
Issue #409
2011-09-22 10:26:34 -07:00
Brian Anderson
4d088bd528 Call drop glue on the thing in a unique box
Issue #409
2011-09-22 10:26:34 -07:00
Marijn Haverbeke
aad1342e13 Fix long line 2011-09-22 09:23:07 +02:00
Marijn Haverbeke
5e3d0e304f Fix missing cast in do_cc
Apparently not needed on Mac (clang?), but breaking the win and linux boxes.
2011-09-22 09:17:26 +02:00
Patrick Walton
8c02adc630 rustc: Port the fn and obj traversal logic over from the GC branch. Doesn't actually do anything yet due to lack of support in trans. 2011-09-21 19:08:26 -07:00
Patrick Walton
ad3b9c41b4 rt: Implement cycle collection marking. Simple cycles can now be detected. 2011-09-21 18:14:23 -07:00
Brian Anderson
a993621e43 Log and compare unique boxes
Issue #409
2011-09-21 17:08:40 -07:00
Brian Anderson
42fd2a9d89 Remove unused arg from revoke_clean 2011-09-21 15:39:46 -07:00
Brian Anderson
92af552956 Add an unwind test for failure during unique box construction 2011-09-21 14:45:08 -07:00
Brian Anderson
2cc01e2ca2 Add ability to deref unique boxes. Make unique boxes immediates.
Issue #409
2011-09-21 14:40:55 -07:00
Brian Anderson
956bc69330 Add more unwind tests for failure during construction of allocated things 2011-09-21 14:14:17 -07:00
Marijn Haverbeke
80778f642f Revert "rustc: Make bottom types immediates. Add a |log ret| testcase. Closes #935."
This reverts commit f19ab1ff3c.
2011-09-21 21:39:31 +02:00
Patrick Walton
f19ab1ff3c rustc: Make bottom types immediates. Add a |log ret| testcase. Closes #935. 2011-09-21 10:55:28 -07:00
Patrick Walton
fcd17731cf rustc: Don't try to spill bottom types, since we can't make any assumptions about the type of the ValueRef 2011-09-21 10:55:27 -07:00
Marijn Haverbeke
a034f87146 Revert "Implement pattern ranges for all numeric types."
This reverts commit ce0f054f9d.
2011-09-21 18:42:09 +02:00
Marijn Haverbeke
410f73fdb2 Don't write to retptr when returning nil, pass undef for unused params 2011-09-21 17:57:19 +02:00
Graydon Hoare
68d50b5928 Add target_triple to session::options. Use host triple by default, accept --target on command line. 2011-09-21 08:46:44 -07:00
Marijn Haverbeke
07eb29dbce Revert "rustc: Make bottom types immediates. Add a |log ret| testcase. Closes #935."
This reverts commit e6a84f252a.
2011-09-21 11:05:54 +02:00
Josh Matthews
ce0f054f9d Implement pattern ranges for all numeric types. 2011-09-21 09:36:12 +02:00
Patrick Walton
e6a84f252a rustc: Make bottom types immediates. Add a |log ret| testcase. Closes #935. 2011-09-20 22:52:26 -07:00
Jesse Ruderman
f7b67944cd Add another testcase for #910 2011-09-20 20:00:34 -07:00
Jesse Ruderman
01ea880196 Re-wrap long line 2011-09-20 19:40:47 -07:00
Patrick Walton
eafb70072a rt: Zero out allocations so that the CC won't die if it happens to run while a box is being constructed.
This is kind of unfortunate.
2011-09-20 19:15:46 -07:00
Patrick Walton
a63cc03a07 rt: Add some debug code (ifdef'd out) for diagnosing marking problems 2011-09-20 19:15:13 -07:00
Patrick Walton
ab76305cb9 rt: Skip over the reference count properly before walking the contents of the box when determining internal reference counts 2011-09-20 19:14:58 -07:00
Patrick Walton
74194df7dd rt: Remove obsolete comment 2011-09-20 19:14:18 -07:00
Patrick Walton
b39c7c4c45 rt: Increase the tolerance of the vector range sanity check 2011-09-20 19:13:45 -07:00
Patrick Walton
e27279d7db rt: Clean up debugging print statements in rust_obstack.cpp 2011-09-20 18:26:09 -07:00
Brian Anderson
f809e22697 Represent unique creation as a unop in the AST instead of its own expr
Like the box unop.

Issue #409
2011-09-20 18:06:47 -07:00
Brian Anderson
7ae251789c Make creation of unique boxes work again
Issue #409
2011-09-20 17:51:17 -07:00
Brian Anderson
865dcb663d Parse unique box types
Issue #409
2011-09-20 17:51:17 -07:00
Patrick Walton
be1feaa918 rt: First stab at computing internal reference counts 2011-09-20 17:49:49 -07:00
Graydon Hoare
aa7d624c15 Revert trivial commit. 2011-09-20 17:20:14 -07:00
Graydon Hoare
ff6f444de2 Another trivial commit. 2011-09-20 17:19:51 -07:00
Graydon Hoare
936e0311b0 Trivial commit to test reporting to IRC. 2011-09-20 17:18:43 -07:00
Patrick Walton
e26b1883dd rt: Stub code for the cycle collector 2011-09-20 16:49:31 -07:00
Patrick Walton
c61691110a rt: Make rust_shape.h able to be included in more contexts 2011-09-20 16:49:31 -07:00
Jesse Ruderman
35016d3147 Ignore #949 2011-09-20 16:42:58 -07:00
Jesse Ruderman
571ff0c84a Add @true to common_exprs and fix some exclusions 2011-09-20 16:32:27 -07:00
Patrick Walton
77f0101edb rt: Add an on-the-side GC chain 2011-09-20 15:35:14 -07:00
Patrick Walton
5209b19255 rt: Rename rand() to isaac_rand() since the former prevents lots of standard headers from being included 2011-09-20 15:34:47 -07:00
Patrick Walton
307957710c rt: Remove the GC alloc chain 2011-09-20 14:20:16 -07:00
Patrick Walton
45086b7bfd rt: Remove #include "rust_box.h" 2011-09-20 14:07:10 -07:00
Patrick Walton
9a8b4a1be6 Revert "rt: Rename rust_box to rust_box_legacy, as they're about to become self-describing"
This reverts commit f6871e832c.
2011-09-20 13:57:04 -07:00
Patrick Walton
d73a8606c9 rt: Remove rust_box.h; I'm going to switch to an external map. 2011-09-20 13:55:23 -07:00
Patrick Walton
e981abdb01 rt: Remove upcall_malloc_box and upcall_free_box; I don't think they'll be necessary after all 2011-09-20 13:50:15 -07:00
Patrick Walton
d607316b2f rustc: Pass actual tydescs to upcall_malloc 2011-09-20 13:48:22 -07:00
Patrick Walton
78147452b8 rustc: Remove trans_raw_malloc, as it's only called from one place 2011-09-20 13:38:54 -07:00
Jesse Ruderman
d882f8ee2f Fuzzer: add common_exprs, but comment out its use for now. Update lists of known bugs. 2011-09-20 12:04:12 -07:00
Brian Anderson
13f57dfbea Remove bogus comments from run-pass/task-comm-3 2011-09-20 12:01:48 -07:00
Brian Anderson
a609da7c15 Rehabilitate run-fail/trivial-message2 2011-09-20 11:59:51 -07:00
Jesse Ruderman
58d812f0f8 Fix syntax error 2011-09-20 11:58:33 -07:00
Brian Anderson
12d7363469 Remove a bogus comment from run-fail/spawnfail 2011-09-20 11:51:15 -07:00
Brian Anderson
e3b1397097 Actually un-xfail task-comm-14 2011-09-20 11:49:13 -07:00
Brian Anderson
c6d460d4e3 Rehabilitate task-comm-14 2011-09-20 11:47:22 -07:00
Brian Anderson
564bdacece Add an assert to run-fail/unwind-alt
Jesse reported not being able to reproduce this without the assert. May have
to do with optimtizations.
2011-09-20 11:26:01 -07:00
Brian Anderson
de1b394c32 Move linker invocation from driver::rustc to back::link 2011-09-20 11:10:03 -07:00
Brian Anderson
870117f44e Zero locals that are inited via alt expressions. Closes #945 2011-09-20 10:28:16 -07:00
Marijn Haverbeke
e33f116598 Remove some obsolete 'copy' operators from trans 2011-09-20 17:35:40 +02:00
Marijn Haverbeke
1eaddb772e Properly handle 'put;' in trans
Closes #947
2011-09-20 17:34:32 +02:00
Marijn Haverbeke
8c85745452 Remove some bogus white-space from llvm.rs 2011-09-20 17:14:50 +02:00
Jesse Ruderman
35873a95d4 Fuzzer: add ability to run the generated programs 2011-09-19 21:57:43 -07:00
Brian Anderson
107f1292eb Add tests for moving nullary functions
I believe this was fixed by marijn recently.

Closes #922
2011-09-19 19:04:33 -07:00
Brian Anderson
91d8e69621 Un-xfail various tests 2011-09-19 18:55:26 -07:00
Brian Anderson
f4a19f800e Un-xfail-fast run-pass/send-iloop 2011-09-19 18:36:31 -07:00
Brian Anderson
a528614af5 Remove a spurious error pattern from run-pass/linked-failure 2011-09-19 18:25:32 -07:00
Brian Anderson
9371a1ad12 Un-xfail two tests under check-fast
Closes #937. Fixed by majick.
2011-09-19 18:23:34 -07:00
Brian Anderson
7e046edebb Revert "xfail some tests that hang (instead of segfaulting) since eafb6789a2"
This reverts commit 5f44a1356e.

Issue #936
2011-09-19 18:00:41 -07:00
Brian Anderson
facc7fd2ef Check for the correct exit code on cfail tests. Closes #938 2011-09-19 18:00:17 -07:00
Brian Anderson
7c6630a367 Build tuples in two phases to avoid cleaning up partial tuples 2011-09-19 17:59:53 -07:00
Brian Anderson
9626e2f71f Register tuple cleanups after the tuple is built
Issue #936
2011-09-19 17:59:47 -07:00
Brian Anderson
a18986c1a1 Revert "Revert "xfail some tests that hang (instead of segfaulting) since eafb6789a2""
This reverts commit 6eabe6f3f4.
2011-09-19 16:08:17 -07:00
Brian Anderson
7bc282a561 Revert "Check for the correct exit code on cfail tests. Closes #938"
This reverts commit c42401ebbc.
2011-09-19 16:08:06 -07:00
Brian Anderson
6eabe6f3f4 Revert "xfail some tests that hang (instead of segfaulting) since eafb6789a2"
This reverts commit 5f44a1356e.

Issue #936
2011-09-19 15:45:39 -07:00
Brian Anderson
c42401ebbc Check for the correct exit code on cfail tests. Closes #938 2011-09-19 15:33:14 -07:00
Brian Anderson
b1bf9ef5ae Break fold's circular reference during unwinding
This converts the AST fold into a resource that breaks it's own circular
reference (just a temporary workaround until GC), so that failure during fold
will unwind correctly.

Issue #936
2011-09-19 15:32:56 -07:00
Brian Anderson
dd1cf63515 Build records in two phases to avoid cleanups on partial records 2011-09-19 14:28:04 -07:00
Brian Anderson
432e931a2a Don't register record cleanups until the record is built 2011-09-19 14:28:04 -07:00
Patrick Walton
3632629acc rt: Introduce a self-describing box representation and functions to create and free them 2011-09-19 11:40:41 -07:00
Marijn Haverbeke
5f44a1356e xfail some tests that hang (instead of segfaulting) since eafb6789a2
See issue #936
2011-09-18 22:13:54 +02:00
Marijn Haverbeke
eafb6789a2 Stop creating function pairs for static functions
These are now called directly. When taking their value, a null pointer is added
to create a pair.
2011-09-18 22:05:58 +02:00
Tim Chevalier
8640e67e3f Add a precondition to GEP_tup_like 2011-09-17 10:18:30 -07:00
Tim Chevalier
2b98eccfee Add a type_is_tup_like predicate that takes a block ctxt, and make some fns pure 2011-09-17 10:18:11 -07:00
Tim Chevalier
8613f28a16 In trans, replace another impossible case with a precondition 2011-09-17 09:13:05 -07:00
Brian Anderson
1002623201 Make move-mode arguments unwind correctly. Closes #939 2011-09-16 14:38:04 -07:00
Tim Chevalier
99236d64d0 Dead code elim 2011-09-16 13:32:44 -07:00
Tim Chevalier
fa74df033d Add a constraint on trans::type_of_fn_from_ty
And change callers appropriately.
2011-09-16 13:07:08 -07:00
Tim Chevalier
0d4b51d10d Add a returns_non_ty_var predicate
which just calls non_ty_var on the return type of t, assuming t is
a function type.
2011-09-16 13:06:31 -07:00
Tim Chevalier
1b2c5c4c9b Make ty_fn_ret pure and get rid of a duplicate function 2011-09-16 13:06:31 -07:00
Marijn Haverbeke
43b219dbec Work around an apparent compiler bug to make my patch run
Without this, it would fail when optimization is turned on. The result of
the Load(bcx, llclosure) call would end up in llenv in a corrupted form.
2011-09-16 21:31:36 +02:00
Marijn Haverbeke
575aae407b Saner approach to lvalues and callable values in trans
LValues no longer carry information about generics and objs, instead
there's an extended form of lvalue, lval_maybe_callee, only used by
call and bind, which holds this info.

This makes it possible to take the value of a method and get a working
closure, and will (with some more work) allow us to call statically
known functions without loading from their pair.

Closes #435
Closes #758
2011-09-16 21:31:36 +02:00
Patrick Walton
d9c664e3fa Revert "Revert "Make option::get return the option contents by reference" due to memory corruption"
This reverts commit d1c27ba9e0.
2011-09-16 12:20:06 -07:00
Brian Anderson
679c2d25a1 Un-xfail some task-comm tests 2011-09-16 11:29:40 -07:00
Brian Anderson
4028a099f5 Yield after send 2011-09-16 11:08:01 -07:00
Tim Chevalier
172df2e3a2 Add non_ty_var precondition for type_of_fn, plus minor cleanup 2011-09-16 10:58:02 -07:00
Patrick Walton
469853d5ff rt: Add a new rust_box structure to the runtime that describes a self-describing box 2011-09-16 10:51:59 -07:00
Patrick Walton
f6871e832c rt: Rename rust_box to rust_box_legacy, as they're about to become self-describing 2011-09-16 10:51:58 -07:00
Jesse Ruderman
72317dee0d Fuzzer: update lists of known bugs 2011-09-16 10:44:58 -07:00
Brian Anderson
25394950ae Handle the case where a child task tries to kill a parent while it is dying
Still looks pretty racy
2011-09-16 10:05:12 -07:00
Marijn Haverbeke
ad470d741e Revert "Saner approach to lvalues and callable values in trans"
This reverts commit 66153436c9.
2011-09-16 18:37:46 +02:00
Marijn Haverbeke
133d36f452 Require body of else-less if expressions to be a value-less block
For consistency with other constructs that could not possibly return a
value (say, loops).
2011-09-16 18:21:06 +02:00
Marijn Haverbeke
66153436c9 Saner approach to lvalues and callable values in trans
LValues no longer carry information about generics and objs, instead
there's an extended form of lvalue, lval_maybe_callee, only used by
call and bind, which holds this info.

This makes it possible to take the value of a method and get a working
closure, and will (with some more work) allow us to call statically
known functions without loading from their pair.

Closes #435
Closes #758
2011-09-16 18:21:05 +02:00
Marijn Haverbeke
639d88a693 Move expr_uniq case in trans to a saner place
Note that unique pointers are still broken in more ways than I can count.
2011-09-16 15:03:03 +02:00
Marijn Haverbeke
f8a35234ad Remove autoderef for calls
We were only using it in a single place, and there for no discernable reason
(probably as part of the bare-fn-vals-are-not-copyable plan). It seems more
surprising than useful.
2011-09-16 14:39:30 +02:00
Marijn Haverbeke
c04490d97b Remove unused method_ty field from lval_result 2011-09-16 14:18:49 +02:00
Marijn Haverbeke
fb42d839a0 Clean up (and optimize) root-mutability analysis in alias.rs 2011-09-16 13:46:03 +02:00
Marijn Haverbeke
d7587c1eda Change convention for specifying referenced argument
It is now 1-based, rather than 0 based. (Seems more natural, and allows 0 to
be used to refer to self and maybe to closure.)

Also allows non-referenced args to be implicitly copied again.

Issue #918
2011-09-16 12:42:18 +02:00
Tim Chevalier
059b31f7a3 Actually call unreachable() in impossible case in type_of_inner 2011-09-15 23:22:12 -07:00
Tim Chevalier
57ede5f281 Added non_ty_var precondition to trans::type_of_inner
This allows us to legitimately call unreachable() in the ty_var case.
2011-09-15 23:22:12 -07:00
Jesse Ruderman
ce1877dc8e Add parens, as needed, around else-if conditions. 2011-09-15 21:24:24 -07:00
Tim Chevalier
2c6eba00dd Added an extra check in trans_alt
Gratuitous right now, but I'm going to change the type of trans::type_of
2011-09-15 20:32:01 -07:00
Tim Chevalier
f41f75fe53 Added more predicates in trans
Added the non_ty_var predicate (soon to be used)
Added a check in get_res_dtor (will be necessary for a future change
to type_of_fn)
Removed a gratuitous ret
2011-09-15 20:23:06 -07:00
Tim Chevalier
059952da5b Change a few span_fatals to span_err 2011-09-15 19:51:27 -07:00
Tim Chevalier
994beca00d Add unreachable() fn, also nitpicking 2011-09-15 19:51:27 -07:00
Graydon Hoare
1e3e7d4bc5 Update README slightly. 2011-09-15 16:31:33 -07:00
Graydon Hoare
c94e612ade Begin sketching an ICU binding. Doesn't work yet. 2011-09-15 15:49:17 -07:00
Patrick Walton
18cf4d904c rt: Add libunwind.h support on Mac OS X 2011-09-15 12:52:50 -07:00
Patrick Walton
d1c27ba9e0 Revert "Make option::get return the option contents by reference" due to memory corruption
This reverts commit fc0bf12516.
2011-09-15 12:52:09 -07:00
Marijn Haverbeke
fc0bf12516 Make option::get return the option contents by reference
I can't believe this actually works!
2011-09-15 17:49:29 +02:00
Brian Anderson
906f1fc425 Add regression tests for previously ambiguous syntactic forms 2011-09-15 08:47:23 -07:00
Marijn Haverbeke
7364a8c2b0 Prevent binary expressions from parsing when lhs is non-value block 2011-09-15 17:37:10 +02:00
Marijn Haverbeke
93ba85a0f1 Register new snapshot 2011-09-15 17:33:35 +02:00
Marijn Haverbeke
b843cf2117 Generalize expression roots in alias analysis
This allows calls-returning-a-reference to count as expression roots,
making it possible to return the result of such a call by reference.

Issue #918
2011-09-15 17:01:35 +02:00
Marijn Haverbeke
29177864c3 Add tests for returning by reference
Issue #918
2011-09-15 16:37:37 +02:00
Marijn Haverbeke
3abe3671bd Require the parameter that will be referenced to be noted
Issue #918
2011-09-15 16:15:17 +02:00
Marijn Haverbeke
75eee8b194 Overhaul alias-checking of blocks
The set of active bindings has to be updated as by-reference locals are
encountered.

Issue #918
2011-09-15 15:43:15 +02:00
Marijn Haverbeke
87fa38910e Make storing returned references in a by-reference local work
fn f(a: {x: str}) -> &str {
        ret a.x;
    }

    fn main() {
        let x = {x: "hi"};
        let &y = f(x); // Look ma, no copy!
        log_err y;
    }

Issue #918.
2011-09-15 15:17:14 +02:00
Marijn Haverbeke
25787bd2b8 Forbid assignment to by-reference bindings
Issue #918
2011-09-15 14:08:54 +02:00
Marijn Haverbeke
d7a1d6a1cb Make trans understand by-ref bindings
Issue #918
2011-09-15 14:00:58 +02:00
Marijn Haverbeke
8aad16112b Implement basic checking of by-reference bindings
Issue #918
2011-09-15 13:40:28 +02:00
Marijn Haverbeke
44c6370e6a Move local numbering into ast_map.rs
This further simplifies the alias pass, which is sorely needed.
2011-09-15 13:18:32 +02:00
Marijn Haverbeke
1cda74deee Add representation for by-ref let bindings
Issue #918
2011-09-15 11:42:56 +02:00
Marijn Haverbeke
197f360e30 Ensure parens are wrapped around composite exprs in call/index/field pos
This is needed to fix the second example in issue #919
2011-09-15 11:15:14 +02:00
Marijn Haverbeke
8c83ea564b More thorough check for (.. 10).x in pretty-printer
Closes #919
2011-09-15 10:59:06 +02:00
Marijn Haverbeke
63ecc84562 Also handle fail and put in print_maybe_parens_discrim
Closes #920
2011-09-15 10:14:52 +02:00
Marijn Haverbeke
3798b6f780 Remove maybe_protect_block kludge from pretty-printer
It is no longer needed.
2011-09-15 10:14:52 +02:00
Marijn Haverbeke
0b34e0e60b Introduce new semicolon rules
- Loop bodies and resource constructors aren't allowed to have
  trailing expressions anymore.

- An expression that ends* in a block without trailing expression can
  can not be called, indexed, or subscripted.

- Only expression-statements that end* in a block without trailing
  expression can omit their semicolon.

*) 'Ending in a trailing expression' is defined as being a block or
   construct-ending-in-a-block (if, alt) that either ends in an
   expression itself, or ends in another block-like expression that
   has a trailing expression (by these same rules).
2011-09-15 09:49:00 +02:00
Marijn Haverbeke
7298b8f4ba Insert omitted semicolons for statements 2011-09-15 09:49:00 +02:00
Brian Anderson
2bed548d1b xfail-fast run-pass/linked-failure.rs. Not sure what the problem is. 2011-09-14 17:47:48 -07:00
Brian Anderson
a0ad9a42cd Unsupervise tasks before the scheduler kills them. Unblock before yield->fail 2011-09-14 17:05:35 -07:00
Brian Anderson
69eda46af8 Add a run-pass test for linked failure 2011-09-14 15:51:46 -07:00
Brian Anderson
103197bc42 Make failure propagation to dead parents work
The failure will basically go 'through' the dead parent and continue
propagating the failure (as if the child was reparented).
2011-09-14 15:48:14 -07:00
Brian Anderson
9505d70513 Make linked task failure work again 2011-09-14 14:20:41 -07:00
Brian Anderson
ad2bdbee08 Add another XFAILed test for failing destructors 2011-09-14 10:59:17 -07:00
Brian Anderson
ca0d3cae5c Add another unwind test
This makes sure that cleanups added after the first invoke in a scope are
actually run on unwind
2011-09-14 09:21:28 -07:00
Brian Anderson
31d4fe37f6 Revert "Try a little harder to avoid creating new landing pads"
This reverts commit b8e31ac469.

Conflicts:

	src/comp/middle/trans.rs
2011-09-14 09:19:31 -07:00
Marijn Haverbeke
93de2f0b74 Add syntax and representation for return-by-mutably-rooted-ref
This will be used in the near future to decide what can safely
be done with the returned reference.

Issue #918
2011-09-14 17:30:38 +02:00
Marijn Haverbeke
1cabe37155 Prevent memory errors when returning references to temp args.
Issue #918
2011-09-14 16:46:54 +02:00
Marijn Haverbeke
c6619f9ce0 Accept returning refs rooted in an arg from a by-ref funtion
Issue #918
2011-09-14 16:19:15 +02:00
Marijn Haverbeke
a3c449df74 Make ast_map.rs index function args, switch it over to simple_visitor 2011-09-14 15:30:59 +02:00
Marijn Haverbeke
cd0e7fc041 Remove some extra white-space introduced by the pretty-printer 2011-09-14 15:20:22 +02:00
Marijn Haverbeke
7d69712dee Disallow implicit arg copying when the function returns a ref
Issue #918
2011-09-14 14:57:20 +02:00
Marijn Haverbeke
93d2a4f82a Add support for basic return-by-alias to trans
Issue #918
2011-09-14 14:39:08 +02:00
Marijn Haverbeke
9a69ee79e0 Clean up trans_obj.rs a bit
As a preparation to adding an arg to type_of_fn_full
2011-09-14 13:49:22 +02:00
Marijn Haverbeke
6cd24173d4 Add a ret_style field to fn_ctxt in trans 2011-09-14 13:48:51 +02:00
Marijn Haverbeke
2aac43d809 Simplify trans::new_fn_ctxt_w_id
It was still living in the pre-decent-type-inference era.
2011-09-14 13:26:39 +02:00
Marijn Haverbeke
0699acb6f7 Rudimentary checking of safe alias returns 2011-09-14 13:09:45 +02:00
Marijn Haverbeke
63519d9006 Rename restrict to binding in alias.rs
Its role gradually changed to the point where the old name doesn't
really make sense anymore.
2011-09-14 12:06:51 +02:00
Marijn Haverbeke
44df041799 Stop needlessly boxing vectors in alias.rs 2011-09-14 11:37:52 +02:00
Marijn Haverbeke
51dae63c44 Make most of the compiler aware of return-by-reference
tyencode/tydecode still don't know about it. return_ref will be extended to take
arguments anyway.
2011-09-14 11:31:05 +02:00
Marijn Haverbeke
c1c083cd66 Refactor parse_ret_ty, start parsing by-alias return specs 2011-09-14 10:46:40 +02:00
Marijn Haverbeke
6eb9738a66 Rename ast::controlflow to ast::ret_style
It will include information about returning by alias.
2011-09-14 10:38:23 +02:00
Josh Matthews
f6fe07d1f3 Add support for negative literals. 2011-09-14 00:47:14 -04:00
Brian Anderson
6d3dd0e48c Try harder still to generate fewer landing pads
Scopes that don't have cleanups don't need their own landing pads

This takes the optimized rustc bin from 4.7MB to 4.4
2011-09-13 16:52:12 -07:00
Brian Anderson
b8e31ac469 Try a little harder to avoid creating new landing pads
It's only when we add or revoke cleanups involving immediates that we need a
new landing pad for the scope.

Trims 5K off the optimized rustc bin
2011-09-13 16:52:12 -07:00
Brian Anderson
74c39469be Reuse landing pads when possible
Cuts the optimized rustc bin from 5.2 to 4.7MB
2011-09-13 16:52:12 -07:00
Michael Sullivan
c84b8e90b8 Print something when we can't figure out a tag name. Mitigates #876. 2011-09-13 13:14:49 -04:00
Marijn Haverbeke
b9267e8fbc Add missing cases for machine floats in shape.rs 2011-09-13 17:46:28 +02:00
Marijn Haverbeke
577d6dd602 Improve lexing of float literals
Closes #575
2011-09-13 17:43:01 +02:00
Marijn Haverbeke
f72573cce8 Properly pretty-print 10.x
Closes #890
2011-09-13 17:08:59 +02:00
Marijn Haverbeke
e64e9792ab Make pretty-printer wrap fail/ret/put in parens in call/index/field pos
Closes #764
Closes #891
2011-09-13 17:02:36 +02:00
Marijn Haverbeke
bc62b17543 Ensure that the declared type and actual type of a constant agree
Closes #899
2011-09-13 16:29:23 +02:00
Marijn Haverbeke
be5537e95f Be more strict about what constitutes a block expression
Blocks (or statements involving blocks) that end in a semicolon are no
longer considered the block-expression of their outer block. This used
to be an expression block, but now is a statement block:

    { if foo { ret 1; } else { ret 10; } }

This helps clear up some ambiguities in our grammar.
2011-09-13 15:50:03 +02:00
Marijn Haverbeke
e945164879 Always warn when implicitly copying a generic type 2011-09-13 13:40:38 +02:00
Marijn Haverbeke
38e86d708b Properly alias-check bindings in for-each loops 2011-09-13 13:34:08 +02:00
Marijn Haverbeke
45bdff01b2 Clean up copy bookkeeping in alias.rs 2011-09-13 13:23:32 +02:00
Marijn Haverbeke
2f402343c9 Make for loop alias-safe 2011-09-13 13:05:59 +02:00
Marijn Haverbeke
3e92f90952 Apply implicit copying for unsafe references to alt patterns 2011-09-13 12:23:36 +02:00
Graydon Hoare
7f94957721 Kill trailing whitespace. 2011-09-12 16:33:43 -07:00
Graydon Hoare
a4815b6742 Factor imports mindlessly. 2011-09-12 16:13:28 -07:00
Brian Anderson
393deeb06f Merge branch 'unwind'
Conflicts:
	src/comp/middle/trans.rs
	src/comp/middle/trans_build.rs
	src/lib/run_program.rs
	src/test/compiletest/runtest.rs
2011-09-12 09:36:51 -07:00
Marijn Haverbeke
edde2e0c45 Undo some pretty-printer damage in ty.rs 2011-09-12 14:43:41 +02:00
Marijn Haverbeke
982a1a4783 Rename alias to reference in docs and error messages
Update docs to reflect new approach to aliases
2011-09-12 14:24:46 +02:00
Marijn Haverbeke
bcf60c6600 Warn when inserting an implicit copy that may be expensive 2011-09-12 13:54:02 +02:00
Marijn Haverbeke
8dd46d4384 Properly implement copy expressions
(And use them in some places that were doing {expr} before.)
2011-09-12 13:13:20 +02:00
Marijn Haverbeke
f4b6264f8c Remove backwards-compatibility with old arg-mode syntax 2011-09-12 12:49:00 +02:00
Marijn Haverbeke
ca1df2b111 Pretty-print for new arg-mode syntax 2011-09-12 12:49:00 +02:00
Marijn Haverbeke
5bc424e4ea Register second snapshot for argument-mode transition 2011-09-12 12:49:00 +02:00
Marijn Haverbeke
bfa021de0d Switch pretty-printer to new arg-mode syntax 2011-09-12 12:48:59 +02:00
Marijn Haverbeke
3667137a41 Accept {|| ... } for argument-less block syntax
Closes #880
2011-09-12 12:04:41 +02:00
Marijn Haverbeke
fc6b7c8b38 Reformat for new mode syntax, step 1
Long lines were fixed in a very crude way, as I'll be following up
with another reformat in a bit.
2011-09-12 12:04:14 +02:00
Marijn Haverbeke
64a6376da5 Register new snapshot 2011-09-12 11:25:19 +02:00
Marijn Haverbeke
8b7909afd7 Fix tests for new argument-passing convention 2011-09-12 11:07:20 +02:00
Marijn Haverbeke
0e6e56ca60 Make the names of the arg mode tag reflect their (revised) meaning 2011-09-12 11:07:17 +02:00
Marijn Haverbeke
4be7e1e5cd Pass all arguments by reference, make immut alias mode equiv to value
Arguments that can't be safely referenced will be implicitly copied.

(Warnings for expensive copies will be forthcoming.)

This will allow us to get rid of most of the ampersands in function
signatures. See [1].

[1] https://mail.mozilla.org/pipermail/rust-dev/2011-September/000759.html
2011-09-12 11:06:54 +02:00
Brian Anderson
6ffcfba6b9 XFAIL bench/shootout-nbody
This is the only file in the whole codebase that depends on the (broken) llvm
native ABI.
2011-09-11 23:19:05 -07:00
Brian Anderson
cb50e4329a Add an XFAILed test for native "llvm" modules
This functionality is completely broken
2011-09-11 23:14:42 -07:00
Brian Anderson
fda196769a Actually fail the process when compiletest has a test failure
We previously failed by coincidence because of memory leaks.
2011-09-11 21:13:59 -07:00
Brian Anderson
69d6e0d208 Add some more unwind tests
They worked without modifications, but I wrote them so we're keeping them.

Issue #236
2011-09-11 17:31:41 -07:00
Brian Anderson
e193c9c1d6 Don't check-fast xfail-win32 tests 2011-09-11 17:31:41 -07:00
Brian Anderson
7940382070 XFAIL run-pass/task-comm-15 on win32 again
Maybe it works with check-fast, but it stills fails for me
2011-09-11 17:31:41 -07:00
Brian Anderson
be9fe24220 XFAIL some run-pass unwinding tests on win32
Curiously, because of some unfortunate interaction between win32 hacks, all the
run-fail unwind tests actually pass (that wouldn't be the case if we were
valgrinding though).
2011-09-11 17:31:40 -07:00
Brian Anderson
d00be1d962 Add the ability to xfail tests by platform
We'll use this to xfail some unwinding tests on windows
2011-09-11 17:31:40 -07:00
Brian Anderson
22001d1dce Remove hack_allow_leaks
Happy to close the loop on this one.

Issue #236
2011-09-11 17:31:40 -07:00
Brian Anderson
d267e7486e Zero locals when the initializer might call a function
The function might fail, leaving the local uninitialized

Issue #236
2011-09-11 17:31:40 -07:00
Brian Anderson
0ea55ffdc8 Use a unique exit status when the runtime fails normally
Check for it in run-fail tests
2011-09-11 17:31:40 -07:00
Brian Anderson
6f6f36172b Remove unused task_exit function
Issue #236
2011-09-11 17:31:40 -07:00
Brian Anderson
118194381c Invoke put functions
Issue #236
2011-09-11 17:31:40 -07:00
Brian Anderson
5b7145a9f4 Add an XFAILed test for failing destructors
Issue #236
2011-09-11 17:31:39 -07:00
Brian Anderson
53f7d6119a Add some FIXMEs about unwinding implementation
Issue #236
2011-09-11 17:31:39 -07:00
Brian Anderson
e8a16353ea Remove the no-valgrind test directive now that unwinding is more worky
Issue #236
2011-09-11 17:31:39 -07:00
Brian Anderson
a7c9f817bb XFAIL run-fail/linked-failure
This test is hitting a bug in the runtime that makes it fail incorrectly and
not valgrind-clean
2011-09-11 17:31:39 -07:00
Brian Anderson
f28bbb2f95 Begin valgrinding some run-fail tests that unwind correctly
Issue #236
2011-09-11 17:31:39 -07:00
Brian Anderson
f99cf2d62f Add a number of unwinding tests
Issue #236
2011-09-11 17:31:39 -07:00
Brian Anderson
4fba02c7e9 Invoke upcall_fail
This allows landing pads to be generated around fail statements

Issue #236
2011-09-11 17:31:38 -07:00
Brian Anderson
4c9eee8aa4 Run cleanups during unwinding
Issue #236
2011-09-11 17:31:38 -07:00
Brian Anderson
587b863772 Zero locals that have initializers that might fail
This will avoid running cleanups on uninitialized memory

Issue #236
2011-09-11 17:31:38 -07:00
Brian Anderson
4eb3ce3280 Add landing pads to invokes
Issue #236
2011-09-11 17:31:38 -07:00
Brian Anderson
5e4637b61f Add Rust definitions for new LLVM EH instructions
Issue #236
2011-09-11 17:31:38 -07:00
Brian Anderson
4bced5e5f2 Use invoke to call (most) rust functions
No landing pads yet.

Issue #236
2011-09-11 17:31:38 -07:00
Brian Anderson
9f4b4d89ce Add upcall_rust_personality
This just wraps __gxx_personality_v0 with our upcall naming convention

Issue #236
2011-09-11 17:31:38 -07:00
Brian Anderson
f1e348ce6a Change the exit status used for valgrind errors and check for it in tests 2011-09-11 17:31:37 -07:00
Brian Anderson
a1131748c2 Add a waitpid wrapper to std::run that interprets the exit status on unix
This makes the result of running a program a little more uniform between unix
and windows
2011-09-11 17:31:34 -07:00
Jesse Ruderman
476bbca87a Fuzzer: move tys around in addition to exprs 2011-09-10 18:55:09 -07:00
Jesse Ruderman
8df7c2b0d4 Fuzzer: first steps of making steal_exprs more generic 2011-09-10 14:51:33 -07:00
Jesse Ruderman
cdf30c2b29 ivec_fuzz: use vec::reversed 2011-09-10 12:12:44 -07:00
Jesse Ruderman
9245228f94 ivec_fuzz: remove obsolete comments 2011-09-10 12:03:13 -07:00
Jesse Ruderman
fe4227df04 ivec_fuzz: require shared types, because that's what vec::slide requires 2011-09-10 12:02:24 -07:00
Jesse Ruderman
5ef27245b1 Fuzzer: Refactor check_whole_compiler so it doesn't halt the fuzzer when it finds a bug. 2011-09-10 00:51:07 -07:00
Jesse Ruderman
8e1902f30f Fuzzer: update lists of known bugs 2011-09-09 22:31:26 -07:00
Jesse Ruderman
7182054416 Add missing arm, so pretty-printing the statement 'copy 1;' does not die. 2011-09-09 21:27:07 -07:00
Jesse Ruderman
8e00161819 Make the pretty printer disambiguatae blocks followed by vec expressions.
Semicolons are needed here now that postfix [] is used for vec indexing (the syntax change made in rev 518dc52f85).
2011-09-09 19:47:40 -07:00
Jesse Ruderman
ce432d4cf9 Fuzzer: remove exclusions for some issues that have been fixed 2011-09-09 17:31:08 -07:00
Marijn Haverbeke
db15591d89 Revert "Make for loops alias the vec elements, rather than copy them"
This reverts commit 985ef59efd.
2011-09-09 16:53:45 +02:00
Marijn Haverbeke
3ac59b0ee0 Get rid of vp2i in object field access
Closes #557
2011-09-09 15:53:10 +02:00
Marijn Haverbeke
985ef59efd Make for loops alias the vec elements, rather than copy them
The alias analysis was already assuming that it worked like this.
2011-09-09 15:34:13 +02:00
Marijn Haverbeke
0eb56e60d2 Get rid of trans::iter_sequence, use tvec::iter_vec instead 2011-09-09 15:06:06 +02:00
Marijn Haverbeke
9fb3ec95e0 Use a Phi node in trans_vec::iter_vec_raw
Rather than incrementing a spilled pointer
2011-09-09 14:20:15 +02:00
Marijn Haverbeke
139b1d1b31 Get rid of some unused upcalls
I guess these became obsolete when the communication stuff moved into
the stdlib.
2011-09-09 14:02:07 +02:00
Marijn Haverbeke
bd2ec03771 Remove unused logging upcalls from runtime 2011-09-09 13:55:43 +02:00
Marijn Haverbeke
e57435f68b Don't put 0-length array in the lltype of an arg-less variant
This seems to confuse LLVM in some very specific situations.

Closes #883
2011-09-09 13:51:15 +02:00
Marijn Haverbeke
b6e6f8b810 Fix scope issue in resolution of alt-arm patterns
Closes #885
2011-09-09 12:13:18 +02:00
Patrick Walton
87c6416d0c rt: Don't double-print commas when logging e.g. a vec of boxes 2011-09-08 13:24:21 -07:00
Patrick Walton
fb9ab95a15 rustc: When revoking a cleanup of a unique pointer, zero it out so that the GC won't try to visit it 2011-09-08 10:24:25 +02:00
Patrick Walton
7a0c9759fe rustc: Make unique pointers no longer immediates. 2011-09-08 10:24:14 +02:00
Brian Anderson
9946e467ff Export tag discriminants even for single-variant tags
I don't know exactly what's going on but this optimization is giving
me problems with the check-fast runner. I also don't see how it is
correct for external tags.
2011-09-07 10:32:58 -07:00
Brian Anderson
c047cfb710 Unwind the stack on task failure
When a task fails, we will throw an exception, then catch it at the bottom of
the stack.

On Windows we don't do this yet because the exception doesn't propagate
correctly.

No cleanups yet.

Issue #236
2011-09-07 10:32:58 -07:00
Brian Anderson
c337fd5467 Child tasks take a ref to their parents
This is so that when a child dies after the parent, it still holds a valid
pointer and can call supervisor->kill() safely.
2011-09-07 10:32:58 -07:00
Brian Anderson
25ae3d655c Rewrite spawn yet again
The motivation here is that the bottom of each stack needs to contain a C++
try/catch block so that we can unwind. This is already the case for main, but
not spawned tasks.

Issue #236
2011-09-07 10:32:58 -07:00
Brian Anderson
bb08ffbaf4 Refactor task failure a bit
Issue #236
2011-09-07 10:32:58 -07:00
Marijn Haverbeke
1339d05434 Work around destructuring bug 2011-09-07 17:01:46 +02:00
Marijn Haverbeke
f3edf8dd5e Make it possible to take the value of (and bind) native fns
Closes #820
2011-09-07 12:12:20 +02:00
Tim Chevalier
8ab02f7b21 Forbid blocks from deinitializing upvars
Move expressions where the RHS is an upvar are now forbidden within
block expressions.
2011-09-06 15:27:48 -07:00
Patrick Walton
d3e8887d3c rt: Implement poison-on-free, for debugging memory issues 2011-09-06 14:15:01 -07:00
Brian Anderson
23210a3293 Remove unused runtime functions. Issue #855 2011-09-03 00:50:57 -07:00
Brian Anderson
470eb3a58b Register new snapshots 2011-09-03 00:47:11 -07:00
Brian Anderson
1b67d211b4 Add a rust_str typedef to the runtime. Issue #855 2011-09-02 22:11:46 -07:00
Brian Anderson
01b254b411 Rename istr-stuff to str in the runtime. Issue #855 2011-09-02 22:11:46 -07:00
Brian Anderson
a1d71995ec Rename istr-stuff to str in rustc. Issue #855 2011-09-02 22:11:46 -07:00
Brian Anderson
f1555e2ca8 Rename ty_istr to ty_str. Issue #855 2011-09-02 22:11:46 -07:00
Brian Anderson
6217ce958e Print the type of istrs as 'str' in error messages. Issue #855 2011-09-02 22:11:46 -07:00
Brian Anderson
b16457627c Stop parsing transitional istr forms. Issue #855 2011-09-02 22:11:46 -07:00
Brian Anderson
c8fba11bd3 Remove transitional code from combine-tests.py. Issue #855 2011-09-02 22:11:46 -07:00
Brian Anderson
5c49e4f4e9 Reformat. Issue #855 2011-09-02 22:11:42 -07:00
Tim Chevalier
b5f9053423 Add a constraint to trans::type_of
trans::type_of now has a constraint saying that its type argument
is statically sized. This eliminates the "impossible happened" case
in type_of. Yay!

I note that this change decreased translation time for stage2/rustc
from 16.1 s to 14.0 s. I also think many of the remaining checks
could be eliminated with some mildly clever use of constrained types
and further preconditions. Future work!
2011-09-02 19:35:17 -07:00
Tim Chevalier
bdd0417cec Handle if-check with no else correctly in typestate
Propagate the if-check constraint into the consequent even when
there's no else branch. (Oops!)
2011-09-02 19:05:27 -07:00
Patrick Walton
b329324f71 rustc: Zero out unique pointers after we drop them 2011-09-02 17:51:28 -07:00
Brian Anderson
477c1bf6e1 Remove rustc::syntax::untyped_ast. Dead code 2011-09-02 16:40:59 -07:00
Brian Anderson
1e8200dadd Rename std::vec::unsafe::ivec_repr to vec_repr. Issue #855 2011-09-02 15:13:41 -07:00
Brian Anderson
72c14d5a41 Eliminate const_refcount. Issue #855 2011-09-02 15:13:41 -07:00
Brian Anderson
99ee0fca67 Remove estrs and evecs from runtime. Issue #855 2011-09-02 15:13:41 -07:00
Patrick Walton
e68f687179 rustc: Root values spilled via do_spill() 2011-09-02 15:12:27 -07:00
Patrick Walton
00470fef12 rt: Remove evecs from the shape code 2011-09-02 10:49:03 -07:00
Patrick Walton
10ea787772 test: Add a test case for linearize_ty_params() and shapes 2011-09-02 10:39:05 -07:00
Patrick Walton
670b60f027 rustc: Make the shape-emitting code aware of linearized type parameters 2011-09-02 10:27:08 -07:00
Marijn Haverbeke
785c26f7f4 Rename ivecs to vecs in the compiler 2011-09-02 16:09:41 +02:00
Marijn Haverbeke
a0e2809f54 Remove remaining evec support from trans 2011-09-02 15:56:59 +02:00
Brian Anderson
9c173f17c0 Remove lots of estr code from rustc. Issue #855 2011-09-01 23:25:33 -07:00
Brian Anderson
1d3eb4911a Remove #ifmt. Issue #855 2011-09-01 18:54:06 -07:00
Brian Anderson
418d09e547 Convert all uses of #ifmt to #fmt. Issue #855 2011-09-01 18:54:03 -07:00