Commit graph

3619 commits

Author SHA1 Message Date
Jesse Ruderman
3671cddcba Remove comments complaining about https://github.com/graydon/rust/issues/633 since it is fixed 2011-07-10 17:05:25 -07:00
Jesse Ruderman
e91f8b5db2 Pieces of a fuzzer, WIP 2011-07-10 17:05:25 -07:00
Brian Anderson
6d3513eaee Make #fmt work from inside std. Issue #175
At long last, this patch makes #fmt usable from inside the standard library.
The way it does it us very hackish, but at least it works now.
2011-07-10 17:00:28 -07:00
Brian Anderson
e494e73cdd Use more encapsulation for metadata::cstore 2011-07-10 15:44:11 -07:00
Patrick Walton
18ebef5bba stdlib: Remove FIXME that's more like a WONTFIX 2011-07-10 15:35:06 -07:00
Patrick Walton
4008cad044 stdlib: Remove the cast from ioivec 2011-07-10 13:22:29 -07:00
Patrick Walton
7871b55597 stdlib: Implement an interior-vector version of the io module 2011-07-10 12:47:51 -07:00
Patrick Walton
875c4622fb stdlib: Implement str::bytes_ivec() using pointers and casts 2011-07-10 02:05:52 -07:00
Patrick Walton
91dcc1d054 stdlib: Add missing unsafe.rs. Puts out burning tinderbox. 2011-07-10 01:32:35 -07:00
Patrick Walton
7efb942639 rt: Remove the now-unused upcall_ivec_resize and upcall_ivec_spill, which allocated from the wrong heap 2011-07-10 01:30:45 -07:00
Patrick Walton
0babfd9f98 stdlib: Add unsafe to the std.rc, now that it actually builds 2011-07-10 01:24:31 -07:00
Patrick Walton
d30f22eb65 rt: Remove the _2 prefix from intrinsics; all rust-intrinsics now use explicit return pointers 2011-07-10 01:20:18 -07:00
Patrick Walton
f02c998a8d snap: Register new snapshots 2011-07-10 01:13:00 -07:00
Patrick Walton
f42c94740a rustc: Make rust-intrinsics take an explicit return pointer 2011-07-09 21:13:25 -07:00
Patrick Walton
e823ca4965 stdlib: Implement casts. The horror. 2011-07-09 20:14:47 -07:00
Brian Anderson
75047ea87e Generate code to load a crate's tests into the std test runner. Issue #428 2011-07-09 19:30:04 -07:00
Brian Anderson
09982784c6 Begin adding some test runner types to std. Issue #428 2011-07-09 16:08:03 -07:00
Brian Anderson
f72dbec9b5 Collect functions that look like unit tests. Issue #428 2011-07-09 12:36:03 -07:00
Brian Anderson
5543404abe Track the path as we fold over the AST looking for unit tests. Issue #428 2011-07-09 12:35:30 -07:00
Brian Anderson
9af59f9d81 Add sha1 and int tests to stdtest. Issue #428 2011-07-09 12:35:30 -07:00
Brian Anderson
45b00935f3 Begin running the test for int::pow
Somehow this has been disabled forever
2011-07-09 12:35:30 -07:00
Tim Chevalier
9ec5e90608 Tests for constraint propagation 2011-07-08 22:25:57 -07:00
Tim Chevalier
182c413af1 Propagate constraints through copy, move, and swap
Assignments and moves with a simple local variable reference on the
RHS now propagate any typestate constraints the RHS was involved
in to the LHS. Swaps where both sides are local variables
exchange the constraints.

