Commit graph

3524 commits

Author SHA1 Message Date
Brian Anderson
10a4737d34 Warn when compiling shared crates that don't have name/vers link attributes
Closes #614
2011-07-05 11:58:44 -07:00
Brian Anderson
6f8bc404f8 Error if the link attribute has duplicate items. Issue #614 2011-07-05 11:46:02 -07:00
Marijn Haverbeke
4349eaed84 Don't thread the local crate number through the session
It's a constant, anyway.
2011-07-05 16:09:32 +02:00
Marijn Haverbeke
6fd6fdea93 Move everything syntax-related to syntax/, break deps on rest of compiler
src/comp/syntax is currently just a sub-module of rustc, but it will,
in the near future, be its own crate. This includes:

 - The AST data structure
 - The parser
 - The pretty-printer
 - Visit, walk, and fold
 - The syntax extension system
 - Some utility stuff that should be in the stdlib*

*) Stdlib extensions currently require a snapshot before they can be
   used, and the win build is very broken right now. This is temporary
   and will be cleaned up when one of those problems goes away.

A lot of code was moved by this patch, mostly towards a more organized
layout. Some package paths did get longer, and I guess the new layout
will take some getting used to. Sorry about that!

Please try not to re-introduce any dependencies in syntax/ on any of
the other src/comp/ subdirs.
2011-07-05 15:57:21 +02:00
Marijn Haverbeke
c59ebf0f01 Add a test file for distinct ty_native types
This should have gone into patch
77f5d14f14, had I not forgotten to add
the file.
2011-07-05 11:50:41 +02:00
Marijn Haverbeke
04acba7968 Move pretty-printing 'modes' into a callback hook
This way, the pretty-printer does not have to know about middle::ty.

(This is a preparation for separating the AST functionality into a
separate crate.)
2011-07-05 10:42:17 +02:00
Patrick Walton
001397da3c stdlib: Add ivec::any() and ivec::all(); put out burning tinderbox 2011-07-04 23:52:47 -07:00
Patrick Walton
f71c8dd918 stdlib: Implement interior vector map 2011-07-04 22:48:42 -07:00
Patrick Walton
d3a4102bc1 stdlib: Add an inefficient implementation of ivec::pop 2011-07-04 21:20:18 -07:00
Patrick Walton
5d2c189631 rustc: Remove obsolete "The second has to be authed pure" comment 2011-07-04 19:08:25 -07:00
Brian Anderson
ccf6112f15 Link the fuzzer crate to librustc again 2011-07-04 15:30:36 -07:00
Graydon Hoare
5c9fb0bc98 Merge pull request #605 from wilsonk/target
Update RustWrapper.cpp so that LLVM revision 134231 from June 30, 2011 at
2011-07-04 13:45:59 -07:00
Marijn Haverbeke
fb10829aef Switch the alias checking pass to use span_err instead of span_fatal
It'll now spit out all problems it finds, and only abort after
the whole pass has run.
2011-07-04 22:00:07 +02:00
Marijn Haverbeke
b1423be1d6 Move the ids of pat AST nodes into their struct
Just like it was done with items and exprs. Simplifies some code.
2011-07-04 22:00:06 +02:00
Rafael Ávila de Espíndola
b669430f72 Use metadata to avoid always passing -Lrustllvm to the linker. 2011-07-04 13:22:23 -04:00
Rafael Ávila de Espíndola
6b1da80eb4 Simplify. 2011-07-04 11:36:10 -04:00
Rafael Ávila de Espíndola
e0ce092ddc Simplify the code a bit. 2011-07-04 11:17:30 -04:00
Josh Matthews
7e7e326ee6 Make use of demand::simple instead of manually checking fail expr type. 2011-07-03 21:46:17 -07:00
Josh Matthews
a2775a5b72 Make non-str fail expression a type checking failure instead of a translation one. 2011-07-03 21:46:17 -07:00
Tim Chevalier
b110bbf886 Un-XFAIL fail-arg 2011-07-03 11:56:23 -07:00
Tim Chevalier
046c25dbc0 Handle fail as an argument; parse fail expressions unambiguously
An expression like:

foo(1, fail, 2)

was failing to parse, because the parser was interpreting the comma
as the start of an expression that was an argument to fail, rather
than recognizing that the fail here has no arguments

Fixed this by using can_begin_expr to determine whether the next
token after a fail token suggests that this is a nullary fail or a
unary fail.

