Michael Sullivan
c4bcd0a44d
Move collect_upvars into its own file.
2011-07-19 12:01:13 -07:00
Patrick Walton
2e6197aa95
rustc: Report how much time was spent to translate each function when --stats is on
2011-07-19 11:57:15 -07:00
Marijn Haverbeke
a0ab57b3f6
Fix trans_alt to handle unreachable branches without blowing up
2011-07-19 17:07:51 +02:00
Patrick Walton
ce3d6339e0
rustc: Translate locals in DPS style
2011-07-18 18:28:36 -07:00
Patrick Walton
242ec22032
rustc: Remove obsolete TODO
2011-07-18 18:02:11 -07:00
Patrick Walton
07a68df3b7
rustc: Skip null when translating string concatenation
2011-07-18 18:00:45 -07:00
Patrick Walton
08eabde97b
rustc: First stab at implementing interior vector concat in the DPS engine
2011-07-18 17:43:24 -07:00
Lindsey Kuper
7d4903544e
Don't use 'obj_info' as an identifier for things not of type obj_info.
2011-07-18 17:05:41 -07:00
Lindsey Kuper
b6fc86ae5a
Sane error message for self-call in non-obj context. Closes #707 .
2011-07-18 15:58:36 -07:00
Brian Anderson
c40d6265ce
Support x86 stdcall convention
...
This allows rust to call the Win32 API
2011-07-18 13:56:15 -07:00
Patrick Walton
682875929e
rustc: Stub binary operator translation
2011-07-18 00:24:21 -07:00
Patrick Walton
437b776100
rustc: Simplify the destination format in the DPS backend; optimize aliases to interior strings to require no allocation at all
2011-07-17 22:30:13 -07:00
Patrick Walton
22db8b1d53
rustc: Use memmove instructions more aggressively in DPS mode. LLVM converts these to optimized block transfer instructions, significantly reducing code size.
2011-07-17 14:02:39 -07:00
Patrick Walton
652da4ca55
rustc: Implement immediates in the DPS engine; it should now always be at least as efficient as the original engine (and typically much more).
2011-07-16 10:54:12 -07:00
Patrick Walton
88574c3cea
rustc: Implement interior string logging in DPS
2011-07-15 18:37:57 -07:00
Patrick Walton
f6f7f61908
rustc: Implement logging in DPS
2011-07-15 18:00:59 -07:00
Patrick Walton
0bd7b803f6
rustc: Translate literals in DPS style; no constification of strings yet.
2011-07-15 16:40:55 -07:00
Patrick Walton
6e114a367f
rustc: Write names of local variables into the LLVM IR when debug mode is on
2011-07-15 16:40:55 -07:00
Michael Sullivan
c610d027d9
gather_locals shouldn't descend down into fns and items.
2011-07-15 14:42:59 -05:00
Michael Sullivan
7caf8a0929
Convert gather_locals to use visit.
2011-07-15 14:24:09 -05:00
Patrick Walton
9fadab64a2
rustc: Introduce a stub destination-passing-style translation engine, accessible via the --dps switch for now
2011-07-15 11:38:46 -07:00
Patrick Walton
917afa4cc9
rustc: Remove a bunch of exterior vectors
2011-07-15 11:38:46 -07:00
Lindsey Kuper
a716eb28ec
Getting rid of unnecessary casts for objects.
...
Now that all objects are of rust_object_type in the wake of the LLVM
type system rewrite, we don't need this cast anymore.
2011-07-15 10:55:31 -07:00
Eric Holk
827e300485
refactor: Move the task and communication-related translation functions to a new module.
2011-07-14 17:33:28 -07:00
Michael Sullivan
e9a6fc94d5
Make collect_upvars know about function args.
...
Closes #697 .
2011-07-14 19:18:56 -05:00
Michael Sullivan
a3301f74f9
Generalize collect_upvars to work over any type of ast node.
2011-07-14 19:18:56 -05:00
Eric Holk
8afb1a7c63
refactor: Move the LLVM type and constant constructors into a new module.
2011-07-14 17:08:45 -07:00
Michael Sullivan
e2fcd29bbd
Consolidate some arguments in typeck by just passing the record they came from.
2011-07-14 18:45:55 -05:00
Michael Sullivan
53c4cb6a2f
Factor out build_environment's code to find a variable in a function context.
2011-07-14 18:45:02 -05:00
Michael Sullivan
759317ca8b
Factor out closure construction from trans_for_each.
2011-07-14 18:45:01 -05:00
Michael Sullivan
0957525cc6
Fix array out of bounds index in load_environment.
...
Closes #696 .
2011-07-14 18:34:43 -05:00
Rafael Ávila de Espíndola
c124a025bf
Move rustc to the new llvm type system. Requires an update to llvm trunk.
2011-07-14 15:19:17 -04:00
Patrick Walton
e76f44453b
rustc: First stab at interior string literals, untested as of yet
2011-07-14 11:47:20 -07:00
Brian Anderson
f4beac4a43
Revert "Allow main to return int"
...
This reverts commit 8c94d8fd54
.
There's no mechanism to actually return the value from main, so all this does
is allow main -> int to compile. Per #688 , the program returns non-zero on
failure, so it's not obvious that this change is appropriate at this time.
2011-07-14 10:37:28 -07:00
Rafael Ávila de Espíndola
7376e751ae
Keep a pointer to rust_object_type.
2011-07-14 12:07:51 -04:00
Rafael Ávila de Espíndola
40f617390d
Main part of the type system rewrite:
...
Change the type of all objects to be { {}*, {}* }.
2011-07-14 00:34:45 -04:00
Brian Anderson
8c94d8fd54
Allow main to return int
2011-07-13 19:22:53 -07:00
Tim Chevalier
f26ca025de
Make resolve and the typechecker check for a main fn of the
...
correct type
This means if a non-library program leaves out the main program,
the error gets caught earlier than link.
Closes #626 .
2011-07-13 18:30:53 -07:00
Patrick Walton
196753e4c3
rustc: Remove some interior vectors from ty, except the ones that I think were causing crashes before
2011-07-13 17:39:33 -07:00
Rafael Ávila de Espíndola
c94fc7aad8
Small cleanups that were missing in the last patch.
2011-07-13 20:21:17 -04:00
Rafael Ávila de Espíndola
9036758191
Next step in the type system change. Add task_type to the context.
2011-07-13 20:07:16 -04:00
Patrick Walton
2a3ab10f20
rustc: Remove exterior vectors from resolve again
...
This reverts commit 6390c43dc4
.
2011-07-13 16:44:39 -07:00
Rafael Ávila de Espíndola
3d353f76a9
First step in the typesystem rewrite:
...
Create the typedesc type in one place. That is where it will be named.
2011-07-13 19:37:19 -04:00
Graydon Hoare
39151f2ad8
Prohibit trailing whitespace under 'tidy' script. Clean up all caught cases.
2011-07-13 15:44:09 -07:00
Tim Chevalier
04b239f3cb
Use more precise spans in error messages for bad FRU exprs
...
The type error message for an expression using FRU where a field
expression had the wrong type was using the span for the entire
expression. Fixed it to use the span for the individual field.
Closes #628 .
2011-07-13 15:30:30 -07:00
Marijn Haverbeke
8d68b0462a
Refactor out some repetetive code in trans_alt
2011-07-13 11:33:46 +02:00
Marijn Haverbeke
be4f7354b4
Add box patterns
...
An @ can now be prepended to a pattern to unbox something during
pattern matching.
Closes #661
2011-07-13 11:11:43 +02:00
Marijn Haverbeke
6cb5c0980a
box patterns, expect for the trans part
2011-07-13 10:50:16 +02:00
Marijn Haverbeke
6914d32acc
Do not allow moving out of obj fields, properly check move inits
...
Closes #591
2011-07-13 10:23:13 +02:00
Patrick Walton
729fa81d3b
Revert "rustc: Remove some exterior vectors from ty.rs"
...
This reverts commit 01ea0647bb
.
2011-07-12 18:47:26 -07:00
Patrick Walton
6390c43dc4
Revert "rustc: Remove exterior vectors from resolve"
...
This reverts commit 0ffe8c81c3
.
2011-07-12 18:42:58 -07:00
Patrick Walton
79ee267ef4
rustc: Remove the last few exterior vectors from typeck
2011-07-12 18:41:27 -07:00
Patrick Walton
f7ba28573f
rustc: Remove a few scattered uses of exterior vectors from typestate
2011-07-12 18:34:22 -07:00
Patrick Walton
0ffe8c81c3
rustc: Remove exterior vectors from resolve
2011-07-12 18:29:03 -07:00
Patrick Walton
01ea0647bb
rustc: Remove some exterior vectors from ty.rs
2011-07-12 18:21:50 -07:00
Patrick Walton
cdda0fd6d6
rustc: Remove some useless std::vec imports
2011-07-12 18:07:12 -07:00
Brian Anderson
41a3888da7
Fix type inference of fn tail expressions. Closes #680
2011-07-12 16:54:46 -07:00
Patrick Walton
a3add84909
rustc: Remove some interior vectors from typestate and some useless vec-related imports
2011-07-12 16:44:57 -07:00
Marijn Haverbeke
12d5532166
Use switches rather than chained conditionals to compile alt matches
...
This also moves the alt-related trans code into its own file.
Closes #467
2011-07-13 00:38:24 +02:00
Tim Chevalier
f7a1006a07
Make resolve check for type-variable name-shadowing
...
Capturing a type argument in the enclosing scope should be an error --
this commit implements that check in resolve, avoiding a potential
assertion failure in trans.
Closes #648 .
2011-07-12 13:42:05 -07:00
Lindsey Kuper
0d9c08af2a
Remove some obsolete comments.
2011-07-12 12:01:02 -07:00
Lindsey Kuper
a0b78e649e
"Narrow scope forgives many sins." -- M. Schwern
2011-07-12 12:01:02 -07:00
Patrick Walton
0be1a0b500
rustc: Simplify tritv::copy; shaves a couple of seconds off typestate.
2011-07-12 11:47:32 -07:00
Tim Chevalier
e1f9bfbac9
Add missing files
...
git add didn't, so this actually has the changes that should
have been in the previous commit
2011-07-12 11:26:14 -07:00
Tim Chevalier
0e594939aa
Fix potential use-before-init bug in trans
...
This was being masked by a bug in typestate (fixed in the next commit).
2011-07-12 11:21:14 -07:00
Paul Stansifer
48dbee6b47
Add elipses, reorganize the macro components into their own AST node.
2011-07-11 18:52:50 -07:00
Paul Stansifer
425732311a
Move macro expansion to a separate phase, change macro syntax, and add parse_sess to session.
2011-07-11 18:52:50 -07:00
Tim Chevalier
e1620def9f
In typeck, check for dynamically sized by-value arguments to thunks
...
A check in trans didn't have a corresponding check in typeck, causing
some programs (to wit, compile-fail/chan-parameterized-args.rs - part of this
commit) to fail with an assertion failure in trans instead of a type error.
Fixed it. In short, arguments that are future thunk arguments (any spawn
arguments, and _ arguments in bind) need to either not contain type params
or type vars, or be by-reference.
Closes #665 .
2011-07-11 17:32:00 -07:00
Patrick Walton
05390b4b38
rustc: Implement explicit global scope resolution via leading "::"; add a test case
2011-07-11 16:02:16 -07:00
Tim Chevalier
9427864f33
Unify the rhs and lhs types in a send
...
Closes #662 .
One-line fixes are always the best :-D
2011-07-11 15:24:47 -07:00
Patrick Walton
79ce5a4614
rustc: Implement pointer dereference; add a test case
2011-07-11 15:19:16 -07:00
Michael Sullivan
4618e802db
Fix comparisons of the nil type to do something sensible.
...
Closes #576 .
2011-07-11 14:45:21 -07:00
Marijn Haverbeke
c893188549
Use some actual or-patterns in resolve.rs
2011-07-11 21:23:49 +02:00
Michael Sullivan
7340824cbc
Fix autoderef of function calls when the function is not an lval.
...
As it turns out, the correct way to handle this is much simpler than what I
did originally.
Also add more tests.
2011-07-11 11:38:01 -07:00
Michael Sullivan
cd97f4eed0
Fix handling of derived tydescs in bind.
...
In trans_bind_thunk, we need to load the tydescs from the environment *before*
we try to construct derived tydescs from them.
2011-07-11 11:37:55 -07:00
Michael Sullivan
0beb271d8c
Fix bind to work with boxed arguments with type parameters.
...
This still doesn't work with bare fn arguments with type parameters.
2011-07-11 11:37:55 -07:00
Marijn Haverbeke
7595fe5153
Implement record patterns
...
Closes #469 .
2011-07-11 15:32:41 +02:00
Marijn Haverbeke
12cb128a0a
Move visit to newtype-style nominal type
...
This makes getting the function fields out of the visitor less
cumbersome and more efficient (no take/drop).
2011-07-11 13:53:50 +02:00
Marijn Haverbeke
5f544b1366
Output a meaningful error when too few or too many type parameters given
...
Closes #619
2011-07-11 13:19:34 +02:00
Marijn Haverbeke
86ee3454a1
Implement or-patterns in case clauses
...
You can now say
expr_move(?dst, ?src) | expr_assign(?dst, ?src) { ... }
to match both expr_move and expr_assign. The names, types, and number
of bound names have to match in all the patterns.
Closes #449 .
2011-07-11 11:01:54 +02:00
Marijn Haverbeke
4d325b1a15
Spill instead of copy when binding a pattern that's only a var binding
...
The alias rules guarantee that the alt-ed value will outlive the binding's
last use, so this is safe.
This is a preparation for or-patterns. Joining scoped bindings seems like
it would get messy.
2011-07-11 10:33:19 +02:00
Brian Anderson
e494e73cdd
Use more encapsulation for metadata::cstore
2011-07-10 15:44:11 -07:00
Patrick Walton
f42c94740a
rustc: Make rust-intrinsics take an explicit return pointer
2011-07-09 21:13:25 -07:00
Tim Chevalier
182c413af1
Propagate constraints through copy, move, and swap
...
Assignments and moves with a simple local variable reference on the
RHS now propagate any typestate constraints the RHS was involved
in to the LHS. Swaps where both sides are local variables
exchange the constraints.
This was a pain in the butt and I'm still not proud of the resulting
code. Needs refactoring like whoa.
2011-07-08 22:25:57 -07:00
Tim Chevalier
be6febb46d
Minor refactoring
2011-07-08 22:25:57 -07:00
Tim Chevalier
36c4cb37ad
Improve impossible-case handling in ty::get_element_type
2011-07-08 22:25:57 -07:00
Brian Anderson
7498d03693
Improve the error message for import glob collisions. Closes #482
...
Instead of noting where the imported things were defined, note where they were
imported. This is more useful and avoids issue #482 .
2011-07-08 18:55:01 -07:00
Patrick Walton
1ff426b89f
rustc: Use interior vectors for the union-find in rustc
2011-07-08 17:00:21 -07:00
Patrick Walton
8450ab9a2b
rustc: Fix a level-of-indirection problem by using size_of() to compute dynamically sized interior vector element sizes instead of field_of_tydesc()
2011-07-08 16:37:43 -07:00
Rafael Ávila de Espíndola
94f0e9d956
Add just enough logic to the driver so that we can link std statically.
2011-07-08 15:05:32 -04:00
Patrick Walton
7c66894a71
rustc: Do dynamic size calculations properly when concatenating interior vectors. Closes #640 .
2011-07-08 11:29:29 -07:00
Brian Anderson
d0a432f4bb
Don't export tyencode from the metadata module
...
This involves pulling the type_abbrev cache out of crate_ctxt
2011-07-08 09:37:01 -07:00
Brian Anderson
06391dda02
Make the interface to metadata::csearch more consistent
2011-07-08 09:37:01 -07:00
Brian Anderson
7ae711fc03
Begin splitting metadata::decoder into decoding and crate search modules
2011-07-08 09:37:01 -07:00
Brian Anderson
29b766029c
Move external crate/lib resolution to its own pass
...
The scope of external crate reading is beyond the resolve pass now, as it
builds up tables of information needed for several different purposes.
2011-07-08 09:37:01 -07:00
Brian Anderson
85535fc3e0
Move crate_map from resolve to cstore
2011-07-08 09:37:00 -07:00
Brian Anderson
82983e5005
Replace the crate cache in session with the one in cstore
2011-07-08 09:37:00 -07:00
Marijn Haverbeke
c7bfef43c8
Ignore current scope when resolving self-shadowing imports
...
That is, for example, import x::y::x, which defines a local x,
and thus wouldn't be able to find x::y anymore.
Closes issue #624
2011-07-08 16:04:40 +02:00
Marijn Haverbeke
eeda0f4ab1
Don't unbox types in ty::is_binopable, do it on typeck side instead
...
Closes issue #631
Removes ty::strip_boxes entirely, since unboxing is now more complicated
anyway.
2011-07-08 15:52:54 +02:00
Marijn Haverbeke
381505f947
Remove useless return value in typeck::check_decl_local
2011-07-08 15:01:54 +02:00