This was a pain in the butt and I'm still not proud of the resulting
code. Needs refactoring like whoa.
2011-07-08 22:25:57 -07:00
Tim Chevalier
be6febb46d Minor refactoring 2011-07-08 22:25:57 -07:00
Tim Chevalier
7060f4c89c Alias-ify some prettyprinting functions 2011-07-08 22:25:57 -07:00
Tim Chevalier
36c4cb37ad Improve impossible-case handling in ty::get_element_type 2011-07-08 22:25:57 -07:00
Patrick Walton
91d45b91e6 stdlib: Implement str::unsafe_from_bytes_ivec() 2011-07-08 22:23:11 -07:00
Patrick Walton
aa0f6f4961 stdlib: Add an offset function for simple pointer arithmetic on unsafe pointers 2011-07-08 21:56:15 -07:00
Brian Anderson
7498d03693 Improve the error message for import glob collisions. Closes #482
Instead of noting where the imported things were defined, note where they were
imported. This is more useful and avoids issue #482.
2011-07-08 18:55:01 -07:00
Brian Anderson
394b8fcd1c Add test case for issue #333. Closes #333
This has been fixed by a mystery hacker.
2011-07-08 17:43:44 -07:00
Patrick Walton
1ff426b89f rustc: Use interior vectors for the union-find in rustc 2011-07-08 17:00:21 -07:00
Patrick Walton
9b7984c250 snap: Register new snapshots 2011-07-08 16:51:25 -07:00
Patrick Walton
ccfbb74f11 rustc: Move maps over to interior vectors 2011-07-08 16:37:43 -07:00
Patrick Walton
8450ab9a2b rustc: Fix a level-of-indirection problem by using size_of() to compute dynamically sized interior vector element sizes instead of field_of_tydesc() 2011-07-08 16:37:43 -07:00
Brian Anderson
f5d604f0c3 Decode types across multiple crates. Closes #632 2011-07-08 15:07:14 -07:00
Lindsey Kuper
33ce1164e2 Nicer pretty-printing for anon objs. Closes #499.
(Incidentally, what's the right way to test changes to the
pretty-printer?  There has to be a better way than what I did, which
was to log_err the results of expr_to_str as exprs passed through
trans and glance at the output.)
2011-07-08 15:00:47 -07:00
Brian Anderson
4319e7a655 Recursively load dependencies of external crates. Issue #632 2011-07-08 14:07:41 -07:00
Brian Anderson
412e203b3c Refactor load_library_crate and resolve_crate 2011-07-08 14:07:41 -07:00
Brian Anderson
dd8ab24da2 Add a map from external cnums to local cnums in cstore::crate_metadata
Once populated, this will allow us to load type info for types defined in
external crates referenced by other external crates.
2011-07-08 14:07:41 -07:00
Brian Anderson
061bcb2e42 Extract resolve_crate from creader::visit_view_item 2011-07-08 14:07:41 -07:00
Eric Holk
79ca673af7 Adding more support for working with u64s. 2011-07-08 14:02:26 -07:00
Rafael Ávila de Espíndola
4c309321e0 Try to use static crate if we cannot find the dynamic one. This supports
the common case of wanting to link statically with the project's libraries
but dynamically with the system ones.
2011-07-08 15:39:44 -04:00
Rafael Ávila de Espíndola
94f0e9d956 Add just enough logic to the driver so that we can link std statically. 2011-07-08 15:05:32 -04:00
Patrick Walton
0864a22ace stdlib: Add an interior vector version of union-find for now 2011-07-08 11:44:38 -07:00
Eric Holk
d7db25e8f6 Added an environment variable to override the minimum stack size. Closes #637. 2011-07-08 11:36:56 -07:00
Brian Anderson
4c0a2ed378 Fix newlines when outputting crate attributes with --ls 2011-07-08 11:34:15 -07:00
Brian Anderson
3070439c00 Encode/decode a crate's externel dependencies. Issue #632
The encoding is very simple right now, just the crate name. Ultimately this
won't be enough for our versioning needs, but it should fill our immediate
need of being able to correlate encoded crate numbers to actual crates.
2011-07-08 11:34:15 -07:00
Patrick Walton
7c66894a71 rustc: Do dynamic size calculations properly when concatenating interior vectors. Closes #640. 2011-07-08 11:29:29 -07:00
Brian Anderson
d0a432f4bb Don't export tyencode from the metadata module
This involves pulling the type_abbrev cache out of crate_ctxt
2011-07-08 09:37:01 -07:00
Brian Anderson
00d54018f1 Cleanup decoding and crate searching 2011-07-08 09:37:01 -07:00
Brian Anderson
06391dda02 Make the interface to metadata::csearch more consistent 2011-07-08 09:37:01 -07:00
Brian Anderson
85212840c0 Remove unused functions from metadata::csearch 2011-07-08 09:37:01 -07:00
Brian Anderson
9ebb60d38b Extract various dependencies from metadata::decoder to metadata::csearch 2011-07-08 09:37:01 -07:00
Brian Anderson
7ae711fc03 Begin splitting metadata::decoder into decoding and crate search modules 2011-07-08 09:37:01 -07:00
Brian Anderson
cc2924068f Replace various ints with ast::crate_nums 2011-07-08 09:37:01 -07:00
Brian Anderson
29b766029c Move external crate/lib resolution to its own pass
The scope of external crate reading is beyond the resolve pass now, as it
builds up tables of information needed for several different purposes.
2011-07-08 09:37:01 -07:00
Brian Anderson
85535fc3e0 Move crate_map from resolve to cstore 2011-07-08 09:37:00 -07:00
Brian Anderson
513b2276c2 Remove non-existant export from metadata::decoder 2011-07-08 09:37:00 -07:00
Brian Anderson
51e60b6565 Comment creader 2011-07-08 09:37:00 -07:00
Brian Anderson
639cf1a8ff Comment cstore 2011-07-08 09:37:00 -07:00
Brian Anderson
58d288a4f7 Move used_link_args from session to cstore 2011-07-08 09:37:00 -07:00
Brian Anderson
4bfa269fe7 Move used_libraries from session to cstore 2011-07-08 09:37:00 -07:00
Brian Anderson
1386420cad Move used_crate_files from session to cstore 2011-07-08 09:37:00 -07:00
Brian Anderson
82983e5005 Replace the crate cache in session with the one in cstore 2011-07-08 09:37:00 -07:00
Brian Anderson
b23ecd47ce Introduce metadata::cstore
I intend for this to be the location for storing all the data retrieved by
creader, most of which is currently in the session.
2011-07-08 09:37:00 -07:00
Marijn Haverbeke
c7bfef43c8 Ignore current scope when resolving self-shadowing imports
That is, for example, import x::y::x, which defines a local x,
and thus wouldn't be able to find x::y anymore.

