Brian Anderson
2f340a4d3d
rpath the path to the runtime
...
We don't currently rpath native libs, but we do know where rustrt is
located and everything needs to link to it.
2011-10-05 16:21:55 -07:00
Brian Anderson
3d5471f6ab
Fix some remaining rpath bugs
2011-10-05 16:21:55 -07:00
Brian Anderson
8b4601e08e
Figure out the relative path from output to each crate
2011-10-05 16:21:55 -07:00
Brian Anderson
19ba9b4d8d
Begin work on rpath
2011-10-05 16:21:55 -07:00
Patrick Walton
100e0264b2
rustc: Add a workaround for a segfault with --time-passes (issue #1005 ).
2011-10-05 14:35:30 -07:00
Marijn Haverbeke
142f63fe78
Tie up the last ends in destination-passing-conversion
...
Closes #667
2011-10-05 12:23:18 +02:00
Marijn Haverbeke
3bc3f96138
Make trans_lval lval-only
...
Call trans_temp_lval if you want the old fallback-to-temporary behaviour.
Issue #667
2011-10-05 11:51:41 +02:00
Marijn Haverbeke
2cc0008ec0
Add trans_temp_expr for what used to be trans_expr, rename t_e_dps to trans_expr
...
Issue #667
2011-10-05 11:26:27 +02:00
Marijn Haverbeke
975ac55b3d
Lose the by_ref destination style
...
It's not needed.
Issue #667
2011-10-05 10:41:30 +02:00
Marijn Haverbeke
babd1ff3c7
Revert "Revert "Reorganize translation of expr_field""
...
This reverts commit 11e407aaa9
.
2011-10-05 10:21:57 +02:00
Marijn Haverbeke
c33e61e75c
Revert "Revert "Get rid of 'overwrite' destination kind""
...
This reverts commit ce9e0fc94f
.
2011-10-05 10:21:48 +02:00
Marijn Haverbeke
062aa3272c
Revert "Revert "Move trans_call to destination_passing style""
...
This reverts commit 276dfc6133
.
2011-10-05 10:21:40 +02:00
Brian Anderson
1f2e999262
Use std::os::get_exe_path to determine sysroot
2011-10-04 21:35:06 -07:00
Brian Anderson
1391154b14
Use util::filesearch to locate intrinsics.bc and main.o
2011-10-04 21:35:06 -07:00
Brian Anderson
ebcc76d68d
Move the library search into util::filesearch
2011-10-04 21:35:06 -07:00
Brian Anderson
b25e78524c
Fix some comment drift
2011-10-04 21:35:06 -07:00
Brian Anderson
33ee73102d
Remove some redundancy in metadata::creader
2011-10-04 21:35:06 -07:00
Brian Anderson
d91b7b61ef
Encapsulate current sysroot and lib path handling into util::filesearch
2011-10-04 21:35:06 -07:00
Patrick Walton
990233eb3d
rustc: Allow calling native functions on the C stack that take generic arguments. They get turned into i8 pointers.
2011-10-04 17:41:57 -07:00
Patrick Walton
276dfc6133
Revert "Move trans_call to destination_passing style"
...
This reverts commit 6e56ec0066
.
2011-10-04 17:05:35 -07:00
Patrick Walton
ce9e0fc94f
Revert "Get rid of 'overwrite' destination kind"
...
This reverts commit 6e652588bf
.
2011-10-04 17:05:27 -07:00
Patrick Walton
11e407aaa9
Revert "Reorganize translation of expr_field"
...
This reverts commit 007ec666ad
.
2011-10-04 17:05:16 -07:00
Marijn Haverbeke
007ec666ad
Reorganize translation of expr_field
...
Issue #667
2011-10-04 17:52:23 +02:00
Marijn Haverbeke
6e652588bf
Get rid of 'overwrite' destination kind
...
It wasn't safe (computing the rval might invalidate the lval addr), and needlessly
complicating things (code was already building up intermediary results to work
around other unsafeties).
Issue #667
2011-10-04 17:52:23 +02:00
Marijn Haverbeke
6e56ec0066
Move trans_call to destination_passing style
...
Issue #667
The retptr passed to a function will now often be the actual
destination of the returned value (as in `{field1: func1()}`).
2011-10-04 17:41:34 +02:00
Patrick Walton
968b66ad40
rustc: Implement C stack stdcall
2011-10-03 13:59:38 -07:00
Haitao Li
e50371060b
rustc: Fix link error on Ubuntu Oneiric. Issue #903
2011-10-02 21:29:16 +08:00
Patrick Walton
42287d0fd3
rustc: Call LLVM on the C stack
2011-09-30 18:50:07 -07:00
Patrick Walton
e9287e55cc
rustc: Stub a --stack-growth option; it's behind a flag for now because it requires patches to LLVM.
2011-09-30 18:21:39 -07:00
Brian Anderson
821dd6c02c
Change the directory for target libs
...
This pushes them down from stageN/lib/rustc/$(target) to
stageN/lib/rustc/$(target)/lib in order to make room for a target bin dir
2011-09-30 17:19:24 -07:00
Patrick Walton
c065280a0b
rustc: Remove some debug code
2011-09-30 14:26:06 -07:00
Patrick Walton
7ab0897ac6
rustc: Track link_args attributes on C stack cdecl natives as well
2011-09-30 14:25:10 -07:00
Patrick Walton
dcf0e807fb
trans: Use inttoptr as appropriate when casting return values of C stack functions
2011-09-30 12:07:50 -07:00
Brian Anderson
80829af872
Remove legacy library search paths
2011-09-29 23:12:31 -07:00
Brian Anderson
ab8338fb5a
Make rustc's host triple agree with the build system's
2011-09-29 22:58:33 -07:00
Brian Anderson
0148daa058
Reorganize structure of build directory
...
Each stage is organized more according to Unix standards and to
accommodate multiple target architectures.
stageN/
bin - rustc lives here
lib - libraries that rustc needs
lib/rustc/$(target_triple/ - target libraries
2011-09-29 22:58:33 -07:00
Patrick Walton
79e4961c7f
rustc: Remove some debug code
2011-09-29 18:53:00 -07:00
Patrick Walton
f9e3a604a6
rustc: Make the generic C stack function signature include a usable return value
2011-09-29 18:52:23 -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
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
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
Patrick Walton
f7d0c1cec3
rustc: Add a new "C stack cdecl" native ABI
2011-09-28 12:58:33 -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
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
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
Brian Anderson
888e22aacc
Add more comments about kind checking on local move initializers
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
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
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
6b42ad5ea0
Enforce copy restrictions on let initializers
2011-09-26 22:00:15 -07:00
Jesse Ruderman
20c2d2a999
Distinguish #924
2011-09-26 20:44:57 -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
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
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
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
Brian Anderson
98db2febd3
Handle ~fail. Closes #968
2011-09-24 23:52:22 -07:00
Brian Anderson
4f7ecce7d1
Support non-immediates in trans_uniq::copy_val
...
Issue #409
2011-09-24 21:28:58 -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
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
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
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
2082f67765
Begin to support pattern matching on unique boxes
...
Issue #409
2011-09-23 15:15:30 -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
Graydon Hoare
18c6cc6371
More steps to arch-specific target libs ( #474 )
2011-09-23 10:50:16 -07: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
dbd2ee015a
Remove is_stateful flag from tydesc. Closes #136
2011-09-22 22:15:25 -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
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
30a4eab380
Autoderef indexes and fields of unique boxes
...
Issue #409
2011-09-22 16:06:25 -07:00
Brian Anderson
d174d917e2
Calculate the correct kind for unique boxes
...
Issue #409
2011-09-22 15:28:49 -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
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
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
Brian Anderson
42fd2a9d89
Remove unused arg from revoke_clean
2011-09-21 15:39:46 -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
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
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
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
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
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
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
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 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
Graydon Hoare
1e3e7d4bc5
Update README slightly.
2011-09-15 16:31:33 -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
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
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
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