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
Patrick Walton
9a1f0977a2
rustc: Fix bug in equal_abi that was preventing Rust intrinsics from working
2011-05-05 14:21:59 -07:00
Tim Chevalier
6b742aec91
Enforce in typechecker that preds return a bool
...
as well as a test case
2011-05-05 11:26:07 -07:00
Tim Chevalier
e3a68e235c
Bring back "pred" syntax for writing predicates for check
...
This commit reinstates the requirement that the predicate in a
"check" must be a manifest call to a special kind of function
declared with the new "pred" keyword instead of "fn". Preds must
have a boolean return type and can only call other preds; they
can't have any effects (as enforced by the typechecker).
The arguments to a predicate in a check expression must be
slot variables or literals.
2011-05-05 11:26:07 -07:00
Tim Chevalier
3060eadcba
Check well-formedness of constraints
...
Check that the operand in a constraint is an explicit name,
and that the operands are all local variables or literals. Still need
to check that the name refers to a pure function.
2011-05-05 11:26:07 -07:00
Tim Chevalier
4f892dd9d7
Check that the operand in a check is a call
...
In addition, fix bug in fold that was turning asserts into checks.
More typechecking still needs to be done.
2011-05-05 11:26:07 -07:00
Marijn Haverbeke
1f45dda9d2
Remove 'deprecated mutable...' from our code
...
This should make compilation a bit less noisy.
2011-05-05 20:19:43 +02:00
Marijn Haverbeke
3d738e9e06
Return a fresh, unreachable context after ret, break, and cont
...
This ensures we don't get compile errors on unreachable code (see
test/run-pass/artificial-block.rs for an example of sane code that
wasn't compiling). In the future, we might want to warn about
non-trivial code appearing in an unreachable context, and/or avoid
generating unreachable code altogether (though I'm sure LLVM will weed
it out as well).
2011-05-05 20:19:43 +02:00
Marijn Haverbeke
9432626b68
Eradicate fold from capture.rs
...
The pass now uses walk.
2011-05-05 20:19:43 +02:00
Patrick Walton
fea623211f
rustc: Add a Link module; move crate writing to it to slim down trans slightly
2011-05-05 10:48:02 -07:00
Marijn Haverbeke
898e089d7b
Fix and re-enable destructors
...
There was some confusion on whether the destructors took their
argument by pointer or direct value. They now take it directly, just
like other methods. You no longer get a segfault when a constructor
actually does something with its self value.
2011-05-05 02:16:49 +02:00
Graydon Hoare
cdb6822405
Add a structure for passing option flags around the compiler, put it in session, and use it.
2011-05-04 16:59:21 -07:00
Brian Anderson
bd34770a92
Add missing ret statements to check_mod
...
Un-XFAIL compile-fail export tests
2011-05-04 19:29:27 -04:00
Graydon Hoare
ce9468761c
Support new -g flag, only mangle glue names by type when it's passed.
2011-05-04 15:36:42 -07:00
Patrick Walton
ac8eb20224
rustc: Stub support for Rust intrinsics
2011-05-03 18:03:59 -07:00
Patrick Walton
e43729ccf2
rustc: Refactor metadata.Encode.* to not require a type abbreviation table if abbreviation isn't enabled
2011-05-03 14:41:05 -07:00
Patrick Walton
3f317ede41
rustc: Name type glue properly
2011-05-03 14:41:05 -07:00
Brian Anderson
ed40c85af5
Extract ast.is_exported from the resolve module
2011-05-02 22:07:36 -04:00
Patrick Walton
ebc236e91c
rustc: Time the Rust translation and LLVM passes separately
2011-05-02 17:50:46 -07:00
Patrick Walton
a833f152ba
rustc: Remove the artificial block in ty.rs. Fixes self-hosting. Add a test case for this, XFAIL'd.
2011-05-02 17:50:46 -07:00
Patrick Walton
147a2d655f
Un-revert "Use different syntax for checks that matter to typestate", fixing the problem.
...
This reverts commit d08b443fff
.
2011-05-02 17:50:46 -07:00
Graydon Hoare
d08b443fff
Revert "Use different syntax for checks that matter to typestate"
...
This reverts commit aa25f22f19
. It broke stage2, not sure why yet.
2011-05-02 17:35:33 -07:00
Patrick Walton
9d21cf3b61
rustc: Allocate tydescs on the stack when it's safe to do so. 60% compile speed increase.
2011-05-02 15:28:59 -07:00
Tim Chevalier
aa25f22f19
Use different syntax for checks that matter to typestate
...
This giant commit changes the syntax of Rust to use "assert" for
"check" expressions that didn't mean anything to the typestate
system, and continue using "check" for checks that are used as
part of typestate checking.
Most of the changes are just replacing "check" with "assert" in test
cases and rustc.
2011-05-02 12:16:29 -07:00
Patrick Walton
870435caf5
rustc: Add a "fat tydesc" LLVM type to trans
2011-05-02 12:05:21 -07:00
Brian Anderson
1dd63ff42d
Remove the search direction from resolve's fold environment
...
It's not actually involved in the fold so it can just be passed between the
functions that need it.
2011-05-01 16:57:36 -04:00
Brian Anderson
a697210234
Hide unexported tag variants
2011-05-01 16:57:36 -04:00
Brian Anderson
459b0ec833
Implement simple module export
2011-05-01 16:57:36 -04:00
Patrick Walton
b101e26d92
rustc: Run scope cleanups in the implicit block created by log statements. Fixes a leak.
2011-04-29 19:19:54 -07:00
Patrick Walton
f6c472d816
rustc: Emit pure native glue; we don't call it yet
2011-04-29 16:40:30 -07:00
Patrick Walton
593fb195a4
rustc: Start threading a purity flag through upcalls
2011-04-29 15:39:48 -07:00
Graydon Hoare
b9babe47da
Temporarily disable dtors; they broke self-hosting.
2011-04-29 15:06:53 -07:00
Patrick Walton
1acf404361
rustc: First steps to determine whether tydescs escape
2011-04-29 15:01:07 -07:00
Graydon Hoare
7b95b5c033
Don't emit metadata unless compiling -shared.
2011-04-29 19:20:20 +00:00
Marijn Haverbeke
c39a95da90
Implement destructors in rustc
...
Unlike rustboot, rustc keeps it destructors in vtables. Entry 0 holds
either the destructor for the obj or a NULL pointer. The method
offsets start at 1.
2011-04-29 21:19:50 +02:00
Patrick Walton
adfacc5031
rustc: Add a --time-passes option
2011-04-29 11:55:20 -07:00
Patrick Walton
f0d24ff49e
rustc: Handle alias parameters in native functions properly
2011-04-29 11:54:41 -07:00
Graydon Hoare
a2f68b2d58
Intern metadata while writing, shrink stage1 from 12mb to 5.7mb.
2011-04-29 15:26:28 +00:00
Patrick Walton
6daf440037
rustc: Fix vec append glue for strings. Add a test case.
2011-04-28 20:16:32 -07:00
Patrick Walton
3e08609ed7
rustc: Add some value names to the vec append glue function. Un-XFAIL vec-growth.rs.
2011-04-28 18:45:56 -07:00
Graydon Hoare
1f44887761
More attempts at fixing broken vec-append glue.
2011-04-28 18:39:12 -07:00
Graydon Hoare
cd8cf44d1d
Make the no-growth path (previously never exercised) in rustc *work*.
2011-04-28 18:11:00 -07:00
Graydon Hoare
bcad52451c
Actually hit the no-growth path on vec-append.
2011-04-28 17:45:35 -07:00
Graydon Hoare
e300b8047f
Consider unop deref as an lval. Un-XFAIL vec-push.
2011-04-28 16:37:18 -07:00
Graydon Hoare
c9e601b31d
Drop args in native stubs too.
2011-04-28 14:35:12 -07:00
Tim Chevalier
34dae82b48
Add a session field to ty_ctxt and change an err to span_err
...
I changed instantiate to print out a more helpful error message,
which required passing it a session argument. To avoid
threading extra arguments through a lot of functions,
I added a session field to ty_ctxt.
2011-04-28 13:26:19 -07:00
Tim Chevalier
f61e77e745
Reindented things and removed superfluous comments, nothing to see here
2011-04-28 13:26:19 -07:00
Tim Chevalier
844fe20720
Fix some nested patterns in rustc
...
In rustc, nested patterns were potentially matching when they shouldn't
match, because a loop index wasn't being incremented. Fixed it and added
one test case.
2011-04-28 13:26:19 -07:00
Tim Chevalier
25694582d9
Fix bug in handling of expr_alt (postcond for alts was being intersected with postcond for scrutinee)
2011-04-28 13:26:19 -07:00
Tim Chevalier
707cd0281d
Fixed bug in typeck that wasn't filling in anns for stmts
...
(needed for typestate_check).
Also changed a (log; fail) to (log_err; fail) in typestate_check,
and added some more logging funs in util.common.
2011-04-28 13:26:19 -07:00
Tim Chevalier
0190ebfe07
Support all expression forms in typestate
...
Added support for self_method, cont, chan, port, recv, send, be,
do_while, spawn, and ext; handled break and cont correctly.
(However, there are no non-xfailed test cases for ext or spawn in
stage0 currently.)
Although the standard library compiles and all test cases pass with
typestate enabled, I left typestate checking disabled as rustc
terminates abnormally when building the standard library if so,
even though it does generate code correctly.
2011-04-28 13:26:19 -07:00
Tim Chevalier
7c4f8cb459
Further work on typestate_check
...
Lots of work on typestate_check, seems to get a lot of the way
through checking the standard library.
* Added for, for_each, assign_op, bind, cast, put, check, break,
and cont. (I'm not sure break and cont are actually handled correctly.)
* Fixed side-effect bug in seq_preconds so that unioning the
preconditions of a sequence of statements or expressions
is handled correctly.
* Pass poststate correctly through a stmt_decl.
* Handle expr_ret and expr_fail properly (after execution of a ret
or fail, everything is true -- this is needed to handle ifs and alts
where one branch is a ret or fail)
* Fixed bug in set_prestate_ann where a thing that needed to be
mutated wasn't getting passed as an alias
* Fixed bug in how expr_alt was treated (zero is not the identity
for intersect, who knew, right?)
* Update logging to reflect log_err vs. log
* Fixed find_locals so as to return all local decls and exclude
function arguments.
* Make union_postconds work on an empty vector (needed to handle
empty blocks correctly)
* Added _vec.cat_options, which takes a list of option[T] to a list
of T, ignoring any Nones
* Added two test cases.
2011-04-28 13:26:19 -07:00
Graydon Hoare
6daca7ea8d
Actually perform take/drop on args (oh my!)
2011-04-28 11:24:29 -07:00
Graydon Hoare
776255695a
Use cnames when present in ty.ty_to_str.
2011-04-27 13:36:39 -07:00
Graydon Hoare
12925505fb
Cache sha1 values of types, use seq-based mangling for glue as it's private anyways.
2011-04-27 13:36:23 -07:00
Graydon Hoare
031e86ca2d
Partly disable simplified-type glue optimization due to compile-time cost.
2011-04-27 16:03:45 +00:00
Patrick Walton
05587ebdff
rustc: Ignore the return value of native functions that return nil. stage1 can build libstd now, though it leaks.
2011-04-26 19:01:30 -07:00
Patrick Walton
532a65485d
rustc: Actually write the optimized bitcode when --save-temps is on
2011-04-26 19:01:24 -07:00
Graydon Hoare
e77f5b1561
Speed up calls to get_tydesc and kill cname-redundant glue generation.
2011-04-26 17:19:44 -07:00
Graydon Hoare
bc6e981537
Merge branch 'master' of ssh://github.com/graydon/rust
2011-04-26 20:39:33 +00:00
Graydon Hoare
418b23a538
Various bits of trans lint, nothing major.
2011-04-26 20:39:25 +00:00
Patrick Walton
ba3a4f6cc6
rustc: Cap ridiculous type name sizes
2011-04-26 13:08:48 -07:00
Patrick Walton
2746d20c83
rustc: Add a missing return value to Collect.ty_of_item()
2011-04-25 18:15:48 -07:00
Graydon Hoare
cf23db6be5
A little more guarding against wasted work in ty, typeck.
2011-04-25 18:08:13 -07:00
Patrick Walton
c4e13cd1fa
rustc: Use the abbreviated type names to avoid LLVM bitcode size explosion
2011-04-25 17:00:25 -07:00
Graydon Hoare
da328b1ba9
Kick ty_var and ty_local entries out of the type store. Pre-compute presence of var, local, param and bound_params in types.
2011-04-25 16:40:25 -07:00
Patrick Walton
e0479c902b
rustc: Add a -save-temps option to save bitcode and write output simultaneously; document command line switches
2011-04-25 14:08:12 -07:00
Patrick Walton
e102413aad
rustc: Pass a "type context" around instead of directly passing the type store; prep for removing type annotations
2011-04-25 12:15:55 -07:00
Graydon Hoare
b258060a94
Avoid type_store hashtable access for a variety of cases, probably only ty_var matters.
2011-04-25 09:49:08 -07:00
Graydon Hoare
485399a8d5
Skip substitution and/or binding when there's no work to do.
2011-04-25 05:39:18 +00:00
Graydon Hoare
1b9e6b3ad2
Bind tag members as aliases rather than new locals.
2011-04-25 04:12:40 +00:00
Graydon Hoare
912c1fc81c
Fix busted iter/put code. Un-XFAIL foreach-box-drop.rs.
2011-04-23 14:22:10 -07:00
Patrick Walton
2b298fa3e8
rustc: Use a silly "magic numbers" hack; seems to speed things up a bit.
2011-04-22 19:52:30 -07:00
Patrick Walton
94e5ca4df8
rustc: Include the cname in the hash to increase entropy
2011-04-22 19:26:00 -07:00
Patrick Walton
e0eccaddb2
rustc: Thread the type store through everything that needs to access type structures
2011-04-22 17:00:46 -07:00
Patrick Walton
3d62c9adf3
rustc: Move the type serialization logic to an Encode module
2011-04-22 14:48:25 -07:00
Patrick Walton
14d1c53a9c
rustc: Remove direct access to the cname field of types
2011-04-22 13:45:21 -07:00
Patrick Walton
c7473c8260
rustc: Switch @ty.t to ty.t so that we can change it to a uint
2011-04-22 12:27:52 -07:00
Patrick Walton
c1335510d5
rustc: Eliminate the direct use of ty.t.struct
2011-04-22 12:09:09 -07:00
Rafael Ávila de Espíndola
9eb1479746
Dispose the module.
...
Thanks to brson for noticing it.
2011-04-22 14:49:02 -04:00
Patrick Walton
106f783b33
rustc: Add a fast path when the types to be unified are exactly equal
2011-04-22 10:51:32 -07:00
Patrick Walton
9edaa7dba3
rustc: Add a fast path if there are no type substitutions to be made
2011-04-22 10:37:51 -07:00
Patrick Walton
9ab9bd9cc2
rustc: Improve the efficiency of lookup_item_type() slightly
2011-04-22 10:19:57 -07:00
Patrick Walton
117aff8688
rustc: Intern types
2011-04-21 19:31:13 -07:00