Closes issue #624
2011-07-08 16:04:40 +02:00
Marijn Haverbeke
eeda0f4ab1 Don't unbox types in ty::is_binopable, do it on typeck side instead
Closes issue #631

Removes ty::strip_boxes entirely, since unboxing is now more complicated
anyway.
2011-07-08 15:52:54 +02:00
Marijn Haverbeke
381505f947 Remove useless return value in typeck::check_decl_local 2011-07-08 15:01:54 +02:00
Marijn Haverbeke
022363a674 Auto-bind generic functions when their value is taken in non-call context
trans::trans_lval will now autobind if the given expression was the
name of a generic functions. Those callees (trans_call and trans_bind)
that are interested in the generics information call trans_lval_gen
now.
2011-07-08 14:28:46 +02:00
Marijn Haverbeke
faec0d7799 Avoid superfluous take/drop for temp values passes as arguments 2011-07-08 13:46:29 +02:00
Marijn Haverbeke
b41fd61045 Make for-each bodies close over their parent's iterbody
Closes issue #639
2011-07-08 11:55:15 +02:00
Patrick Walton
7ed556cf8e rustc: Check iter return types. Closes #638. 2011-07-07 19:08:59 -07:00
Patrick Walton
2255eda625 rustc: Fix long line 2011-07-07 18:41:54 -07:00
Patrick Walton
edf8245273 rustc: Make trans use interior vectors 2011-07-07 18:39:05 -07:00
Patrick Walton
e1b107d74e rustc: Remove all exterior vectors from the AST 2011-07-07 18:39:05 -07:00
Eric Holk
3958c72cd8 Some cleanup 2011-07-07 18:32:45 -07:00
Eric Holk
4739953b84 Fixed two races.
The first is that the memory_region destructor would complain there is
still an outstanding allocation. This is because circular_buffer from
rust_chan wasn't refing its task, so the task was being destructed too
soon.

