Brian Anderson
1c9277e0d3
rustc: Make room in remaining AST item nodes for attributes
...
Issue #487
2011-06-15 09:48:55 -07:00
Brian Anderson
31116dcdd5
rustc: Make room in item_mod for metadata
...
Issue #487
2011-06-15 09:46:37 -07:00
Marijn Haverbeke
c7ab88cc35
Implement checking against assignments to immutable obj fields
2011-06-15 14:59:51 +02:00
Marijn Haverbeke
0ddade3d7a
Extend alias analysis to check assignments
...
This is a somewhat odd place to put these checks, but the data tracked
by that pass, and the available functions, make it trivial to do such
a check there.
2011-06-15 14:10:07 +02:00
Marijn Haverbeke
5fb518abc9
Fix assignments to immutable fields throughout the code
2011-06-15 14:10:07 +02:00
Marijn Haverbeke
180db08470
Refactor expr_root in alias.rs
...
It was too clunky and specific before. Now returns a vec of dereference specs
instead of a bunch of special-case information. Further accessors extract
the information they need from this vec.
2011-06-15 11:03:23 +02:00
Patrick Walton
ac743cfcb0
Merge pull request #490 from msullivan/fix_vec_append
...
Move the implementation of vec_append from llvm assembly to a regular upcall
2011-06-14 18:32:04 -07:00
Patrick Walton
c6be352f73
rustc: Implement on-heap resizing for interior vectors
2011-06-14 18:23:13 -07:00
Michael Sullivan
ccd1bcf7a7
Make tydesc glue functions use cdecl.
2011-06-14 16:09:21 -07:00
Michael Sullivan
5378f48a03
Remove vec_append_glue from the compiler.
2011-06-14 16:09:17 -07:00
Patrick Walton
14258b87a7
rustc: Free heapified interior vectors
2011-06-14 16:00:30 -07:00
Patrick Walton
bd18860be7
rustc: Fix LLVM type error that occurred when translating large unique vector literals
2011-06-14 16:00:02 -07:00
Michael Sullivan
95def699f1
Implement upcall_vec_append and use it for vector append.
2011-06-14 15:35:09 -07:00
Tim Chevalier
05b7eb6dff
Make the typechecker check that dynamically sized arguments are passed by alias
...
Before, this would cause an assertion failure in trans.
2011-06-14 15:11:48 -07:00
Tim Chevalier
1513539b67
Improve error message for a failed assert or check
2011-06-14 14:17:28 -07:00
Patrick Walton
bf5840d530
rustc: Do a dynamic alloca for generic interior vectors; fix data pointer calculation when spilling vectors
2011-06-14 14:03:38 -07:00
Marijn Haverbeke
f24408d89a
Don't error when trans_lval is called on a non-lval
...
This allows directly calling a function expression, or the
result of an alt/if/block expression.
2011-06-14 21:38:56 +02:00
Marijn Haverbeke
471436a299
Implement function expressions/anonymous functions
...
Looks like 'fn(..arg..) -> ret {body;}. They don't support type
parameters or upvars yet.
2011-06-14 18:22:46 +02:00
Patrick Walton
c3bf7d07e9
rustc: Implement simple interior vector append translation
2011-06-13 18:57:25 -07:00
Tim Chevalier
a1bb4a4ded
Refactor some typestate-related data structures
2011-06-13 18:21:22 -07:00
Eric Holk
d1857d30fc
This is the mega-ucontext commit. It replaces the task switching mechanism with a new one inspired by ucontext. It works under Linux, OS X and Windows, and is Valgrind clean on Linux and OS X (provided the runtime is built with gcc).
...
This commit also moves yield and join to the standard library, as requested in #42 . Join is currently a no-op though.
2011-06-13 18:14:13 -07:00
Brian Anderson
1595c9d767
rustc: Assignment expressions have nil type. Closes #483
2011-06-13 17:57:43 -07:00
Tim Chevalier
d65ad8c31c
Change decl to local in expr_for and expr_for_each
...
Since the decl in a for or for-each loop must always be a local
decl, I changed the AST to express this. Fewer potential match
failures and "the impossible happened" error messages = yay!
2011-06-13 17:33:04 -07:00
Patrick Walton
913383d775
rustc: Preserve more type information for interior vectors at the LLVM level, allowing SROA to take place. log ~[ 2 ].(0)
now optimizes to just log 2
.
2011-06-12 00:44:43 -07:00
Patrick Walton
770bf24d72
rustc: Use in-bounds GEPs for fetching length and data of interior vectors
2011-06-11 23:32:21 -07:00
Patrick Walton
4375329031
rustc: Translate interior vector index expressions
2011-06-11 23:15:16 -07:00
Patrick Walton
8b318be4ce
rustc: Typecheck vector index expressions for interior vectors
2011-06-11 19:52:49 -07:00
Patrick Walton
00eb3f5798
rustc: Sketch out translation of interior vector literals and take/drop glue
2011-06-10 19:36:33 -07:00
Tim Chevalier
698c6406ba
Reject programs with unsatisfied predicate constraints
...
Generate appropriate constraints for calls to functions with
preconditions, and reject calls where those constraints don't
hold true in the prestate.
...by which I mean that it works for one test case :-)
2011-06-10 19:17:15 -07:00
Lindsey Kuper
f6d7d75699
More work on typechecking anon objs.
2011-06-10 17:18:08 -07:00
Graydon Hoare
8876e2c29e
Oops, fix logging string specs. Nobody likes writing RUST_LOG=_ZN5rustc5front7creaderE, do they?
2011-06-10 16:32:21 -07:00
Tim Chevalier
774c6d0198
Friendlier error message for break outside a loop
...
The typechecker should really check for this, but at least now
there's an error message rather than an inexhaustive match failure
in trans.
2011-06-10 14:34:01 -07:00
Tim Chevalier
e5eacf8ea9
Use RHS type when translating assignments
...
In code like "auto foo = fail", a type gets inferred for foo
depending on how it's used. However, fail still has type _|_ and
still should be treated that way: particularly, its value shouldn't
be copied. Fixed trans to reflect that.
2011-06-10 14:05:06 -07:00
Patrick Walton
f1431adb40
rustc: Add a generic struct_elt() function to trans
2011-06-10 13:49:22 -07:00
Patrick Walton
451fc176d3
rustc: Derive flags for unsafe pointers. Puts out burning tinderbox.
2011-06-10 13:13:46 -07:00
Graydon Hoare
52c4c9014f
Encode meta tags in the crate and start sketching enhanced logic for resolving crate "use" directives.
...
Now with extra "works on OSX" kludging.
2011-06-10 12:57:29 -07:00
Patrick Walton
4634f236a9
rustc: Add some missing cases to ty.rs for interior vectors, and modify the pattern match so this is less likely to happen again. Add the LLVM type mapping as well.
2011-06-10 12:07:38 -07:00
Patrick Walton
cc3d484d9d
rustc: Add missing cases for istr and ivec to equal_type_structures()
2011-06-10 11:00:56 -07:00
Patrick Walton
7b7c746c1e
Merge pull request #447 from paulstansifer/quick_error_message_fix
...
Error message, instead of segfault, when recursive types are used.
2011-06-10 10:53:42 -07:00
Patrick Walton
dfdd6dbc54
rustc: Remove the bitwise not operator
2011-06-10 10:47:33 -07:00
Lindsey Kuper
7a066ba547
Dead code elimination.
2011-06-10 10:23:48 -07:00
Marijn Haverbeke
1dbf3e8477
Minimal comment for visit.rs
2011-06-10 17:29:34 +02:00
Marijn Haverbeke
97576bd149
Move some uses of walk to visit in trans.rs
2011-06-10 17:24:20 +02:00
Marijn Haverbeke
e25e05539e
Handle mutable references in alias analysis
2011-06-10 16:44:33 +02:00
Marijn Haverbeke
f28796ed99
Fix unsafe uses of mutable references
2011-06-10 16:44:32 +02:00
Marijn Haverbeke
fccf065266
Implement mutable/immutable alias distinction.
...
Before, all aliases were implicitly mutable, and writing
&mutable was the same as writing &. Now, the two are
distinguished, and assignments to regular aliases are
no longer allowed.
2011-06-10 12:15:58 +02:00
Marijn Haverbeke
798bbd2e22
Fix all occurrences of writing to immutable aliases
...
You'd be surprised.
2011-06-10 12:15:28 +02:00
Lindsey Kuper
c51c6ba354
Sketching trans_anon_obj.
2011-06-09 18:16:28 -07:00
Patrick Walton
40e3a9fcbc
Revert "Encode meta tags in the crate and start sketching enhanced logic for resolving crate "use" directives." due to tree bustage
...
This reverts commit ab3635eebe
.
2011-06-09 18:15:13 -07:00
Patrick Walton
60706f1e35
rustc: Write interior vecs and strings into the metadata and add logic for them in ty_to_str
2011-06-09 18:00:46 -07:00
Graydon Hoare
ab3635eebe
Encode meta tags in the crate and start sketching enhanced logic for resolving crate "use" directives.
2011-06-09 17:24:32 -07:00
Patrick Walton
c9c1d860f1
rustc: Report type errors in terms of the actual types involved, not type variables
2011-06-09 17:23:15 -07:00
Patrick Walton
5318248f24
rustc: Annotate vector and string literals in the AST with their uniqueness or lack thereof
2011-06-09 17:11:21 -07:00
Patrick Walton
1c48102838
rustc: Add ty_istr and ty_ivec types
2011-06-09 16:23:19 -07:00
Tim Chevalier
1cc3fe567c
Improve error message for wrong number of type arguments
...
Improve error message in the case where a use of a polymorphic tag has
insufficient type arguments given. Before, the typechecker was
just crashing with a bounds check error.
2011-06-09 14:50:49 -07:00
Patrick Walton
efcf8570f0
rustc: Remove comment dating back to the rustboot days from typeck
2011-06-09 14:19:04 -07:00
Patrick Walton
c7ca08d1b6
rustc: Remove all calls to resolve_all_vars and the function itself
2011-06-09 14:17:50 -07:00
Patrick Walton
06d706e197
rustc: Remove the call to resolve_all_vars when typechecking field exprs
2011-06-09 14:04:11 -07:00
Patrick Walton
3009574165
rustc: Unify with the root types
2011-06-09 14:04:11 -07:00
Marijn Haverbeke
1146136fa8
Fix double import that now somehow gets caught by resolve
2011-06-09 20:48:06 +02:00
Marijn Haverbeke
4ab862a50d
Switch resolve pass to use visit.rs rather than walk.rs
2011-06-09 20:44:04 +02:00
Marijn Haverbeke
d8516178e5
Pass ty params to visit::visit_fn
2011-06-09 20:44:04 +02:00
Tim Chevalier
d1819fb747
Improve an error message in resolve
2011-06-09 11:37:52 -07:00
Tim Chevalier
b34a97de39
Start to check expr_check and expr_call constraints in typestate
...
Start writing the cases for expr_check and expr_call to take
predicates into account, but this isn't working yet.
2011-06-09 11:37:52 -07:00
Tim Chevalier
17ff2a0d79
Further support for predicate constraints
...
Changed function types to include a list of constraints. Added
code for parsing and pretty-printing constraints. This necessitated
splitting pprust into two files (pprust and ppaux) to break a
circulate dependency, as ty_to_str now needs to print out constraints,
which may include literals, but pprust depended on ty.
2011-06-09 11:37:52 -07:00
Patrick Walton
a4663d2845
rustc: Add fast paths for vars and param folds. 3x typechecking speedup.
2011-06-09 11:20:47 -07:00
Patrick Walton
73ae684536
rustc: Don't resolve all type variables eagerly for paths
2011-06-09 10:51:51 -07:00
Marijn Haverbeke
537d879dc1
Properly handle lifetime of aliases in nested blocks
...
There was a bug that would cause the alias analyser to allow you to
invalidate an alias that was no longer directly referred to, even if
another alias was rooted in it. It now properly tracks dependencies
between live aliases.
Required another case of copying values in map.rs.
2011-06-09 14:19:13 +02:00
Marijn Haverbeke
beda82ddf1
A revised, improved alias-checker
...
The old system tried to ensure that the location an alias pointed at
would retain its type. That turned out to not be strong enough in the
face of aliases to the inside of tags.
The new system instead proves that values pointed to by aliases are
not replaced (or invalidated in some other way) at all. It knows of
two sufficient conditions for this, and tries to prove at least of
them:
A) The alias is 'immutably rooted' in a local, and this local is not
reassigned for the lifetime of the alias. Immutably rooted means
the alias refers to the local itself, or to something reachable
from the local through immutable dereferencing.
B) No value whose type might include the type of the 'inner mutable
element' of the thing the alias refers to (for example, the box in
rec(mutable x = @mutable int)) is from the outer scope is accessed
for the lifetime of the alias. This means for functions, no other
argument types may include the alias's inner mutable type. For alt,
for each, and for, it means the body does not refer to any locals
originating from outside their scope that include this type.
The lifetime of an alias in an alt, for each, or for body is defined
as the range from its definition to its last use, not to the point
where it goes out of scope. This makes working around these
restrictions somewhat less annoying. For example, you can assign to
your alt-ed value you don't refer to any bindings afterwards.
2011-06-09 13:11:29 +02:00
Marijn Haverbeke
bd90c7a3cb
Add new visitor framework
2011-06-09 13:08:38 +02:00
Patrick Walton
6feb1dfd76
rustc: Don't eagerly resolve type variables after unification
2011-06-08 18:42:34 -07:00
Patrick Walton
cc7a8b668f
rustc: Make resolve_all_vars() check to see whether the type actually has vars before folding over it; also remove some debug code. 2x typechecking speedup.
2011-06-08 18:05:45 -07:00
Patrick Walton
7527084e62
rustc: Don't generate so many variables when typechecking functions; remove mo_either
2011-06-08 18:05:45 -07:00
Patrick Walton
99c72b98b5
rustc: Use cnames in ty_to_str again; debugging code crept in
2011-06-08 15:49:46 -07:00
Patrick Walton
cc06bd4aa5
rustc: Add some miscellaneous demands that pushdown had previously caught; put out burning tinderbox
2011-06-08 15:33:16 -07:00
Patrick Walton
4571172c03
rustc: Remove pushdown. 15 second improvement.
2011-06-08 12:24:05 -07:00
Graydon Hoare
f54f2799c3
Merge pull request #403 from espindola/newllvm
...
Update rust to build with newer llvm versions.
2011-06-08 11:41:01 -07:00
Rafael Ávila de Espíndola
698022d351
Update rust to build with newer llvm versions.
2011-06-08 14:08:24 -04:00
Patrick Walton
08dcb9306b
rustc: Remove all traces of the unification cache
2011-06-08 10:52:12 -07:00
Rafael Ávila de Espíndola
d360c481e8
Don't force the fetch of main.o from main.a, we are not using main.a anymore.
2011-06-08 13:47:21 -04:00
Josh Matthews
2235fb73ef
Add optional message to fail.
2011-06-08 04:02:55 -04:00
Patrick Walton
0857d22c04
rustc: Print out a real error message on unresolved types. Puts out burning tinderbox.
2011-06-07 23:03:41 -07:00
Patrick Walton
ddec6b5f47
rustc: Use a set-based approach to unification; remove ty_bound_param and ty_local.
...
Sorry, big perf regression; will fix soon.
2011-06-07 19:33:18 -07:00
Graydon Hoare
721c5bbee8
More work on proper linkage name-mangling. Almost right, aside from version numbers.
2011-06-07 18:08:17 -07:00
Lindsey Kuper
a4ca75e6af
For consistency, use ctxt instead of ty_ctxt outside of unify.
2011-06-07 15:18:30 -07:00
Lindsey Kuper
ab69c4a98f
Removing dead code and redundant fails; changing fails to sess.bug
...
calls (issue #444 ).
2011-06-07 14:12:34 -07:00
Rafael Ávila de Espíndola
b1d6f12a05
Don't put a copy of main (the C one) in each binary we produce. This is a step
...
in getting a driver that works on all linux systems.
Sorry for the linker hacks, I will remove them after snapshotting a new compiler.
2011-06-07 16:56:27 -04:00
Graydon Hoare
319156c8d1
Begin tidying up name-mangling rules.
2011-06-06 15:48:47 -07:00
Rafael Ávila de Espíndola
ee54fa5c7d
Implement enough support for pointer to get an identity function working.
2011-06-06 16:36:01 -04:00
Marijn Haverbeke
4bd5f834b0
First take on an alias-safety checker
...
The alias checker works by ensuring that any value to which an alias
is created is rooted in some way that ensures it outlives the alias.
It is now disallowed to create an alias to the content of a mutable
box, or to a box hanging off a mutable field. There is also machinery
in place to prevent assignment to local variables whenever they are
the root of a live alias.
2011-06-06 21:24:03 +02:00
Marijn Haverbeke
2b334f061a
Change unsafe aliases
...
This litters aberrations like 'alt({foo.bar}) { ... }' and f({*baz})
though the code (mostly in trans.rs). These are a way to explicitly
copy the given value so that it can be safely aliased. At some point
we'll probably want a more explicit copy operator.
2011-06-06 21:09:55 +02:00
Brian Anderson
4d8f715dab
rustc: Make resolve::unresolved return !. Remove redundant fails
2011-06-05 00:11:44 -04:00
Lindsey Kuper
2736d63db0
Adding comments; removing dead code.
2011-06-04 19:38:11 -07:00
Lindsey Kuper
5f95766a40
Remove redundant 'fail' exprs and dead code; use sess.bug or
...
sess.span_err instead of 'fail'. (issue #444 )
2011-06-04 18:34:40 -07:00
Lindsey Kuper
69325f815d
More comments.
2011-06-03 17:16:28 -07:00
Lindsey Kuper
dcf7fbf833
Comments and cleanup.
2011-06-03 17:09:50 -07:00
Graydon Hoare
088ab03fdb
Add spans to fields, args, methods. Improve pp of same.
2011-06-03 15:42:42 -07:00
Rafael Ávila de Espíndola
ba74c6cfdc
Boilerplate for pointers. Sorry for missing this on the first patch.
2011-06-03 15:02:58 -04:00
Lindsey Kuper
dc29dead2e
Removing redundant "fail"s.
2011-06-02 18:15:29 -07:00
Patrick Walton
ad9afefa10
rustc: Typecheck patterns from the top down; remove pushdown_pat
2011-06-02 18:11:26 -07:00
Tim Chevalier
ba377c043d
Handle _|_ values properly in trans
...
Generate an LLVMUndef value of the proper type for an argument of
type _|_. Otherwise we get an LLVM assertion failure.
2011-06-02 17:52:04 -07:00
Tim Chevalier
468786e36d
Fix unification bug
...
Hello from SFO Terminal 3!
unify_fn_common had the expected and actual types reversed in one
place. This was causing the type of an occurence of a function f
with type fn(int) -> T to be set to fn(_|_) -> T at a call site like
f(fail); I think this was also making some of the type error messages
come out backwards, but I haven't checked.
Also: ty_bot does not contain pointers
2011-06-02 17:52:04 -07:00
Patrick Walton
c515ed13de
Merge pull request #450 from paulstansifer/quick_error_message_fix_2
...
Flatten functions and objects in trans::simplify_type.
2011-06-02 17:43:11 -07:00
Paul Stansifer
20bd927c3f
Flatten functions and objects in trans::simplify_type.
2011-06-02 17:40:12 -07:00
Lindsey Kuper
3a6b5576ac
Refactor make_fp_cmp_glue and make_integral_cmp_glue into one.
2011-06-02 16:35:25 -07:00
Paul Stansifer
1377e9b341
Implement pcwalton's code review suggestions.
2011-06-02 15:12:17 -07:00
Paul Stansifer
5cd10d2fef
Error message, instead of segfault, when recursive types are used.
2011-06-02 14:03:17 -07:00
Tim Chevalier
24c9d7e5f8
Improve type error message for non-constructor in pattern
2011-06-01 18:15:12 -07:00
Tim Chevalier
1402cd101b
Redo typestate-related data structures to support predicate constraints. No actual support yet, just infrastructure.
2011-06-01 18:14:48 -07:00
Lindsey Kuper
528c6516f0
Use span_err instead of err. Fixes issue #444 .
2011-06-01 17:22:23 -07:00
Patrick Walton
af9272f70e
rustc: Remove rustboot workaround from walk::default_visitor()
2011-06-01 16:52:22 -07:00
Patrick Walton
8851ae0423
rustc: Allow walking over patterns
2011-06-01 16:47:24 -07:00
Lindsey Kuper
dba9caeba9
Comments.
2011-06-01 16:39:52 -07:00
Rafael Ávila de Espíndola
a6ca9c2922
Don't create an empty section.
2011-06-01 15:59:28 -04:00
Rafael Ávila de Espíndola
30efdeeca1
Visibility is an ELF concept and protected visibility is not very well implemented,
...
avoid using it for now.
Instead, mark pairs that are not needed elsewhere as internal.
2011-06-01 15:45:31 -04:00
Lindsey Kuper
649a7bf38a
Comments and cleanup.
2011-06-01 11:34:52 -07:00
Paul Stansifer
9f5dddf08c
Now imports are not re-exported unless 'export' is explicitly used.
2011-05-31 18:43:26 -07:00
Michael Sullivan
fd1029e6dd
Support move as an initializer.
2011-05-31 17:39:14 -07:00
Michael Sullivan
c232964301
Implement move semantics.
2011-05-31 17:39:14 -07:00
Michael Sullivan
5e7bba3d23
Insert plumbing for move that behaves just like assign.
2011-05-31 17:39:14 -07:00
Eric Holk
84a56ed7cd
Teach the compiler to understand yield and join, as well as using task as a type name.
2011-05-31 16:28:13 -07:00
Brian Anderson
9daa00bf83
rustc: Teach rustc to use block results as fn return values. Closes #372
2011-05-31 19:18:55 -04:00
Rafael Ávila de Espíndola
cc96eeafca
Move rust_vec_append_glue to rt.
2011-05-31 14:32:08 -04:00
Graydon Hoare
b6971d94df
Consolidate formatting functions a bit more.
2011-05-31 11:00:47 -07:00
Graydon Hoare
b48cab962a
Add span to field to catch per-field comments in rec exprs.
2011-05-31 11:00:47 -07:00
Rafael Ávila de Espíndola
e66f9e46f6
Start finishing up the rust_start signature transition.
2011-05-31 11:17:17 -04:00
Marijn Haverbeke
7d68cbdff0
Have blocks return their result by writing to a reserved space
...
This makes it possible to pass the location of that space through to
nested blocks, resulting in less copying, taking, and dropping.
This makes the compiler slightly faster and 19k smaller.
A FIXME is to use 'move' semantics when returning the values from the
block -- don't bump the refcount and drop it again for the returning
block, but simply assign ownership to the receiver. To do this, we'll
need a way to (safely) scrub things from a block's cleanup list.
2011-05-31 14:29:16 +02:00
Brian Anderson
81fc2d8728
rustc: Remove unneeded type params from alt patterns
2011-05-31 01:23:53 -04:00
Brian Anderson
c7e3f88c93
rustc: Pushdown type params for tag patterns. Closes #363
2011-05-31 00:00:04 -04:00
Tim Chevalier
18883fea3a
In pre/postcondition computation, failing calls should set the postcondition
...
A non-returning call should have a postcondition in which all predicates
are true -- not just a poststate. Otherwise, alt expressions where
one or more branches terminate in a non-returning call and others
initialize a variable get rejected.
Includes a test case.
2011-05-27 20:43:51 -07:00
Tim Chevalier
95e1aa18c1
change comment
2011-05-27 20:43:51 -07:00
Tim Chevalier
9a24e4f780
Fix two typestate bugs
...
* Non-returning calls should set all predicates to be true, not
just the "this function returns" predicate
* Fixed a bug in the expr_alt case in tstate.states that wasn't updating
the changed flag properly, then fixed *another* bug that was updating
it too enthusiastically, but was masked by the first bug.
2011-05-27 20:43:51 -07:00
Lindsey Kuper
dc9d5e1689
Lots of comments, and some more descriptive names.
2011-05-27 18:20:43 -07:00
Tim Chevalier
b6e0c5829f
Check the declaration type in a for loop against the sequence type
...
Changed the typechecker to correctly typecheck the declared variable
type in a for or for-each loop against the vector element type (for
a for loop) or the iterator type (for a for-each loop). Added a
test case.
2011-05-27 17:42:09 -07:00
Tim Chevalier
0c5a55f275
add a function that returns the type of a local decl
2011-05-27 17:34:50 -07:00
Eric Holk
52795049e7
Generating names for wrappers, removed extra logging
2011-05-27 15:37:19 -07:00
Eric Holk
8cfc388d40
Switched calling conventions so that spawn with multiple arguments works.
2011-05-27 15:20:58 -07:00
Eric Holk
d49998f0ed
Switching over to wrappers for spawning functions of multiple arguments. Doesn't quite work yet.
2011-05-27 15:20:58 -07:00
Eric Holk
da0e0b6f5e
Removing excessively verbous logging.
2011-05-27 15:20:58 -07:00
Eric Holk
a88af906c5
Programs using spawn terminate
2011-05-27 15:20:58 -07:00
Eric Holk
dad426419c
Working on 2 argument spawn. The arguments seem to be copied correctly once, but then they get lost.
2011-05-27 15:20:58 -07:00
Eric Holk
bb4c7a9c68
Arguments seem to be correctly passed to child processes now.
2011-05-27 15:20:58 -07:00
Eric Holk
21efd07bc1
New tasks run, but their arguments get lost and something ends up in an infinite loop when the task exits.
2011-05-27 15:20:58 -07:00
Tim Chevalier
0cbcf92749
Use annotations on blocks
...
Previously, block_ty returned the type of the terminating
expression of the block (or nil if said expression was absent).
I changed check_expr to write the type of that expression into
the annotation for the block itself, so now block_ty can use the
block's annotation.
2011-05-27 12:21:37 -07:00
Tim Chevalier
1a96e79fe0
Make _|_ unify with anything
...
The typechecker had a number of special cases for unifying types
with _|_ (as with checking if and alt). But, a value of type _|_
should be usable in any context, as such a value always diverges,
and will never be used by its immediate context. Changed unify
accordingly, removed special cases.
2011-05-26 20:50:25 -07:00
Paul Stansifer
af6b4821c1
Handle circularity in glob imports in a more elegant fashion.
2011-05-27 02:42:33 +00:00
Paul Stansifer
7fe3d821ac
Add a map from def_id s to items in resolve::env.
...
Use it to provide better error messages in the event of
glob-importing the same name multiple times.
2011-05-27 02:42:33 +00:00
Paul Stansifer
54ca8565c9
Fix bugs: make sure glob imports show up in the right module,
...
and make sure that circular glob imports don't diverge.
2011-05-27 02:42:33 +00:00
Paul Stansifer
40fe44d23e
"import module::*;" now works.
2011-05-27 02:42:33 +00:00
Paul Stansifer
e2bb98001e
Part one of adding globbing to resolve.rs: build up glob links. (Part two will follow those links if non-glob resolution fails.)
2011-05-27 02:42:32 +00:00
Graydon Hoare
79c9e13073
More delicious dead code removal from runtime, upcalls.
2011-05-26 18:21:02 -07:00
Tim Chevalier
4f792f2dbb
Track spans for each local variable in typestate
...
This lets us print better messages in situations with name
shadowing.
2011-05-26 18:14:32 -07:00
Tim Chevalier
250643c549
Remove unused imports
2011-05-26 18:01:48 -07:00
Graydon Hoare
9f95538462
Remove redisue of unused fields from 'ann'.
2011-05-26 17:26:59 -07:00
Graydon Hoare
2561b01211
Remove residual uses of fold, and fold itself.
2011-05-26 17:16:54 -07:00
Graydon Hoare
8e945dcd81
Remove native glues. All calls to C are direct now.
2011-05-26 16:45:01 -07:00
Michael Sullivan
1b29892b5b
Produce a useful error message in trans when attempting to log an unsupported type.
...
(Previously, an llvm assert was tripped.)
2011-05-25 18:54:33 -04:00
Eric Holk
d72d50473f
Fixing typechecking for spawn.
2011-05-25 18:01:45 -04:00
Rafael Ávila de Espíndola
94129c4216
dead argument removal part one.
2011-05-25 15:33:57 -04:00
Brian Anderson
9a88ba2b81
rustc: Downcase typeck::demand and typeck::pushdown
2011-05-24 20:26:46 -04:00
Brian Anderson
6473b73174
rustc: Use demand functions instead of open-coded typecheck for spawn
...
Un-xfail spawn-non-nil-fn
2011-05-24 20:23:21 -04:00
Rafael Ávila de Espíndola
de2e84e5b0
Only one gc glue.
2011-05-24 18:52:31 -04:00
Rafael Ávila de Espíndola
ac836dd79c
There is only one yield glue.
2011-05-24 18:29:08 -04:00
Rafael Ávila de Espíndola
b1292580b9
Remove dead code for unwind_glue.
2011-05-24 17:28:37 -04:00
Rafael Ávila de Espíndola
0fc91b6ecc
There is only one activate function now.
2011-05-24 17:00:45 -04:00
Eric Holk
2e8afc7b47
Merge pull request #404 from lkuper/cleanup
...
Just removing some unnecessary imports.
2011-05-24 13:51:00 -07:00
Marijn Haverbeke
fbc0e840e3
Stop showing a 'cyclic import' message for unresolved imports
...
This only happened for single-length import paths, because the import
was being looked up in its own scope.
2011-05-24 20:58:38 +02:00
Lindsey Kuper
f1d3b88f0a
Just removing some unnecessary imports.
2011-05-24 11:22:40 -07:00
Tim Chevalier
bad05e20a3
Improve nonexistent-module error message
...
The error message for (for example) "import vec;" without "use std;"
was "cyclic import", which was misleading because there were no
cycles. I changed it to "cyclic import or nonexistent module",
which doesn't break existing tests.
2011-05-24 10:47:58 -07:00
Tim Chevalier
c9a8bdee2f
Improve error message for ambiguous polymorphic types
...
If a type still contains free type variables after typechecking (for
example, as with "auto foo = []", the result was an assertion failure
in typeck. Made it a human-readable error message instead.
2011-05-23 19:46:27 -07:00
Tim Chevalier
b620be9cd2
Typecheck @[] correctly
...
Previously, if you wrote
let @vec[int] foo = @[];
that would be a type error. That didn't seem right, so I changed
pushdown to unify the inner type in an unop application with the
argument type of the operator type.
2011-05-23 17:17:49 -07:00
Tim Chevalier
2a73c4ffab
Add line breaks to typestate error messages
2011-05-23 13:32:29 -07:00
Brian Anderson
d82e9c1874
rustc: Add a FIXME to expr_alt type checking
2011-05-21 18:35:21 -04:00
Brian Anderson
4504e23a82
rustc: Remove unnecessary pushdown from check_expr in the expr_if case
2011-05-21 18:18:48 -04:00
Brian Anderson
e24d7ae967
rustc: If all if branches are _|_, then the entire if is _|_
2011-05-21 18:18:48 -04:00
Brian Anderson
085fb1a2db
rustc: Remove outdated comment
2011-05-21 14:43:04 -04:00
Brian Anderson
b62bf8cede
rustc: Allow if expressions to fail
2011-05-21 14:22:01 -04:00
Brian Anderson
6824f119fc
rustc: Allow alt expressions to fail
2011-05-21 13:22:01 -04:00
Brian Anderson
418b4c4567
rustc: Assign ty_bot to nodes in write::bot_ty. Remove FIXME
2011-05-21 13:02:58 -04:00
Brian Anderson
779dd809d2
rustc: Blocks shouldn't try to return results for ty_bot
2011-05-21 12:56:31 -04:00
Tim Chevalier
755ca8eb73
Correctly check that ! functions always diverge
...
Also make _|_ unify with any type.
2011-05-20 19:54:14 -07:00
Brian Anderson
2fc0bedc83
rustc: Don't write metadata for unexported items
2011-05-20 21:32:57 -04:00
Tim Chevalier
467b938ea8
Merge remote-tracking branch 'graydon/master' into typestate_4
2011-05-20 18:23:03 -07:00
Tim Chevalier
964898eaf1
Error instead of warning for missing returns. Huzzah!
2011-05-20 18:20:54 -07:00
Lindsey Kuper
c3410bf927
More work on anonymous objects.
2011-05-20 17:59:56 -07:00
Tim Chevalier
c8d488b337
Change node_ann hash table to a vector in typestate
2011-05-20 16:57:37 -07:00
Tim Chevalier
9128a1bab8
rm unnecessary logging
2011-05-20 16:57:37 -07:00
Tim Chevalier
7e82f23bc0
rm unused import
2011-05-20 16:57:37 -07:00
Tim Chevalier
551fb13689
Add a "fail" after a while(true) loop in two places
...
(in preparation for changing the "function may not return" warning
to an error)
2011-05-20 16:57:37 -07:00
Tim Chevalier
a08a376d6e
Make controlflow part of a function type
...
Change ty_fn to have a controlflow field. A 'controlflow' is
essentially a bit of data that says whether or not this function
never returns to the caller (if it never returns, that means it calls
"fail" or another "never-returns" function on every control path).
Also add syntax for annotating functions that never return:
fn foo() -> ! {
fail;
}
for example. Functions marked with ! implicitly have a result type of
ty_bot, which is a new type that this commit also adds.
2011-05-20 16:57:37 -07:00
Eric Holk
0de27ce8bd
Translated start_task, but it fails on spp == align_down(spp)
2011-05-20 16:51:09 -07:00
Eric Holk
d01948cd07
Called the new_task upcall. There are refcount issues though.
2011-05-20 16:51:08 -07:00
Eric Holk
219351e4b9
A little closure towards translating spawn. We're about ready to do the upcall, except that rustc segfaults.
2011-05-20 16:51:08 -07:00
Eric Holk
d6338a8c15
Added some comments to trans_spawn that sort of explains what needs to happen
2011-05-20 16:51:08 -07:00
Eric Holk
2b124a8140
Started working on translating spawn. It correctly generates the task name in the case that it is not provided.
2011-05-20 16:51:08 -07:00
Graydon Hoare
fa75703700
Twiddle glue inlining heuristics. ~10% win on build time.
2011-05-20 14:57:52 -07:00
Graydon Hoare
67b8501eb8
Elide a bunch of do-nothing take glue.
2011-05-20 14:50:57 -07:00
Graydon Hoare
381ba1d0ba
Remove redundant secondary declaration of glue.
2011-05-20 14:48:33 -07:00
Patrick Walton
7e43a31f08
rustc: Move the interner to a new module intended to be used for general data structures
2011-05-20 13:57:53 -07:00
Brian Anderson
b6d2fe4d74
rustc: Translate else if blocks the same as other blocks. Closes #388
2011-05-19 23:32:09 -04:00
Brian Anderson
879a952a37
rustc: Find the correct outer scope in trans_block
2011-05-19 23:32:08 -04:00
Rafael Ávila de Espíndola
40b511a7c5
Revert 106216d673
.
...
This depends on llvm's 131294.
2011-05-19 18:30:19 -07:00
Graydon Hoare
494c0c3b61
After all that, give up on "complex" version of type_has_pointers and just manually inspect. Can't calculate property during interning.
2011-05-19 18:28:09 -07:00
Graydon Hoare
7f938f4945
Move the ty_item_table into ty::ctxt.items, move variant_info to ty, and start sketching the contains_pointer property on types.
2011-05-19 17:21:36 -07:00
Graydon Hoare
1d67ee0e88
Remove type_glue.rs, don't think it's going to work.
2011-05-19 17:21:36 -07:00
Patrick Walton
bc87ecf110
rustc: Unify variables using a single type instead of keeping a list and doing it all at the end. This will give us better error messages.
2011-05-19 16:07:12 -07:00
Graydon Hoare
a4dd57705c
Move type cache and node type table into type context.
2011-05-19 15:47:15 -07:00
Marijn Haverbeke
8a7b544995
Finish name collision testing.
...
And fix a the single screw-up in the source code it caught.
2011-05-19 21:58:57 +02:00
Paul Stansifer
533d3055f3
No functional change. Largely removed the native module/non-native module distinction from resolve.rs
2011-05-19 12:13:35 -07:00
Tim Chevalier
b74d0d7c3d
Typestate checking code no longer uses fold -- only walk.
2011-05-19 11:40:16 -07:00
Tim Chevalier
d60e08c18e
Eliminate explicit recursion in tstate.states (walk does that now),
...
and kill dead code.
2011-05-19 11:40:16 -07:00
Tim Chevalier
e1844d2719
Add ann as an argument to visit_fn
2011-05-19 11:40:16 -07:00
Tim Chevalier
6dcd607277
make trans compile
2011-05-19 11:40:16 -07:00
Tim Chevalier
a9bc6715e7
tidy tstate.collect_locals
2011-05-19 11:40:16 -07:00
Tim Chevalier
c0f728712b
Rewrite pre_postconditions to use walk instead of fold
2011-05-19 11:40:16 -07:00
Tim Chevalier
2cd769e358
Add ident as an argument to visit_fn (typestate wants it)
2011-05-19 11:40:16 -07:00
Tim Chevalier
ef5473deb1
Trim imports
2011-05-19 11:40:16 -07:00
Tim Chevalier
bb594a03a1
remove now-unused ts field from ann
2011-05-19 11:40:16 -07:00
Tim Chevalier
e16b097599
Rewrite tstate.annotate to use walk instead of fold
...
and various other tidying in typestate
2011-05-19 11:40:16 -07:00
Tim Chevalier
dc83c84662
Add visit_fn_pre and visit_fn_post fields to visitors
...
Added visit_fn_pre and visit_fn_post fields that get applied to
both regular functions and methods.
2011-05-19 11:40:16 -07:00
Tim Chevalier
8cbdaf4f93
Make trans use span_err for the dreaded "ty_var in trans::type_of" error
...
This required quite a bit of tiresome plumbing about of spans.
On the bright side, now other errors can be converted to span_err too.
Includes test cases.
2011-05-19 11:40:16 -07:00
Tim Chevalier
f909dd114d
Remove dead file (typestate_check is now a bunch of modules under middle/tstate)
2011-05-19 11:40:16 -07:00
Tim Chevalier
b624b43e47
Beginning of Operation Eliminate Folds
...
Started by rewriting collect_locals to use walk instead of fold
2011-05-19 11:40:16 -07:00
Tim Chevalier
4964023c5e
Fix an error message that reversed the expected and actual number of arguments in a pattern
2011-05-19 11:40:16 -07:00
Patrick Walton
6417610788
rustc: Generalize variable bindings so that we can use it for locals too
2011-05-19 11:14:44 -07:00
Patrick Walton
df90934bf7
rustc: Split write_* in typeck into versions that will record fixups
2011-05-18 19:19:20 -07:00
Patrick Walton
d2bdfe36cf
rustc: Don't inline free glue
2011-05-18 18:48:57 -07:00
Graydon Hoare
6f8b9e176f
Factor free paths out of drop glue, into free glue as in rustboot.
2011-05-18 17:28:08 -07:00
Patrick Walton
0aee8b3bd7
rustc: Thread statement contexts through unification
2011-05-18 15:36:14 -07:00
Rafael Ávila de Espíndola
bb7d4e15a8
Remove dead code.
2011-05-18 16:33:22 -04:00
Marijn Haverbeke
28c4a5586e
Start checking name collisions in modules
...
(And remove a boatload of duplicate imports from the typestate files.)
Name collision checking in local scopes will follow soon.
2011-05-18 22:24:20 +02:00
Patrick Walton
13d9f6a264
rustc: Split out type variable fixups from unification
2011-05-18 13:08:54 -07:00
Patrick Walton
37d5dd9471
rustc: Group the variable binding machinery into a separate data structure during unification
2011-05-18 11:54:12 -07:00
Rafael Ávila de Espíndola
a795d0e5b2
And yet more dead code.
2011-05-18 14:28:08 -04:00
Patrick Walton
f4e049c415
rustc: Thread a statement context through the typechecker; use it for generating variable IDs. 40% typechecking speedup.
2011-05-17 22:21:31 -07:00
Patrick Walton
fdf8c49882
rustc: Don't rebuild the AST when typechecking statements
2011-05-17 21:09:34 -07:00
Patrick Walton
ace8058277
rustc: Have typechecking no longer rebuild the AST
2011-05-17 20:13:04 -07:00
Brian Anderson
a98ea4f3ef
rustc: Run block cleanups on else if blocks
...
With the scheme used to translate 'else if' currently the if expression is
translated in a new (else) scope context. If that if expression wants to
result in a value that requires refcounting then it will need to drop the
refcount in the cleanups of the else block.
2011-05-17 22:25:24 -04:00
Patrick Walton
e840a37f33
rustc: Remove typeck::check_item_fn(); it's entirely superfluous!
2011-05-17 19:20:24 -07:00
Patrick Walton
87288a186d
rustc: Make check_const() not rebuild the AST (although it's not called at the moment!)
2011-05-17 19:13:16 -07:00
Patrick Walton
d21741843c
rustc: Make check_block not rebuild the AST
2011-05-17 19:10:24 -07:00
Patrick Walton
10503a4a02
rustc: Don't rebuild the AST when writing back locals
2011-05-17 19:00:29 -07:00
Patrick Walton
8637a4eaf3
rustc: Pull the type out of the correct expression when typechecking channel types. Puts out burning tinderbox.
2011-05-17 18:19:45 -07:00
Patrick Walton
83e1dc63c2
rustc: Fix return value of expr_spawn case in pushdown_expr. Should put out soon-to-be-burning tinderbox.
2011-05-17 17:44:30 -07:00
Patrick Walton
c6d4c31ee4
rustc: Don't rebuild the AST when typechecking expressions
2011-05-17 17:43:06 -07:00
Eric Holk
cff9a3cc2a
Fixing compile problems from recent changes.
2011-05-17 14:38:32 -07:00
Eric Holk
cf02c67137
Removing the TODO comment.
2011-05-17 14:38:32 -07:00
Eric Holk
8d10594ed5
Added a few more expr_spawn cases so the spawn.rs test case gets a little further before failing.
2011-05-17 14:38:32 -07:00
Patrick Walton
37768cba92
rustc: Don't rebuild call or bind expressions during typechecking
2011-05-17 14:37:23 -07:00
Patrick Walton
f300de2963
rustc: Make return value checking warnings a little prettier. Also introduce a new "note" diagnostic level.
2011-05-17 14:12:49 -07:00
Patrick Walton
5047ab0b0c
rustc: Flatten annotations
2011-05-17 13:55:32 -07:00
Marijn Haverbeke
09d8ef8d51
Finally rename std::_xxx to std::xxx
...
Except for _task, which is still a keyword.
2011-05-17 20:41:41 +02:00
Brian Anderson
fbfd8552ab
Return a better result from blocks. Closes issue #377
...
Blocks return in a copy of the result of their ending expression, not the
direct result of the ending expression, as that may be a local variable which
gets zeroed by drop_slot.
2011-05-17 00:46:56 -04:00
Graydon Hoare
4c5e315843
Rename aux.rs to auxiliary.rs since win32 doesn't like files named "aux". Really.
2011-05-16 19:21:29 -07:00
Graydon Hoare
a2e2e78103
Merge remote branch 'origin/master' into HEAD
...
Conflicts:
src/comp/middle/trans.rs
2011-05-16 19:04:45 -07:00
Graydon Hoare
fbbc1a77d2
Rewrite everything to use [] instead of vec() in value position.
2011-05-16 18:21:22 -07:00
Tim Chevalier
971b5d5151
Started adding support for return checking and non-returning function annotations
...
* Reorganized typestate into several modules.
* Made typestate check that any function with a non-nil return type
returns a value. For now, the check is a warning and not an error
(see next item).
* Added a "bot" type (prettyprinted as _|_), for constructs like be, ret, break, cont, and
fail that don't locally return a value that can be inspected. "bot"
is distinct from "nil". There is no concrete syntax for _|_, while
the concrete syntax for the nil type is ().
* Added support to the parser for a ! annotation on functions whose
result type is _|_. Such a function is required to have either a
fail or a call to another ! function that is reached in all control
flow paths. The point of this annotation is to mark functions like
unimpl() and span_err(), so that an alt with a call to err() in one
case isn't a false positive for the return-value checker. I haven't
actually annotated anything with it yet.
* Random bugfixes:
* * Fixed bug in trans::trans_binary that was throwing away the
cleanups for nested subexpressions of an and or or
(tests: box-inside-if and box-inside-if2).
** In typeck, unify the expected type arguments of a tag with the
actual specified arguments.
2011-05-16 16:59:25 -07:00
Tim Chevalier
c75125fcce
Noticed that metadata::Encode::enc_sty didn't have a case for ty_task, so I added one (though this wasn't causing the problem I was seeing...
2011-05-16 16:13:11 -07:00
Patrick Walton
f74298215c
rustc: Fix indentation in typeck::check_lit()
2011-05-16 15:24:32 -07:00
Patrick Walton
1fc1ad91ce
rustc: Don't rebuild the call expression in typeck::replace_expr_type()
2011-05-16 15:20:11 -07:00
Patrick Walton
278d64dafc
rustc: Don't unpack annotations in trans::lval_generic_fn()
2011-05-16 15:20:11 -07:00
Patrick Walton
32b8dcb97c
rustc: Factor out the code that interns types into an "interner" data structure
2011-05-16 13:58:13 -07:00
Patrick Walton
3760bfab87
rustc: Don't rebuild AST patterns during typechecking
2011-05-16 11:45:00 -07:00
Patrick Walton
ca51b49c0a
rustc: Replace the redundant typeck::node_ann_ty_params() with ty::ann_to_type_params()
2011-05-16 11:43:50 -07:00
Patrick Walton
3aaf02b907
rustc: Make the type collection pass no longer rebuild the AST
2011-05-16 10:34:32 -07:00
Patrick Walton
525a5c582f
rustc: Fix indentation in ty_param_count_and_ty_for_def()
2011-05-16 10:32:38 -07:00
Patrick Walton
594c70f788
rustc: Add an item_ann() accessor function
2011-05-16 10:32:38 -07:00
Brian Anderson
f77c5ba512
rustc: Wait until generic glue is actually emitted to define it as internal
...
The verifier was not liking this when generating unoptimized bitcode. Per LLVM
docs it is not valid for function declarations to be marked internal, but
their implementations may be.
2011-05-15 19:53:06 -04:00
Brian Anderson
8eaafdaa2d
rustc: Rename 'Unify' modules to 'unify'
2011-05-14 21:13:47 -04:00
Patrick Walton
de421afa55
rustc: Use walk instead of fold for the first item collection pass
2011-05-14 11:03:10 -07:00
Patrick Walton
8b3f359442
rustc: Change "Collect" to "collect"
2011-05-14 11:03:10 -07:00
Patrick Walton
85120d9959
rustc: Look types up in the side table
2011-05-13 18:46:44 -07:00
Patrick Walton
ef75860a0a
rustc: Write nil types into the node type table wherever plain_ann() is used
2011-05-13 17:55:07 -07:00
Lindsey Kuper
5679f5c55e
'with' no longer a token; whitespace police.
...
Plus renaming the anonymous objects test to a more descriptive name,
and XFAILing it because it doesn't work yet.
2011-05-13 17:37:01 -07:00
Lindsey Kuper
cd31d5d532
More anon obj work; whitespace police in middle::fold
...
Passing args to middle::fold::fold_expr_anon_obj by reference to be
consistent with the other folds; adding a dummy fold_expr_anon_obj to
typeck to be filled in later.
2011-05-13 17:35:13 -07:00
Lindsey Kuper
814b17352c
Use new module namespace syntax.
2011-05-13 17:35:13 -07:00
Lindsey Kuper
b6f35c6a4b
More work toward anonymous objects.
2011-05-13 17:35:13 -07:00
Lindsey Kuper
d3242b9644
Bug fixes.
...
Fixed infinite loop on anonymous objects in parser; added
expr_anon_obj to walk.rs; fixed syntax of test case.
2011-05-13 17:35:13 -07:00
Lindsey Kuper
6c1c5b3948
More progress on anonymous objects.
...
Still segfaulting on the method-overriding.rs test, though.
2011-05-13 17:35:13 -07:00
Patrick Walton
fac1342513
rustc: Move replace_expr_type() from ty to typeck, as it's only used in the latter
2011-05-13 17:06:30 -07:00
Brian Anderson
843e9435ab
rustc: Fix long lines in typeck.rs
2011-05-13 20:06:02 -04:00
Patrick Walton
23d3b0ec57
rustc: Get ann_to_type_params() on board the ann_to_ty_param_substs_opt_and_ty() train
2011-05-13 16:53:35 -07:00
Patrick Walton
0739849e9f
rustc: Make all type lookups go through the one ty::ann_to_ty_param_substs_opt_and_ty() function
2011-05-13 16:40:21 -07:00
Patrick Walton
4f2eb31870
rustc: Write types contained in "trivial annotations" to the table
2011-05-13 16:27:55 -07:00
Patrick Walton
e888fe6f9b
rustc: Change ty::triv_ann() to take a node ID instead of a full annotation
2011-05-13 14:39:00 -07:00
Brian Anderson
2f440b1452
rustc: lowercase the link and link::write modules
2011-05-13 16:55:37 -04:00
Graydon Hoare
0d32ff723a
Slight adjustments to shape, rename to type_glue.rs.
2011-05-13 13:29:50 -07:00
Patrick Walton
c97b05141a
rustc: Add write_type() wherever ann_types are written, except for triv_ann()
2011-05-13 13:06:34 -07:00
Patrick Walton
be9aa1cc5e
rustc: Fix the type of node_types; stub the write_type function
2011-05-13 12:12:54 -07:00
Patrick Walton
6e34679a65
rustc: Remove a minor rustboot workaround in typeck::resolve_local_types_in_block()
2011-05-13 11:23:00 -07:00
Patrick Walton
8a8f68aa75
rustc: Make typeck::instantiate_path() not return an annotation
2011-05-13 10:53:55 -07:00
Marijn Haverbeke
ae26b775b4
Implement module namespaces
...
Module names no longer clash with type and value names. The
tokenizer/parser still needs to be taught to be more careful in
identifying keywords, so that we can use 'str' and 'vec' and so as
module names.
2011-05-13 17:20:46 +02:00
Marijn Haverbeke
eb419fd8c7
Extend crate format to allow multiple definitions for a single name
...
The type/value namespace distinction pretty much works now. Module
namespace is up next.
2011-05-13 17:20:39 +02:00
Marijn Haverbeke
1a12a7b04b
Make module indices hold a list of items
...
This way, they can support having both a type and a value
of the same name.
2011-05-13 13:34:59 +02:00
Marijn Haverbeke
58ec5d1654
Move capture checking into resolve.rs
...
Drops capture.rs. The new algorithm also checks for captures function
arguments and obj fields.
2011-05-13 12:44:05 +02:00
Marijn Haverbeke
89490e416b
Change resolve to use walk instead of fold
...
Possibly, at some point, we should add a state-passing variant of
walk, or a wrapper that makes it easier to thread state. (See the
repetetive pop_state_for_* functions in this commit.)
2011-05-13 11:35:25 +02:00
Marijn Haverbeke
7082bf4478
Ensure visit_ty is called on type parameters during walk
2011-05-13 11:35:25 +02:00
Marijn Haverbeke
39a000714a
Add visit_arm and visit_method to walk.rs
...
The resolver needs to update its state for individual arms and
methods.
2011-05-13 11:34:51 +02:00
Patrick Walton
5295a4dabd
rustc: Flatten recursive vectors in trans::simplify_type(). Prevents an infinite loop.
2011-05-12 18:37:28 -07:00
Patrick Walton
b163247d4e
rustc: Beginnings of a "shape" module to convert types to shapes
2011-05-12 18:30:21 -07:00
Patrick Walton
033b38b636
rustc: Make ty::expr_ann() terser
2011-05-12 16:57:08 -07:00
Patrick Walton
0b7dd0d918
rustc: Pass a node type table around, unused as of yet
2011-05-12 16:41:55 -07:00
Graydon Hoare
5ceaf345ed
Add stats option and lazily emit glue.
2011-05-12 15:42:51 -07:00
Marijn Haverbeke
3816e57fd2
Downcase std modules again, move to :: for module dereferencing
...
This should be a snapshot transition.
2011-05-12 21:30:44 +02:00
Marijn Haverbeke
6510f1ce7c
Change module dereference syntax from . to ::
...
This will need to be a snapshot.
2011-05-12 21:30:35 +02:00
Marijn Haverbeke
358a1aeec9
Keep resolve data in external hash table, rather than embedded defs
...
One step closer to removing fold and having a single, immutable AST.
Resolve still uses fold, because it has to detect and transform
expr_field expressions. If we go through on our plan of moving to a
different syntax for module dereferencing, the parser can spit out
expr_field expressions, and resolve can move to walk.
(I am truly sorry for the things I did in typestate_check.rs. I expect
we'll want to change that to walk as well in the near future, at which
point it should probably pass around a context record, which could
hold the def_map.)
2011-05-12 15:40:21 +02:00
Marijn Haverbeke
2b36e40c58
Ensure ann tags are actually kept around during typechecking
...
This way, the tag assigned by the parser stays with the node.
I realize ann replacing is probably going away real soon, but
I needed this now for moving the resolve defs out of the AST.
2011-05-12 10:51:13 +02:00
Marijn Haverbeke
d719b5cae7
Provide a more useful message when failing to translate a const
2011-05-12 09:17:59 +02:00
Patrick Walton
531515d7ae
rustc: Represent types as uints. Cuts typechecking down from 14s to 12s.
2011-05-11 17:05:39 -07:00
Patrick Walton
da09a0320e
rustc: Remove a few kludges intended to work around rustboot's lack of structural comparison from equal_type_structures()
2011-05-11 16:18:02 -07:00
Patrick Walton
6953841e25
rustc: Remove magic numbers; they aren't a win
2011-05-11 16:10:17 -07:00
Patrick Walton
df914e8904
rustc: Intern all types. 4s regression.
2011-05-11 15:56:23 -07:00
Patrick Walton
26ab36afb1
rustc: Hoist derived type descriptors to the top of the function
2011-05-11 12:05:02 -07:00
Marijn Haverbeke
14f1fe0e29
Remove mod indices from the AST
...
They are now created by the resolve pass, which is the only pass that
needs them, and kept internal to that pass.
2011-05-11 17:11:44 +02:00
Marijn Haverbeke
fe29d24b6e
Get rid of arm indices
2011-05-11 15:26:36 +02:00
Marijn Haverbeke
5405f45274
Get rid of block indices
2011-05-11 15:10:24 +02:00
Marijn Haverbeke
7d086df095
Stop depending on block indices in capture.rs
2011-05-11 13:49:48 +02:00
Marijn Haverbeke
9cb20153a8
Hash only on def_num when storing def_ids that are local
2011-05-11 13:06:43 +02:00
Marijn Haverbeke
7f222423b7
Use a const for crate-num-zero (ast.local_crate)
2011-05-11 12:59:34 +02:00
Marijn Haverbeke
6b46113afc
Cache external crate lookups in resolve.rs
...
According to --time-passes, resolution went from 2 to 0 seconds. Not
really the bottleneck... but if we want to be crazy fast, just
consider this a future bottleneck that was fixed very timely.
2011-05-11 12:32:37 +02:00
Marijn Haverbeke
e9c12ab1d0
Rewrite comp/middle/resolve.rs
...
* Cleans up the algorithm
* Move first pass to walk (second still folds)
* Support part of a type/value namespace split
(crate metadata and module indices still need to be taught about this)
* Remove a few blatant inefficiencies (import tables being recreated for
every lookup, most importantly)
2011-05-11 12:32:37 +02:00
Graydon Hoare
dc0aab47a7
More alias-ification of trans.
2011-05-11 05:11:59 +00:00
Patrick Walton
f627c2ff21
rustc: Don't interleave allocas with stores when copying arguments to allocas
2011-05-10 18:29:14 -07:00
Graydon Hoare
390ce40165
Begin alias-ifying trans.
2011-05-10 18:07:40 -07:00
Graydon Hoare
cf3e737eee
Avoid mangle_name_by_type_only call in tydesc names unless debugging.
2011-05-10 18:07:40 -07:00
Patrick Walton
1448fc1a24
rustc: Lower the size limit on ty_to_short_str() and always call it in favor of direct calls to metadata.Encode.ty_str() in trans
2011-05-10 17:50:39 -07:00
Patrick Walton
10c9266525
rustc: Number everything with an annotation
2011-05-10 17:27:59 -07:00
Graydon Hoare
7e8b57d1bb
Only name LLVM values / blocks / types when saving temporaries.
2011-05-10 17:04:41 -07:00
Patrick Walton
17daf1f9bf
rustc: Cache intermediate results of metadata.Encode.ty_str. Shaves 30% off translation time.
2011-05-10 14:48:24 -07:00
Graydon Hoare
3bec4c8193
Switch memcpy to memmove since we're willing to compile x = x and such.
2011-05-10 14:22:14 -07:00
Patrick Walton
2849103f24
rustc: Get rid of native Rust glue for all upcalls except the exit task glue
2011-05-10 14:04:34 -07:00
Graydon Hoare
55f0f79a46
Re-enable use of llvm intrinsics for memcpy, memset. Should have aligned stack now.
2011-05-10 11:50:29 -07:00
Brian Anderson
1abb7a868e
Fix long lines in fold.rs, typeck.rs
2011-05-09 22:11:56 -04:00
Graydon Hoare
4539f8a03c
Alias-ify fold and its users, remove another 85kb.
2011-05-09 17:50:06 -07:00
Graydon Hoare
476442e48c
Alias-ify walk, typeck, metadata. Cuts another 80kb off rustc.
2011-05-09 16:17:17 -07:00
Patrick Walton
071ed380fb
rustc: Declare upcalls with real signatures; preparation for killing rust_native_rust_* stubs
2011-05-09 15:33:02 -07:00
Patrick Walton
70c759030c
rustc: Alias fix part 2 -- Check that the aliasness of function parameters matches. Add a test case.
2011-05-09 14:00:50 -07:00
Graydon Hoare
b2b33de819
Alias-ify a variety of fn signatures in ty. Cuts 180kb off rustc.
2011-05-09 13:09:20 -07:00
Patrick Walton
662e949540
rustc: Alias fix part 1 -- Separate out AST modes from typechecker modes, and introduce an "either value or alias" mode
2011-05-09 12:27:03 -07:00
Patrick Walton
106216d673
rustc: Stop emitting zero-length arrays
2011-05-08 16:26:35 -07:00
Graydon Hoare
db3b9a4992
Stop stringifying integers to get integral constants.
2011-05-07 18:54:23 +00:00
Marijn Haverbeke
a3ec0b1f64
Rename std modules to be camelcased
...
(Have fun mergining your stuff with this.)
2011-05-06 22:51:19 +02:00
Patrick Walton
5e2088f2fa
rustc: For stack local derived tydescs, allocate the root tydesc separately from the parameter tydescs. This allows SROA, and consequently inlining, to work.
2011-05-06 12:37:59 -07:00
Patrick Walton
57a5c3ac9f
rustc: Factor derived tydesc construction out of get_tydesc()
2011-05-06 12:37:59 -07:00
Patrick Walton
8e7aeed2d5
rustc: Include a representation of the type in question in the symbols generated for tydescs
2011-05-06 12:37:59 -07:00
Patrick Walton
883eb38b28
rustc: Remove some debugging code from decl_native_fn_and_pair()
2011-05-05 17:58:48 -07:00
Patrick Walton
81cda5ad45
rustc: Fix a bunch of argument-passing bugs in decl_native_fn_and_pair()
2011-05-05 17:48:10 -07:00
Lindsey Kuper
9d7fc21967
Consolidating expr_to_str functions.
2011-05-05 16:53:25 -07:00
Rafael Ávila de Espíndola
157f61f8c8
Change the setup so that rust_activate_glue returns to rust_exit_task_glue
...
and rust_exit_task_glue calls the rust main.
This is simpler since we only need to setup one frame. It also matches
what ld.so does, so gdb is happy and stops a backtrace at rust_exit_task_glue
instead of continuing past whatever function happened to be before
rust_exit_task_glue is the object file.
This is only the rustc changes and should be merged first.
2011-05-05 15:14:34 -07:00
Patrick Walton
2d9ccf3ae5
rustc: Add Rust intrinsic support to the crate metadata reader and writer
2011-05-05 14:35:18 -07:00