Commit graph

2880 commits

Author SHA1 Message Date
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
3dd2877975 Using the right mode... 2011-05-20 16:51:09 -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
41b3979990 Nicer printer of LLVM array types. 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
Eric Holk
51e1ce292d Added a couple of test cases for sending messages. One works as expected, the other succeeds unexpectedly. 2011-05-20 16:51:08 -07:00
Patrick Walton
4eb476fc75 stdlib: Modify union-find to guarantee that root nodes are always less than or equal to leaf nodes; add a "prune" method 2011-05-20 15:50:43 -07:00
Graydon Hoare
36c083b14c Options fix from erickt. 2011-05-20 15:20:48 -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
Erick Tryzelaar
02b995f428 librustc depends on rustllvm and std.
This fixes compiling the fuzzer application.
2011-05-20 12:32:44 -07:00
Erick Tryzelaar
7341055b84 Make sure we're using clang >=3.0svn. 2011-05-20 12:32:44 -07:00
Erick Tryzelaar
134b61a317 Use CFG_LLVM_ROOT's llvm-config if it exists.
On some platform (OS X), llvm needs macros like
__STDC_LIMIT_MACROS defined in order to work, which is
normally defined in llvm-config. This patch modifies
the config to use CFG_LLVM_ROOT's llvm-config if it
exists, which fixes the compile failures.
2011-05-20 12:32:44 -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
Eric Holk
5d09e12e15 Added two version of reverse and a swap function to the standard library. 2011-05-19 17:25:37 -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
Patrick Walton
6b95584df5 stdlib: Add vec growth functions that use a thunk to initialize elements 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
Graydon Hoare
31d65453d4 OptLevel changes. Accepts levels 0 to 3 only. '-O' is synonym for --OptLevel=2. 2011-05-19 12:46:10 -07:00
Graydon Hoare
0a74ffaea3 xfail vector-no-ann.rs. 2011-05-19 12:18:23 -07: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
Lindsey Kuper
38b37fcbdb Checking to make sure we know what 'self' is in nested objects. 2011-05-19 11:52:27 -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
ea1701de8c Add a set_all function in bitv that's the inverse of clear 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
0d429a7603 add a bunch more logging things 2011-05-19 11:40:16 -07:00
Tim Chevalier
60399ed198 Tell Makefile to look an extra level deep for dependencies 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