The second was where the program could deadlock while joining a
task. The target task would die in the time between checking whether
the task should block and then actually blocking. The fix is to use
the target task's lock.
2011-07-07 18:22:27 -07:00
Eric Holk
2d57b25f6b Added a stress test mode to pfib. 2011-07-07 18:22:27 -07:00
Eric Holk
f6e37f659c Made TRACK_ALLOCATIONS add only constant time overhead. This makes it
feasible to turn it on and run rustc.
2011-07-07 18:22:27 -07:00
Eric Holk
5d9a5b7d55 Tightened up the scoping for our various new operators, which should
make it harder to use the wrong one.
2011-07-07 18:22:27 -07:00
Eric Holk
8acadb17c2 Work on debugging race conditions.
Ports and channels have been moved to the kernel pool, since they've
been known to outlive their associated task. This probably isn't the
right thing to do, the life cycle needs fixed instead.

Some refactorying in memory_region.cpp. Added a helper function to
increment and decrement the allocation counter. This makes it easier
to switch between atomic and non-atomic increments. Using atomic
increments for now, although this still does not fix the problem.
2011-07-07 18:22:27 -07:00
Eric Holk
dcd2563a3a Removing the synchronized memory region from tasks. 2011-07-07 18:22:27 -07:00
Eric Holk
a0f45f4456 Removing most of the locks in rust_upcall.cpp and elsewhere. 2011-07-07 18:22:27 -07:00
Lindsey Kuper
e7111fe147 Un-xfail a test. 2011-07-07 17:39:35 -07:00
Lindsey Kuper
3243144046 Fix a bug that was interfering with method overriding. Issue #543.
Previously, we were creating both a normal vtable entry and a
forwarding function for overriding methods, when they should have just
gotten a vtable entry.  This patch fixes that.
2011-07-07 17:29:15 -07:00
Brian Anderson
94f782e6a1 Register new snapshots
New snapshots also include rt and rustllvm
2011-07-07 16:40:58 -07:00
Brian Anderson
64595a53f8 Add rt and rustllvm to the snapshot 2011-07-07 15:40:27 -07:00
Patrick Walton
deca79f372 Merge pull request #634 from robarnold/upstream-stable
Allocate ivecs out of the kernel pool
2011-07-07 15:18:07 -07:00
Rafael Ávila de Espíndola
5547e5dd21 Use new snapshot. 2011-07-07 17:36:23 -04:00
Brian Anderson
6ee1ffe4ac Rename encoder::ty_str to encoded_str 2011-07-07 13:31:12 -07:00
Brian Anderson
de88739350 Don't expert def_to_str from metadata::encoder 2011-07-07 13:31:12 -07:00
Brian Anderson
7d26d1d67b Move tyencode::ty_str to metadata::encoder 2011-07-07 13:31:12 -07:00
Brian Anderson
73963eae9a Refactor tyencode::ty_str to not require a tyencode::ctxt
All users were constructing the context the same way.
2011-07-07 13:31:11 -07:00
Brian Anderson
4304f8d4f6 Remove duplicate definition of def_to_str from middle::ty 2011-07-07 13:31:11 -07:00
Brian Anderson
e29ef1bec2 Refactor a few things in the metadata module
Rename metadata::tags to metadata::common. Move some utility functions from
metadata::encoder to metadata::common.
2011-07-07 13:31:11 -07:00
Brian Anderson
b723082cdb Rename hash_def_id to hash_node_id 2011-07-07 13:31:11 -07:00
Brian Anderson
d2362599d6 Remove metadata::encoder's dependence on trans::node_id_type 2011-07-07 13:31:11 -07:00
Rafael Ávila de Espíndola
83991c4c95 Add the static std library in the next snapshot. 2011-07-07 16:25:25 -04:00
Patrick Walton
0e2fff5337 rustc: Change lots of AST nodes to use interior vectors 2011-07-07 12:53:17 -07:00
Rafael Ávila de Espíndola
77c708cdbf Implement --lib --static. 2011-07-07 15:25:09 -04:00
Rafael Ávila de Espíndola
b13527735e Use an early exit to reduce indentation. 2011-07-07 14:59:18 -04:00
Rafael Ávila de Espíndola
6d6c4c2a76 Command line changes for adding support for static libraries. 2011-07-07 14:42:50 -04:00
Marijn Haverbeke
16f82dce1c Clean up trans_arg_expr
As a preparation for implementing the temporary-move optimization for
argument passing. The optimization itself isn't in yet, since it
mysteriously corrupts memory.
2011-07-07 17:54:58 +02:00
Marijn Haverbeke
3bdbf74d47 Make moving of temporaries do the right thing, use it to optimize
This adds support for dropping cleanups for temporary values when they
are moved somewhere else. It then adds wraps most copy operations
(return, put in data structure, box, etc) in a way that will fall back
to a move when it is safe.