In addition, when translating calls, check before translating each
argument that the block still isn't terminated. This has the effect
that if an argument list includes fail, the back-end won't keep trying
to generate code for successive arguments and trip the !*terminated
assertion.
2011-07-03 11:51:47 -07:00
Tim Chevalier
6369807ffe Add a predicate that determines whether a token can begin an expression 2011-07-03 11:51:46 -07:00
Tim Chevalier
48a69d2100 Eliminate all direct calls to option::get() from typeck
This means fewer mysterious error messages.
2011-07-03 02:48:08 -07:00
Tim Chevalier
c425a422ed Manipulate contexts correctly in trans_fail_expr
This fixes Issue #617
2011-07-03 02:38:11 -07:00
Tim Chevalier
9349826909 XFAILing the new test case...
...because the parsing of fail got changed out from under me.
Will fix shortly.
2011-07-03 01:15:41 -07:00
Tim Chevalier
7426252549 Generate code properly for calls with _|_ - typed arguments
The code for translating a fail (for example) would call
Unreachable(), which terminates the block; if a fail appeared as an
argument, this would cause an LLVM assertion failure. Changed
trans_call to handle this situation correctly.
2011-07-02 22:02:59 -07:00
Tim Chevalier
f0fad0dca5 Add a function that determines whether the block is terminated 2011-07-02 22:02:08 -07:00
Josh Matthews
a4421cc4e8 Fix assertion failure when syntax extension name is missing. 2011-07-02 00:06:58 -07:00
Brian Anderson
7c8ee712be Fix the error-pattern on compile-fail/fail-simple
Recent changes to the fail statement changed the way the parser errors in this
scenario.
2011-07-02 00:06:58 -07:00
Josh Matthews
d485e0d15a Allow any string expression to be used with fail. 2011-07-02 00:06:58 -07:00
Patrick Walton
67c9ef9b30 rustc: Fix memory corruption with ivectors-inside-ivectors by duplicating *first*, and *then* copying subtypes. 2011-07-01 20:07:19 -07:00
Patrick Walton
d39c59ae41 rustc: Move path_to_str to front::ast 2011-07-01 17:22:18 -07:00
Rob Arnold
4e59b0be54 Sync rust_chan's deref() method with rustc's code.
If the channel is associated with a port then the destructor will assert.
Additionally, destruction of the object is not always appropriate. This brings
the deref() method into sync with the behavior of generated rust code which
only invokes destroy() once the reference count goes to 0.
2011-07-01 16:59:11 -07:00
Rob Arnold
02a5949aba Add macro for refcounting runtime structures.
The macro with the extra dtor parameter is intended for structures like
rust_chan which may not necessarily delete themselves when the ref count
becomes 0. This functionality will be used in an upcoming changeset.
2011-07-01 16:59:10 -07:00
Rob Arnold
73cc624e8e Move the channel destroy code into rust_chan.
This lets native code more easily destroy channels since directly deleting a
channel is not always the right way to destroy it.
2011-07-01 16:59:10 -07:00
Rob Arnold
09921cf86f Move channel cloning logic into a method on rust_chan.
This will allow us to more easily clone channels from native code.
2011-07-01 16:59:10 -07:00
Brian Anderson
396c4defcc Introduce --cfg argument for providing additional configuration. Issue #489 2011-07-01 15:30:25 -07:00
Brian Anderson
a34b61fb15 Add some FIXMEs for issue #607 2011-07-01 12:51:46 -07:00
Brian Anderson
021b203fc6 Add some logging to attr when reading crate link attributes
Only link attributes of the meta_list type are considered when matching crate
attributes. Instead of doing nothing we can at least log that link attributes
of other types were ignored.
2011-07-01 12:30:27 -07:00
Brian Anderson
22be98264e Add a test for mismatched crate metadata in use statements 2011-07-01 12:26:57 -07:00
Patrick Walton
f7a2f01746 Revert "rustc: Change methods in ty::t to use interior vectors"
This reverts commit 6720ea760d.
2011-07-01 11:37:19 -07:00
Patrick Walton
6720ea760d rustc: Change methods in ty::t to use interior vectors 2011-07-01 11:33:17 -07:00
Brian Anderson
172c5633c4 Export only what's in use from front::eval. Issue #604 2011-07-01 10:46:59 -07:00
Brian Anderson
bdc5abe82c Remove unused imports from front::eval 2011-07-01 10:45:30 -07:00
Brian Anderson
8614cc975c Remove remaining unused eval methods. Issue #604 2011-07-01 10:45:30 -07:00
Brian Anderson
91b87b31e5 Remove the concept of crate directive let statements. Issue #604 2011-07-01 10:45:30 -07:00
Brian Anderson
d8fe0d7cee Remove the concept of crate directive expressions. Issue #604 2011-07-01 10:45:30 -07:00
Brian Anderson
bca45720f7 Remove the environment concept from front::eval
This is the old method of conditional compilation. It is going away.

Issue #489
2011-07-01 10:45:30 -07:00
Brian Anderson
70a28dc238 Cleanup attribute code. Issue #487 2011-07-01 10:45:30 -07:00
Brian Anderson
26ce1e1035 Add some helper functions to front::attr 2011-07-01 10:45:29 -07:00
Brian Anderson
5fb9cad38d Partially restore the fuzzer crate's build rules
Right now the stage1/fuzzer crate will build but it's not linked to librustc
because stage1/librustc won't link.
2011-07-01 10:43:21 -07:00
Marijn Haverbeke
77f5d14f14 Track def_ids of native types so that they can be distinguished
Closes #526
2011-07-01 18:39:24 +02:00
Marijn Haverbeke
d863cdb98f Add tests for newtype-style tags 2011-07-01 17:51:49 +02:00
Marijn Haverbeke
432e5e9f7f Allow dereferencing of single-variant, single-argument tag values
(Using the * operator.)

This makes tags more useful as nominal 'newtype' types, since you no
longer have to copy out their contents (or construct a cumbersome
boilerplate alt) to access them.

I could have gone with a scheme where you could dereference individual
arguments of an n-ary variant with ._0, ._1, etc, but opted not to,
since we plan to move to a system where all variants are unary (or, I
guess, nullary).
2011-07-01 17:51:47 +02:00
Marijn Haverbeke
57e6340253 Allow 'newtype' syntax for tags
Doing this:

    tag foo = mytype;

is now equivalent to doing this:

    tag foo { foo(mytype); }
