Commit graph

5325 commits

Author SHA1 Message Date
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