This saves a lot of taking/dropping, shaving over a megabyte off the
stage2/rustc binary size.

In some cases, most notably function returns, we could detect that the
returned value is a local variable, and can thus be safely moved even
though it is not a temporary. This will require putting some more
information in lvals.

I did not yet handle function arguments, since the logic for passing
them looked too convoluted to touch. I'll probably try that in the
near future, since it's bound to be a big win.
2011-07-07 15:54:01 +02:00
Marijn Haverbeke
007a736642 Improve handling of move and swap by alias checker
Closes issue #541.
Closes issue #591
2011-07-07 10:37:19 +02:00
Rob Arnold
f6117173c9 Allocate rust_ivec buffers out of the kernel pool
The duplication of upcalls is due to the fact that the runtime is
shared between stage0/rustc and stage1/rustc. Once snapshots are
updated, they should be de-duplicated.
2011-07-06 20:41:24 -07:00
Rob Arnold
2e2e1f7cb3 Add realloc method to rust_kernel 2011-07-06 20:37:27 -07:00
Lindsey Kuper
130006cdda Tie the knot for self-calls inside extended objects. Closes #539. 2011-07-06 18:39:01 -07:00
Brian Anderson
cf4c2ac0be Generate a main fn for test running. Issue #428 2011-07-06 18:26:22 -07:00
Lindsey Kuper
6ca81b3407 Fix a pointer bug. 2011-07-06 17:16:54 -07:00
Lindsey Kuper
553beda96d Add span information to create_vtbl and friends. 2011-07-06 17:16:53 -07:00
Lindsey Kuper
41f6a3d5e1 Comments and cleanup. 2011-07-06 17:16:53 -07:00
Patrick Walton
2f29f9931d rustc: Make constraint args in the AST interior vectors 2011-07-06 16:19:19 -07:00
Patrick Walton
f164d7779a rustc: Move AST constraints to interior vectors 2011-07-06 16:12:39 -07:00
Patrick Walton
c83782f500 rustc: Migrate core AST types to interior vectors 2011-07-06 16:01:47 -07:00
Patrick Walton
aad0bcc8d5 rustc: Make AST tuple types use interior vectors 2011-07-06 15:53:47 -07:00
Patrick Walton
401b6362d7 rustc: Make meta items into interior vectors 2011-07-06 15:46:03 -07:00
Patrick Walton
479ce4d783 rustc: Move crate directives over to interior vectors 2011-07-06 15:15:06 -07:00
Patrick Walton
0226f56115 rustc: Convert attribute in the AST to interior vectors 2011-07-06 15:15:00 -07:00
Patrick Walton
7714cb297b rustc: Make AST paths use interior vectors 2011-07-06 15:14:52 -07:00
Patrick Walton
368f1f4ba8 rustc: Move middle::tstate::collect_locals over to interior vectors 2011-07-06 15:14:45 -07:00
Patrick Walton
b232ad94fd rustc: Remove unused or seldom-used imports from middle::tstate::{bitvectors, ck} 2011-07-06 15:14:35 -07:00
Patrick Walton
5739e0be01 rustc: Remove some unused references to std::vec from tstate::ann and tstate::auxiliary 2011-07-06 15:14:29 -07:00
Patrick Walton
abab04635a rustc: Move middle::tstate::auxiliary and middle::tstate::bitvectors over to interior vectors 2011-07-06 15:14:19 -07:00
Patrick Walton
6d1517cf3a rustc: Move tstate::annotate over to interior vectors 2011-07-06 15:14:09 -07:00
Patrick Walton
35c1dbd492 rustc: Convert bind_params_in_type() to use interior vectors 2011-07-06 15:13:59 -07:00
Patrick Walton
1d57800236 rustc: Migrate tag variants to interior vectors 2011-07-06 15:13:54 -07:00
Patrick Walton
2e1aa04fcd rustc: Make object methods into interior vectors 2011-07-06 15:13:47 -07:00
Patrick Walton
0391e14fc2 rt: Double stack size 2011-07-06 15:13:00 -07:00
Patrick Walton
91eb63eaee rt: Add a stack check to upcall_get_type_desc 2011-07-06 15:07:04 -07:00
Brian Anderson
2f7bc90514 Add a stdtest crate to hold the standard library tests
This will link to std and compile with the --test flag. Eventually the
run-pass/lib* tests will move here.