2011-07-01 17:51:43 +02:00
Marijn Haverbeke
fb72be0a89 Do not store a tag num for single-variant tags
This is a preparation for tags-as-nominal-types. A tag that has only a
single variant is now represented, at run-time, as simply a tuple of
the variant's parameters, with the variant id left off.
2011-07-01 17:50:52 +02:00
Marijn Haverbeke
bf20fe5575 Make sure the pretty-printer understand resources 2011-07-01 13:04:49 +02:00
Michael Sullivan
7b1b5d5a8a Implement autoderef for function calls.
This is important since we are going to be making functions noncopyable
soon, which means we'll be seeing a lot of boxed functions.
(*f)(...) is really just too heavyweight.

Doing the autodereferencing was a very little bit tricky since
trans_call works with an *lval* of the function whereas existing
autoderef code was not for lvals.
2011-07-01 12:39:58 +02:00
Michael Sullivan
ee45d54a4e Move autoderefed_ty to ty.rs and rename it type_autoderef. 2011-07-01 12:39:57 +02:00
Kelly Wilson
1e4f198a1d Update RustWrapper.cpp so that LLVM revision 134231 from June 30, 2011 at 22:15 GMT, works. 2011-07-01 00:56:49 -06:00
Patrick Walton
b4465aca5a stdlib: Fix long line in sort.rs 2011-06-30 22:21:30 -07:00
Patrick Walton
4c76bfdc1f stdlib: Add an interior vector version of sort and a test case 2011-06-30 19:09:52 -07:00
Patrick Walton
b773f8d22b rustc: Duplicate heap data of interior vectors when passing them by value 2011-06-30 19:09:52 -07:00
Graydon Hoare
0eb257e864 Minor pp cleanups. 2011-06-30 17:58:19 -07:00
Graydon Hoare
6d441d3238 Preserve hard \n\n pairs from source when pretty-printing, as explicit formatting control from users. 2011-06-30 17:25:20 -07:00
Patrick Walton
dc9f285b06 rustc: Remove unused variables from last commit 2011-06-30 16:19:04 -07:00
Patrick Walton
108cc4e0ed rustc: Change function argument types to interior vectors 2011-06-30 16:11:39 -07:00
Brian Anderson
50b1953f9b Pretty-print view items in mod items
For mods that aren't defined at the file level we were forgetting to print the
view items so, e.g. 'mod { use std; }' would not print correctly.
2011-06-30 16:08:28 -07:00
Graydon Hoare
1e63d5303f Restore some functionality that got stripped out of the export tests while last reformatting. 2011-06-30 15:39:25 -07:00
Brian Anderson
64d6081429 Use attributes for conditional compilation in std.rc 2011-06-30 14:13:49 -07:00
Brian Anderson
39fccf3bc7 Conditionally compile items declared as statements. Issue #489 2011-06-30 13:04:35 -07:00
Brian Anderson
6346a67cbd Add more tests for conditional compilation. Issue #489 2011-06-30 13:04:35 -07:00
Tim Chevalier
7fd04a21a1 remove an unused variable 2011-06-30 12:45:50 -07:00
Tim Chevalier
37bfbc4b79 Get rid of remaining unused variables 2011-06-30 12:37:30 -07:00
Tim Chevalier
6a74253d60 Don't warn about unused for-loop index variables 2011-06-30 12:37:30 -07:00
Tim Chevalier
d8db9a0fe1 Kill unused variables 2011-06-30 12:37:30 -07:00
Tim Chevalier
a0cdb23892 Get rid of an unused variable 2011-06-30 12:37:30 -07:00
Tim Chevalier
4519f54857 Warn for unused variables
Modify typestate to check for unused variables and emit warnings
where relevant. This exposed a (previously harmless) bug in
collect_locals where outer functions had bit-vector entries
for init constraints for variables declared in their inner
nested functions. Fixing that required changing collect_locals to
use visit instead of walk -- probably a good thing anyway.
2011-06-30 12:37:30 -07:00
Patrick Walton
add9031dd5 rustc: Use interior vectors for record types 2011-06-30 12:02:40 -07:00
Patrick Walton
fd0d1cb7d8 rustc: Make mk_imm_tup() take an interior vector 2011-06-30 11:35:05 -07:00
Patrick Walton
b841152a40 rustc: Use interior vectors for tuple types 2011-06-30 11:35:05 -07:00
Patrick Walton
be50cdd24a rt: Add room for the new fill slot when resizing interior vectors 2011-06-30 11:35:05 -07:00
Eric Holk
e1927553a5 Added a new version of pfib that's better suited for benchmarking the task system. It generates gnuplot output. 2011-06-30 11:32:16 -07:00
Eric Holk
b4a145e60f Added a nanosecond timer to time.rs, support for some floating point casts, and a commandline-driven mode for pfib.rs 2011-06-30 11:32:10 -07:00
Brian Anderson
441c7e0610 Un-XFAIL run-pass/conditional-compile.rs. Issue #489 2011-06-30 10:06:26 -07:00
Brian Anderson
4165d3640a Add a pass to fold out items that do not belong in the current configuration
The parser needs to parse unconfigured items into the AST so that they can
make the round trip back through the pretty printer, but subsequent passes
shouldn't care about items not being translated. Running a fold pass after
parsing is the lowest-impact way to make this work. The performance seems
fine.

