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
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
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
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
Tim Chevalier
172df2e3a2
Add non_ty_var precondition for type_of_fn, plus minor cleanup
2011-09-16 10:58:02 -07:00
Marijn Haverbeke
ad470d741e
Revert "Saner approach to lvalues and callable values in trans"
...
This reverts commit 66153436c9070386786c8a38cde199b5d3e71289.
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
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
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
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
7298b8f4ba
Insert omitted semicolons for statements
2011-09-15 09:49:00 +02:00
Brian Anderson
31d4fe37f6
Revert "Try a little harder to avoid creating new landing pads"
...
This reverts commit b8e31ac46917edcf5922f0b191c5e6c4505830d2.
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