We could also put the std tests directly into the library and compile both a
library version and a test version, but I think this way will make for faster
builds.

Issue #428
2011-07-06 14:39:40 -07:00
Brian Anderson
b06ccb45ab Begin adding unit testing infrastructure to the compiler
Add a --test flag and a pass for transforming the AST to generate a test
harness.

Issue #428
2011-07-06 14:39:36 -07:00
Brian Anderson
0eac640fdd Swap the expected/actual for typechecking fields of updated records
In 'rec(a = b with c)', if a exists in c then the expected type for b is the
type of c.
2011-07-06 14:04:52 -07:00
Patrick Walton
05954f37b7 rustc: Use an interior vector for ty::count_ty_params 2011-07-06 12:05:18 -07:00
Patrick Walton
e066bae56e rustc: Move the interner over to interior vectors 2011-07-06 12:05:13 -07:00
Patrick Walton
717ac3df77 rustc: Make the various constraint-related types in middle::ty use interior vectors 2011-07-06 12:05:06 -07:00
Patrick Walton
2fd46b54fb rustc: Make type parameter substitutions interior vectors 2011-07-06 12:04:59 -07:00
Patrick Walton
cb2018c6db rustc: Change constraints in types to use interior vectors 2011-07-06 12:04:07 -07:00
Patrick Walton
13d920c10d rustc: Switch tag type parameters to interior vectors 2011-07-06 12:03:55 -07:00
Patrick Walton
ede35f4c43 rustc: Use interior vectors for tag type parameters 2011-07-06 12:03:06 -07:00
Eric Holk
111989a626 Removed what seems to be the last of the calls to rand(). Closes #582. 2011-07-06 11:50:25 -07:00
Brian Anderson
066bcc6c79 Make "cannot determine a type for this local variable" non-fatal 2011-07-06 11:44:42 -07:00
Brian Anderson
5c20a8aa9c Make "cannot determine a type for this expression" non-fatal. Closes #621 2011-07-06 11:44:36 -07:00
Brian Anderson
c31472e845 Refactor the typeck::writeback AST walk
All visitors take a wb_ctxt now instead of some taking a fn_ctxt and some
taking an ignore flag.
2011-07-06 11:42:20 -07:00
Brian Anderson
0c9c4cb575 Remove unused method from typeck::writeback 2011-07-06 11:42:20 -07:00
Brian Anderson
c1136e4e05 Limit exports from typeck 2011-07-06 11:42:20 -07:00
Brian Anderson
97c1537374 Limit exports from typeck::writeback 2011-07-06 11:42:20 -07:00
Lindsey Kuper
e30d2c82ae Simplify AST for expr_anon_obj. 2011-07-06 11:36:06 -07:00
Lindsey Kuper
23bae67f4c Simplify arguments to trans_anon_obj and friends. 2011-07-06 11:36:06 -07:00
Eric Holk
bc5d6aefda Added a task wakeup callback. Closes #599.
The callback happens when a task moves from the "blocked" state to the
"running" state. The callback is also inherited by child tasks. There
is currently only a native API.

This code hasn't been heavily exercised yet.
2011-07-06 11:30:00 -07:00