Issue #489
2011-06-30 10:06:26 -07:00
Brian Anderson
3483c65b1f Add missing item variants to fold_item_underscore 2011-06-30 10:06:26 -07:00
Brian Anderson
aa6a3debf3 Add missing expression variants to fold_expr 2011-06-30 10:06:26 -07:00
Brian Anderson
1f0c25406c Fold the crate-level module in front::fold 2011-06-30 10:06:26 -07:00
Brian Anderson
5de916dd5c Move middle::attr to front::attr 2011-06-30 10:06:26 -07:00
Brian Anderson
afc8a5c031 Convert the eval::env to an ast::crate_cfg
crate_cfg will replace eval::env as the mechanism for conditional compilation.
This is a transitional step so they can both exist together.

Issue #489
2011-06-30 10:06:25 -07:00
Brian Anderson
d53bfad8e7 Introduce a config property to the crate AST node
This represents the compilation environment, defined as AST meta_items, Used
for driving conditional compilation and will eventually replace the
environment used by the parser for the current conditional compilation scheme.

Issue #489
2011-06-30 10:06:25 -07:00
Brian Anderson
cbcc7bba30 Introduce a testcase for conditional compilation via attributes
Issue #489
2011-06-30 10:06:21 -07:00
Brian Anderson
78a82b9fd1 Switch rustc's crate metadata to use the link attribute 2011-06-30 10:03:07 -07:00
Marijn Haverbeke
86f16b90cd Support type parameters in resources
Some rather dodgy code was added to trans in the process. I'd love to
discuss it with someone who knows more about types during translation.
2011-06-30 18:36:12 +02:00
Marijn Haverbeke
31ec26d46a Make calling resource destructors work cross-crate
Tydescs are currently re-created for each compilation unit (and I
guess for structural types, they have to be, though the duplication
still bothers me). This means a destructor can not be inlined in the
drop glue for a resource type, since other crates don't have access to
the destructor body.

Destructors are now compiled as separate functions with an external
symbol that can be looked up in the crate (under the resource type's
def_id), and called from the drop glue.
2011-06-30 18:36:12 +02:00
Graydon Hoare
8c36a76626 More fiddling with fast-check, now works on at least one windows machine. 2011-06-30 09:26:17 -07:00
Rafael Ávila de Espíndola
5b7ce80ffa Second try to remove -lssp. 2011-06-30 08:55:25 -04:00
Eric Holk
b3e5b5bd05 Added inheritance for task pinning. Closes #598 for real. 2011-06-29 18:56:34 -07:00
Eric Holk
63dcd325b9 Adding support for pinning tasks to the currently running thread. Closes #598. 2011-06-29 18:47:47 -07:00
Graydon Hoare
afabde19dc More fixes to fast-check. 2011-06-29 17:54:05 -07:00
Brian Anderson
a82aeb7af6 Register new snapshots
Also finish transition of snapshot scripts for new glue.o location
2011-06-29 17:45:54 -07:00
Brian Anderson
865534978f Change snapshot logic to archive glue.o from the lib directory 2011-06-29 15:39:30 -07:00
Graydon Hoare
4e5d32e1c4 Add fast-check target that combines the stage2 run-pass suite into a single executable. 2011-06-29 15:14:55 -07:00
Graydon Hoare
c796a8f24d Re-enable tidy (it was broken) and fix various non-tidy things. 2011-06-29 15:14:55 -07:00
Brian Anderson
190644063e Be more strategic about linking to rust crates
Instead of linking directly to the rust crate, try to figure out the location
and name of the library from the file name, then call gcc with appropriate -L,
-l flags. This will allow dynamic linking to be more forgiving about where it
loads the library from at runtime - currently a stage3 compiler can't run
correctly from the stage0 directory. Only tested on Linux. Fingers crossed.
2011-06-29 14:35:39 -07:00
Brian Anderson
e130e7b598 Display an error when linking fails 2011-06-29 14:35:39 -07:00
Brian Anderson
e60cb9197f Add session.note method 2011-06-29 14:35:39 -07:00
Brian Anderson
4ffa5ddf76 session.err shouldn't take a span 2011-06-29 14:35:39 -07:00
Tim Chevalier
76b755f9ad Remove workaround for a compiler bug that, I guess, got fixed 2011-06-29 14:28:03 -07:00
Tim Chevalier
88447a47c0 Eliminate the --check-claims compiler flag
The option can only be toggled at runtime now.
2011-06-29 14:28:02 -07:00
Tim Chevalier
1ba85932b1 Add a runtime flag to enable/disable claims en masse
Now, if the environment variable CHECK_CLAIMS is set, then all
claims turn into checks. Otherwise, claims are no-ops.
2011-06-29 14:28:02 -07:00
Brian Anderson
d4b5b48e0a Correctly locate the crate's version from the link attribute 2011-06-29 14:21:39 -07:00
Brian Anderson
29afe1a518 Write metadata for sythesized name/vers items to the crate's link attr
If the crate doesn't specify it's name or version, the defaults need to be
exported in the crate metadata
2011-06-29 14:21:39 -07:00
Brian Anderson
308bc31f24 Encapsulate more crate meta calculations 2011-06-29 14:21:39 -07:00
Brian Anderson
325f46da06 Move the calculation of the crate name, vers and cmh to a single function 2011-06-29 14:21:39 -07:00
Rafael Ávila de Espíndola
8c535d4aba Don't enable ssp everywhere. 2011-06-29 16:25:54 -04:00
Graydon Hoare
5b2c17fba5 Fix resource encoding bugs. 2011-06-29 12:14:29 -07:00
Graydon Hoare
750dcc05e4 Make tests a little more friendly to combine. 2011-06-29 12:14:29 -07:00
Patrick Walton
b18cefdfd7 rustc: Fix a leak that resulted from copying a structural interior type containing interior vectors. Add a test case. 2011-06-29 12:16:07 -07:00
Patrick Walton
a2ce532337 rt: Remove the lock around upcall_vec_append. Add a test case. Closes #156. 2011-06-29 10:33:51 -07:00
Rafael Ávila de Espíndola
54f618128e Revert ""Try" push without -lssp on windows to see what needs it."
This reverts commit 47b3e087e9.
2011-06-29 13:25:52 -04:00
Patrick Walton
bbd0d58955 rustc: Unbreak self assignment 2011-06-29 10:22:53 -07:00
Rafael Ávila de Espíndola
47b3e087e9 "Try" push without -lssp on windows to see what needs it. 2011-06-29 12:56:54 -04:00
Michael Sullivan
1d05718c2d Extend visit to use visit_fn to visit fn expressions. 2011-06-29 09:04:00 -07:00
Brian Anderson
bc47804473 Revert "Register new snapshots"
This reverts commit b29886cdeb.
2011-06-28 22:50:20 -07:00
Brian Anderson
b29886cdeb Register new snapshots 2011-06-28 22:24:33 -07:00
Brian Anderson
7c500fc0a0 Replace common::new_seq_hash with an adapter around std::smallintmap
It would be better to either convert ast_map to use smallintmap or make
smallintmap and hashmap follow the same interface, but I don't feel up to
it just now. Closes #585.
2011-06-28 19:48:33 -07:00
Lindsey Kuper
7b5d34aa9a Comments and cleanup. 2011-06-28 19:06:44 -07:00
Lindsey Kuper
57e5cde3a2 Comments and cleanup. 2011-06-28 18:54:56 -07:00
Lindsey Kuper
684c0dc494 Comments and cleanup. 2011-06-28 18:54:56 -07:00
Lindsey Kuper
9155544a5a Comments. 2011-06-28 18:54:56 -07:00
Brian Anderson
6832f75f0b Support attaching attributes to modules via the crate file. Issue #487 2011-06-28 18:39:34 -07:00
Patrick Walton
74f8eb51ae rustc: Move duplicate_heap_parts to copy glue; add a test case 2011-06-28 17:59:30 -07:00
Tim Chevalier
db478ed4de Remove outdated comments 2011-06-28 17:50:07 -07:00
Graydon Hoare
5059c5f8fd Actually notice xfail-stage2 as different from xfail-stage2. Fix affected tests. 2011-06-28 17:36:51 -07:00
Michael Sullivan
b944d8d72e Require that both sides of a swap be lvals. 2011-06-28 17:28:06 -07:00
Graydon Hoare
d79330de26 Fix logic bug in std::fs::dirname. 2011-06-28 17:24:30 -07:00
Brian Anderson
83b7215366 Cleanup attribute code. Issue #487 2011-06-28 16:55:07 -07:00
Brian Anderson
82a74fcb3f Remove the last traces of the distinction between export / local meta items
Issue #487
2011-06-28 16:55:07 -07:00
Patrick Walton
dfcfef41df rustc: Rename take glue to copy glue 2011-06-28 16:52:59 -07:00
Tim Chevalier
9f1444c701 Implement "claim"
Implement "claim" (issue #14), which is a version of "check" that
doesn't really do the check at runtime. It's an unsafe feature.

The new flag --check-claims turns claims into checks automatically --
but it's off by default, so by default, the assertion in a claim
doesn't execute at runtime.
2011-06-28 16:41:06 -07:00
Eric Holk
866ee6ecb4 Re-enabling some tests. 2011-06-28 16:12:34 -07:00
Eric Holk
f6f8a06d6b Resurrecting the runtime unit tests, and modifying them so they compile under the latest refactoring changes. 2011-06-28 16:12:34 -07:00
Eric Holk
657e5a2bd5 Renamed what's left of rust_dom to rust_scheduler 2011-06-28 16:12:33 -07:00
Eric Holk
02f6645fca Moved win32_require to the kernel. 2011-06-28 16:12:33 -07:00
Eric Holk
2f84987a48 Fixed Win32 compile errors. 2011-06-28 16:12:33 -07:00
Eric Holk
49a8cb34d2 Removed dom_owned, splitting things between task_owned and kernel_owned. Had to re-xfail a few tests brson recently un-xfailed. 2011-06-28 16:12:33 -07:00
Eric Holk
f6f945fed5 Moved thread management to rust_kernel. 2011-06-28 16:12:33 -07:00
Eric Holk
c6d8324830 There is only one domain per kernel now. 2011-06-28 16:12:33 -07:00
Eric Holk
1c852ac9c0 Removing runtime tests. The runtime is tested well enough by the standard library tests, so we might as well have less code to fix during refactoring. 2011-06-28 16:12:33 -07:00
Eric Holk
64596e6583 Teach the parser and typechecker to understand port[int](). Closes #588 2011-06-28 16:11:04 -07:00
Brian Anderson
1c6ae8cadf Use span_fatal for failure to find crates 2011-06-28 16:04:09 -07:00
Brian Anderson
46b83a92d6 Add test case for non-matching crate metadata in use statements 2011-06-28 15:58:22 -07:00
Brian Anderson
8ac60e99ea Extract meta_item sorting from back::link to middle::attr 2011-06-28 15:46:09 -07:00
Brian Anderson
aecc5e6e0f Add comments to middle::attr. Issue #487 2011-06-28 15:34:27 -07:00
Brian Anderson
a83b64d15d Rework how linkage attributes are determined
The meta items within a crate's link attribute are used in linkage:

 #[link(name = "std",
        vers = "1.0",
        custom = "whatever")];

Name and vers are treated specially, and everything else is hashed together
into the crate meta hash.

Issue #487
2011-06-28 15:25:47 -07:00
Brian Anderson
0608e277b6 Add some helper functions for attributes. Issue #487 2011-06-28 15:25:47 -07:00
Patrick Walton
7554423423 stdlib: Remove old botch from ufind 2011-06-28 14:16:09 -07:00
Tim Chevalier
d832f7abec Another test for typestate and expr_fn 2011-06-28 13:14:52 -07:00
Tim Chevalier
28459ca0eb Handle lazy binops properly in typestate
The typestate analysis now reflects that the second operand of a
logical and or or may not be evaluated.
2011-06-28 13:07:52 -07:00
Tim Chevalier
a7c4c19d4b add a predicate that determines whether a binop is lazy (and and or are lazy) 2011-06-28 13:07:52 -07:00
Rafael Ávila de Espíndola
d5fc01caef Move glue.o to stageN/lib. 2011-06-28 15:20:43 -04:00
Tim Chevalier
926049eddd Tests only: more tests with constraints and loops 2011-06-28 11:49:11 -07:00
Patrick Walton
1ca0db5421 rustc: Add a "type-owns-heap-mem" cache. 2x translation speedup. 2011-06-28 11:36:11 -07:00
Patrick Walton
5f5b7e3348 rustc: Don't call cmp glue if the type is a simple scalar 2011-06-28 11:24:34 -07:00
Graydon Hoare
0dc2aa3d09 Bit more work on mingw cross. Pending on other changes now (test combination, build artifact locations) 2011-06-28 11:18:34 -07:00
Brian Anderson
cab73f8897 Write metadata for more meta_item types. Issue #487 2011-06-28 10:12:05 -07:00
Brian Anderson
f53c4f79d7 Write metadata for crate attributes. Issue #487 2011-06-28 10:03:41 -07:00
Brian Anderson
894e2229ac Add emacs variables to encoder.rs 2011-06-28 10:03:40 -07:00
Brian Anderson
d328c7e03e List crate attributes when running rustc with '--ls' 2011-06-28 10:03:40 -07:00
Marijn Haverbeke
9561def209 Use 'resource' rather than 'res' as a keyword
Resources are now defined like...

    resource fd(int n) { close(n); }

Calling fd with an int will then produce a non-copyable value
that, when dropped, will call close on the given int.
2011-06-28 18:00:39 +02:00
Marijn Haverbeke
fb14afd5eb Add test cases for resources 2011-06-28 18:00:38 +02:00
Marijn Haverbeke
07125aa38b Fix bug that prevented boxes-in-resources from being freed 2011-06-28 18:00:05 +02:00
Marijn Haverbeke
e2cb97a2fc Add some missing cases for ty_res in ty.rs 2011-06-28 18:00:05 +02:00
Marijn Haverbeke
d730bb730a Make it possible to use * to dereference a resource 2011-06-28 18:00:05 +02:00
Paul Stansifer
b3443eb049 '#simplext' -> '#macro' 2011-06-28 15:02:12 +00:00
Paul Stansifer
c3901cdf8e Add simple syntax extension (#simplext) 2011-06-28 15:02:12 +00:00
Paul Stansifer
b632681780 Add AST fold. 2011-06-28 15:02:12 +00:00
Marijn Haverbeke
be748fc215 Properly guard resource values against double-drop
Ths involved adding an extra field to their representation, so that there is
something to check for zero.
2011-06-28 16:14:15 +02:00
Rafael Ávila de Espíndola
ecc080ed0b Use "" in the native_name as an indication that no extra options have to
be passed to the "linker". Use that for libc.
2011-06-28 08:21:13 -04:00
Patrick Walton
663aa76635 rustc: Call cmp glue directly if we statically know it 2011-06-27 18:35:01 -07:00
Patrick Walton
dfccd5a138 rustc: Fix stack explosion on -O0 from Alloca() instead of alloca() in cmp glue 2011-06-27 18:27:26 -07:00
Tim Chevalier
85b5b2a8e4 Tests for while loops that may invalidate constraints
Wrote some small test cases that use while loops and moves, to
make sure the poststate for the loop body gets propagated into the
new prestate and deinitialization gets reflected.

Along with that, rewrite the code for intersecting states. I still
find it dodgy, but I guess I'll continue trying to add more tests.
Also, I'll probably feel better about it once I start formalizing
the algorithm.
2011-06-27 18:14:23 -07:00
Tim Chevalier
6d1050b1c7 pure_exp should set the state, not extend it
This fixes a bug where de-initializations were getting masked
(and programs that used a variable that had been de-initialized
snuck through).
2011-06-27 18:14:23 -07:00
Brian Anderson
a72481f90b Rename metadata::defs to metadata::tags 2011-06-27 16:43:50 -07:00
Brian Anderson
55944f4e7f Don't export some of the metadata modules 2011-06-27 16:38:57 -07:00
Brian Anderson
df2cfac07f Move what's left of metadata::cwriter into middle::trans 2011-06-27 16:30:27 -07:00
Brian Anderson
45efb1f02a Cleanup in metadata module 2011-06-27 16:30:27 -07:00
Brian Anderson
119193497e Extract metadata::decoder from metadata::creader 2011-06-27 16:30:27 -07:00
Brian Anderson
a3a2cc3d98 Extract metadata::tydecode from metadata::creader 2011-06-27 16:30:27 -07:00
Brian Anderson
33294c7293 Extract llvm-independent code from cwriter to metadata::encoder 2011-06-27 16:30:27 -07:00
Brian Anderson
279a229414 Move metadata tag definition to metadata::defs 2011-06-27 16:30:27 -07:00
Brian Anderson
6c23e09454 Limit exports from metadata::tyencode 2011-06-27 16:30:27 -07:00
Brian Anderson
5601a6f534 Move metadata::cwriter::encode to metadata::tyencode 2011-06-27 16:30:27 -07:00
Brian Anderson
ba5c7a570d Rename middle::metadata to metadata::cwriter. Move creader to metadata
Preparation for a lot more metadata refactoring
2011-06-27 16:30:27 -07:00
Brian Anderson
d4a5487e1c Limit exports from middle::metadata 2011-06-27 16:30:27 -07:00
Patrick Walton
e4b5d910dc rustc: Directly emit calls to glue if possible 2011-06-27 15:38:21 -07:00
Michael Sullivan
12d9d07a84 Improve the tests for vector self appending. 2011-06-27 12:34:45 -07:00
Michael Sullivan
99b4fff4d2 Properly handle the case where src==dst but we have to allocate a new vector. 2011-06-27 12:34:45 -07:00
Michael Sullivan
ec80918865 Add a test written by jdm that tests repeated vector self appending. 2011-06-27 12:34:45 -07:00
Michael Sullivan
8ad7f3b56b Properly handle the case where src==dst in upcall_vec_append. 2011-06-27 12:34:44 -07:00
Brian Anderson
36fb754476 Index obj and res ctor metadata by ctor id, not item id
Both the type and the ctor were trying to use the same id and this was making
creader unable to find the ctor when running 'rustc --ls'
2011-06-27 12:34:44 -07:00
Patrick Walton
b55277002b etc: Eliminate dyld valgrind errors on OS X 2011-06-27 12:34:13 -07:00
Rafael Ávila de Espíndola
ac081c30be Record and link with used native libraries. 2011-06-27 15:24:44 -04:00
Tim Chevalier
a6f36ba3f5 removing log statement that snuck in there 2011-06-27 11:38:07 -07:00
Tim Chevalier
1656fa19ef Implement move for scalar values
Before, something like:

let int y = 42;
let int x;
x <- y;

would cause an LLVM assertion failure. Fixed it.
2011-06-27 11:32:06 -07:00
Graydon Hoare
bc9fa31618 A little tidying in rt. 2011-06-27 10:08:57 -07:00
Eric Holk
022ebc198b Implementation mising features in lock_and_signal for Win32. Also lowered the minimum stack size to get the pfib benchmark to run without exhausting its address space on Windows. 2011-06-27 09:58:39 -07:00
Eric Holk
681c063ec0 Conservatively serialize nearly all upcalls. Successfuly ran make check with RUST_THREADS=8, so we're probably fairly safe now. In the future we can relax the synchronization to get better performance. 2011-06-27 09:58:39 -07:00
Eric Holk
6367bcf427 Fixed a few concurrency bugs. Still not perfect, but overall it seems much more reliable. 2011-06-27 09:58:39 -07:00
Eric Holk
4d99bf9af2 Added some locking to ports to prevent the case where two threads simultaneously wake up a task blocked on a certain port. 2011-06-27 09:58:39 -07:00
Eric Holk
cb00befff0 Added an environment variable to control how many threads to use. 2011-06-27 09:58:39 -07:00
Eric Holk
4bc773465f Basic multithreading support. The infinite loops test successfully maxes out the CPU. 2011-06-27 09:58:39 -07:00
Eric Holk
91eadfd1ea Added a parallel fibonacci program. It doesn't actually run in parallel yet, but it will give us something fun to test threading with. 2011-06-27 09:58:39 -07:00
Rafael Ávila de Espíndola
bea28ea537 Easy fix for using newer LLVMs: just use the MachOObjectFile.cpp they provide. 2011-06-27 11:52:23 -04:00
Brian Anderson
fcbdac96dd Update README files 2011-06-26 22:27:22 -07:00
Brian Anderson
f2d76bcd7d Remove src/run.py
This script is totally bitrotted
2011-06-26 22:01:32 -07:00
Brian Anderson
29a8219c4c Add a very simple map implementation for sequential integer keys
Use it for the ast_map. Cuts 40% off the time spent prior to LLVM.
2011-06-26 20:37:08 -07:00
Brian Anderson
08b49a5d8f Reformulate an assert in ty::tag_variants
This was doing a redundant hashmap lookup. Removing the redundancy trims 5%
(2.8s) off rustc's compile time
2011-06-26 18:02:47 -07:00
Brian Anderson
cfaa0f4b91 Fail typechecking for bad binop/type combinations
Includes assignment operations. Add regression tests for lots of less useful,
less used or unexpected combinations, as well as a selection of compile-fail
tests. Closes #500 (again!)
2011-06-25 19:42:59 -07:00
Brian Anderson
51d07830ba Add a test for mismatched types when comparing functions 2011-06-25 19:28:19 -07:00
Marijn Haverbeke
afa632124f Use single-bar or to make tstate/states.rs prettier
Sorry. This is the kind of thing I do when I'm on a plane and too
tired to manage anything that requires thinking.
2011-06-25 21:16:03 +02:00
Marijn Haverbeke
7432017d5e Primitive support for non-copyable values 2011-06-25 21:15:11 +02:00
Marijn Haverbeke
f6753be655 Allow moving out of temporary values
This will probably need more work, as moving doesn't appear to do
quite the right thing yet in general, and we should also check
somewhere that we're not, for example, moving out the content out of
an immutable field (probably moving out of fields is not okay in
general).
2011-06-25 21:15:11 +02:00
Marijn Haverbeke
61fc12d0d0 Partial implementation of resources
Non-copyability is not enforced yet, and something is still flaky with
dropping of the internal value, so don't actually use them yet. I'm
merging this in so that I don't have to keep merging against new
patches.
2011-06-25 21:15:11 +02:00
Marijn Haverbeke
781a265b88 Remove variable name 'res' from test suite 2011-06-25 21:15:04 +02:00
Tim Chevalier
c772269f08 Fix inexhaustive match in parser 2011-06-24 22:38:01 -07:00
Tim Chevalier
582e1f13f0 Invalidate constraints correctly after an assignment expression
Modified typestate to throw away any constraints mentioning a
variable on the LHS of an assignment, recv, assign_op, or on
either side of a swap.

Some code cleanup as well.
2011-06-24 22:36:53 -07:00
Michael Sullivan
818d7c9398 Use visit_fn_{pre,post} to avoid going past lambdas during writeback instead of explicitly casing. 2011-06-24 15:55:08 -07:00
Michael Sullivan
4499ebe858 Add a test that tests typestate checking inside of fn exprs. 2011-06-24 15:46:20 -07:00
Michael Sullivan
b732ec6f82 Have walk call visit_fn_pre and visit_fn_post on fn expressions.
As a side effect, this fixes a bug where typestate would not properly be checked
inside of fn expressions.
2011-06-24 15:46:20 -07:00
Michael Sullivan
f3717da1b1 Modify the fn vistors in walk so that they can handle functions without names. Update the typestate code to understand this. 2011-06-24 15:46:20 -07:00
Paul Stansifer
142ff011da Make a test compile faster. 2011-06-24 14:47:36 -07:00
Patrick Walton
baf474443a rustc: Increment by the unit size in iter_structural_ty when iterating over interior vectors if the unit size is dynamic 2011-06-24 17:36:30 -04:00
Marijn Haverbeke
2ebd19477b Sanitize use of ids for obj constructors.
Typeck and trans used to, by historical coincidence, use the item_obj
node id, which was used to identify the obj type by the rest of the
system, for the constructor function. This is now identified by the
ctor id stored in the tag throughout.
2011-06-24 21:22:52 +02:00
Marijn Haverbeke
9643aedb04 Remove uses of variable name 'res' from rustc
This in preparation of making 'res' a keyword for defining resources.
Please don't introduce too many new ones in the meantime...
2011-06-24 21:22:23 +02:00
Marijn Haverbeke
d507d5fe91 Remove res idents from stdlib 2011-06-24 21:13:26 +02:00
Marijn Haverbeke
3d7fdb509a Remove def_obj
Since obj constructors and types have different def_ids now,
their def can simply be a def_fn and a def_ty.
2011-06-24 21:13:25 +02:00
Patrick Walton
b4c0893a39 rustc: If needed, duplicate types' heap parts recursively through structural types 2011-06-24 14:32:50 -04:00
Brian Anderson
1e7f06b17a test: Improve ternary operator tests 2011-06-23 23:27:32 -07:00
Brian Anderson
3aa8d7ff45 rustc: Pretty-print ternary operator 2011-06-23 23:14:40 -07:00
Brian Anderson
b9fc4dfc54 rustc: Cleanup trans_if, trans_alt 2011-06-23 22:16:16 -07:00
Brian Anderson
05c0216654 rustc: Add ternary operator. Closes #565
The implementation is so simple it might be considered cheating: at almost
every step the expr_ternary is just converted to expr_if.
2011-06-23 22:16:11 -07:00
Michael Sullivan
5495ad17d1 Fix type inference inside of anonymous functions. 2011-06-23 21:36:10 -07:00
Eric Holk
860e8fd98b Combined set_registers and get_registers into swap_registers. 2011-06-23 20:23:04 -07:00
Eric Holk
98dee91f25 Wrote swap_context in assembly. Closes #548. This also allows us to re-enable optimization on OSX for both gcc and clang. Also, re-enamed task-comm-1.rs, which was previously broken by optimization. 2011-06-23 18:49:29 -07:00
Rafael Ávila de Espíndola
3c534b2bef Remove parse_str_lit_or_env_ident.
We decided to use metadata for the more complex cases, and a simple
string is enough for rustc right now.
2011-06-23 18:42:55 -04:00
Graydon Hoare
14c31c26c2 Flesh out type pp code. 2011-06-23 18:40:44 -04:00
Patrick Walton
f3798fd213 rustc: Load immediate types when iterating over interior vectors 2011-06-23 17:43:03 -04:00