Commit graph

4057 commits

Author SHA1 Message Date
Michael Sullivan
5068ae4771 Factor out a bunch of environment construction code from trans_bind. 2011-07-28 18:40:17 -07:00
Brian Anderson
3896524750 Drop the previous reference when receiving. Closes #763 2011-07-28 18:22:15 -07:00
Graydon Hoare
bf99573860 Register new snapshots. 2011-07-28 16:28:04 -07:00
Brian Anderson
3dd522b6b7 Add an assertion about the lock in rust_chan::disassociate 2011-07-28 16:04:49 -07:00
Michael Sullivan
d0cb62ac90 Factor out box initializing code into trans_malloc_boxed. 2011-07-28 15:49:06 -07:00
Lindsey Kuper
0ea5a8a6ed Updated alt indenting. 2011-07-28 15:01:12 -07:00
Lindsey Kuper
b24da1c2e5 The names 'outer' and 'inner' make more sense than 'self' and 'with'.
(Also, some formatting and long-string cleanup.)
2011-07-28 14:54:32 -07:00
Brian Anderson
73812cd3de Turn off TRACK_ALLOCATIONS 2011-07-28 14:52:50 -07:00
Brian Anderson
4b356097c2 Change the locking rules around channel disassociation again
This prevents port's destructor from accessing a deleted channel
2011-07-28 14:25:20 -07:00
Brian Anderson
12ab65107a Make combine-tests ignore temp files 2011-07-28 14:24:20 -07:00
Brian Anderson
021bfb4b9b Reenable expr-scope test. Disable under check-fast 2011-07-28 14:14:29 -07:00
Graydon Hoare
3e63fdc4c9 Thread kinds into the type system. Don't quite activate yet, since it breaks stdlib and snapshot isn't ready to compile modified stdlib. 2011-07-28 13:29:39 -07:00
Brian Anderson
5c0fd045ce Fiddle with the locking around channel disassociation
This still looks a bit sketchy to me (why isn't there locking in
port::destroy?) but this manages to get rid of a problem with channels
accessing their task after it's NULL.
2011-07-28 12:53:44 -07:00
Brian Anderson
b54eb0480d No strnlen on mac 2011-07-28 12:53:14 -07:00
Brian Anderson
0fcd72c932 When using the allow leaks hack don't even print a warning about the leak
This is only used for the test runner and in that case it just makes the test
output confusing
2011-07-28 12:23:01 -07:00
Brian Anderson
4ef1ec580a Do all runtime calls to getenv at initialization
getenv is not threadsafe and (maybe as a result) it's randomly crashing with
CFLAGS=-g and RUST_THREADS=32. Calls from rust code are still on their
own.
2011-07-28 12:23:01 -07:00
Brian Anderson
75985ab75e Remove color-related code from rust_log
This is all dead. If someone decides they want color it will be easy to redo.
2011-07-28 12:23:00 -07:00
Paul Stansifer
86f337484e Change macro syntax to accept a single expr, not a sequence of exprs. 2011-07-28 12:12:08 -07:00
Eric Holk
3d7016ae95 Updating to work on Windows. 2011-07-28 10:47:29 -07:00
Eric Holk
9618ab67ae Re-enabled the rest of the asserts and things in rust_chan.cpp 2011-07-28 10:47:29 -07:00
Eric Holk
b85dee8d5b Resurrecting some of the logging in rust_chan.cpp 2011-07-28 10:47:28 -07:00
Eric Holk
9ea8476faa Removed outdated comment. 2011-07-28 10:47:28 -07:00
Eric Holk
279844ce9f Atomic reference counting for tasks. 2011-07-28 10:47:28 -07:00
Eric Holk
a5fe66e706 Adding upcalls to to ref() and deref() tasks. This is the first step towards atomic reference counting of tasks. 2011-07-28 10:47:28 -07:00
Eric Holk
5302cde188 Made task threads wait instead of sleep, so they can be woken up. This appears to give us much better parallel performance.
Also, commented out one more unsafe log and updated rust_kernel.cpp to compile under g++
2011-07-28 10:47:28 -07:00
Eric Holk
e697a52359 Adding a function to stdlib to set the min stack size, for programs
that absolutely will not succeed with a large default stack. This
should be removed once we have stack grown working.

Also updated word-count to succeed under the new test framework.
2011-07-28 10:47:28 -07:00
Eric Holk
117e251733 Re-removing a test case that was moved during the big test suite overhaul. 2011-07-28 10:47:28 -07:00
Eric Holk
62bc6b5113 Per-thread scheduling. Closes #682.
Tasks are spawned on a random thread. Currently they stay there, but
we should add task migration and load balancing in the future. This
should drammatically improve our task performance benchmarks.
2011-07-28 10:47:28 -07:00
Eric Holk
b51f5c395c Made root_task no longer special. 2011-07-28 10:47:28 -07:00
Lindsey Kuper
c15871ac51 Test case for issue #435. 2011-07-28 10:37:46 -07:00
Jesse Ruderman
0268cb7c96 Get expr-moving fuzzer working again 2011-07-28 10:28:50 -07:00
Graydon Hoare
acac6abc85 Parse, store and print type parameter kind constraints. 2011-07-28 17:22:59 +00:00
Rob Arnold
f45ac8db07 More useful leak debugging output.
When printing out leaked allocations, print the allocation tag and address of
the returned pointer.
2011-07-28 08:28:32 -07:00
Marijn Haverbeke
1836f59d9a Disable expr-scope test, since it break windows 2011-07-28 12:02:08 +02:00
Graydon Hoare
2749ef5ede Fix stale 'copy' occurrences to 'move' in comments. 2011-07-27 23:43:17 -07:00
Josh Matthews
f0e29c92aa :: is allowed to start an expression. Close #762. 2011-07-28 02:33:24 -04:00
Marijn Haverbeke
c141718952 Replace walk with visit in the typechecker 2011-07-28 08:05:04 +02:00
Marijn Haverbeke
757b7ec534 Remove walk instance from kind.rs 2011-07-28 07:42:51 +02:00
Marijn Haverbeke
c78ac29002 Show millisecond precision for time_passes times
Closes #713
2011-07-28 07:22:16 +02:00
Graydon Hoare
a11bb404a5 Further refinement to kind system lattice and type-kind rules; first successful caught kind error (prohibits copying a pinned resource, though trans already caught it later). 2011-07-27 21:23:54 -07:00
Lindsey Kuper
7073ee4e31 Some work on backwarding for issue #702. 2011-07-27 19:43:21 -07:00
Brian Anderson
54c1c07ab1 Add std::io::stderr 2011-07-27 19:04:57 -07:00
Brian Anderson
e81d6d28e7 Don't stop at first test failure
Since compiletest is setting up its own test tasks it needs to configure them
the correct way, which means allowing them to leak.
2011-07-27 19:04:57 -07:00
Brian Anderson
51ef7a3676 Clean up output a bit when running verbose compile tests 2011-07-27 19:04:56 -07:00
Brian Anderson
90a79b9951 Print a newline before displaying test output 2011-07-27 19:04:56 -07:00
Brian Anderson
e9dd971129 Capture stderr when running compile tests. Closes #755 2011-07-27 19:04:56 -07:00
Brian Anderson
278d360525 Refactor compiletest 2011-07-27 19:04:56 -07:00
Michael Sullivan
d1298f768c Have bind support non-alias parametric non-bound arguments.
This was previously disallowed by the typechecker and not properly handled
in trans. I removed the typechecker check (replacing it with a simpler
check that spawned functions don't have type params) and fixed trans.
Closes #756.
2011-07-27 18:46:46 -07:00
Michael Sullivan
4de0b3d947 Allow already bound functions to be bound again.
This commit just disables the check. All of the real work was in previous
commits that moved the target function into the bindings part of the closure
that is tracked by the tydesc.
Closes #754.
2011-07-27 18:46:46 -07:00
Michael Sullivan
63fa765e0e Fix binding a bare fn argument with type parameters.
Closes #642.
2011-07-27 18:46:46 -07:00
Graydon Hoare
63f74f3771 Remove vestiges of "layers", insert skeletal do-nothing "kind" pass plus cached calculation of kind for each type. 2011-07-27 17:49:00 -07:00
Michael Sullivan
04611a3e56 Remove the bind-alias test, since binding to aliases is fine. 2011-07-27 16:14:57 -07:00
Brian Anderson
80d6ee9ae7 Remove task::worker harder 2011-07-27 16:07:31 -07:00
Brian Anderson
92e9382193 Remove task::worker
It was too unsafe to live. It already apeared to be causing problems with
eholk's incoming task changes, so I'm killing it now before it can spread.
2011-07-27 15:53:47 -07:00
Michael Sullivan
55a65a51aa Eliminate "target" field in closures. 2011-07-27 15:22:11 -07:00
Michael Sullivan
b977b5c508 Put the bound function in bind in the bindings, not in a distinguished spot. 2011-07-27 15:22:11 -07:00
Michael Sullivan
db19231596 Mess around with the casting in trans_bind. 2011-07-27 14:43:35 -07:00
Michael Sullivan
e3f9648096 Some cleanup in trans. 2011-07-27 14:41:08 -07:00
Michael Sullivan
1c612ebdcc Associate names with taskptr and tydesc types for better debugging. 2011-07-27 14:30:16 -07:00
Michael Sullivan
ab8d91dcfd Make trand_bind_1 use create_real_fn_pair. 2011-07-27 14:28:07 -07:00
Marijn Haverbeke
73e8e49897 More thorough check for interior-ness in str_from_ivec
Closes #750
2011-07-27 21:46:14 +02:00
Marijn Haverbeke
0186176ae9 Stop outputting spurious spaces in ivec types and empty mutable vecs
(in the pretty-printer)
2011-07-27 21:20:51 +02:00
Marijn Haverbeke
a4cf804671 (belatedly) register a new stable snapshot
This is to make it more likely that our build can be replayed/reconstructed later.
2011-07-27 20:46:08 +02:00
Brian Anderson
0923d67096 Fix comment placement in compiletest 2011-07-27 11:17:03 -07:00
Marijn Haverbeke
7647cf73d1 Another attempt at fixing fast check for the win tinderbox 2011-07-27 19:02:45 +02:00
Marijn Haverbeke
f379c97913 Don't allow globals or immutable locals to be passed by mut alias
Closes #747
2011-07-27 17:19:46 +02:00
Marijn Haverbeke
06e1d8b745 Remove superfluous spaces in pretty-printing of loops
(And extra parens around else-if tests)
2011-07-27 17:18:53 +02:00
Marijn Haverbeke
8365a79c7c Some more obj dtor reformatting 2011-07-27 17:05:34 +02:00
Marijn Haverbeke
edd1a0230e Fix nil pattern case to handle for parser adjustment 2011-07-27 16:55:49 +02:00
Marijn Haverbeke
66b84e3f55 Make the pretty-printer output whitespace before obj drop clause 2011-07-27 16:54:48 +02:00
Marijn Haverbeke
2593c50e75 Re-format some obj dtors that were messed up by the pretty-printer 2011-07-27 16:52:49 +02:00
Marijn Haverbeke
0334faef1f Improve pretty-printing of constraints
(Methods still don't seem to have constraints associated with them.
Method types do, so I guess this is a TODO.)
2011-07-27 16:50:51 +02:00
Marijn Haverbeke
30377a0d05 Fix python script for fast-check to output valid syntax 2011-07-27 16:34:35 +02:00
Marijn Haverbeke
19394a50e7 Make printing of comments inside bindings slightly less broken 2011-07-27 16:24:41 +02:00
Marijn Haverbeke
e3552da0e6 No longer allow 'case' keyword before patterns 2011-07-27 16:01:31 +02:00
Marijn Haverbeke
6e2a7bff7f Fix damage done by the pretty-printer 2011-07-27 15:54:33 +02:00
Marijn Haverbeke
df7f21db09 Reformat for new syntax 2011-07-27 15:54:33 +02:00
Marijn Haverbeke
930e2cfc74 Register transitional snapshot 2011-07-27 15:42:43 +02:00
Marijn Haverbeke
f45524d0d4 This time, I'm almost sure it'll work
(Tinderbox workaround kludge)
2011-07-27 15:19:31 +02:00
Marijn Haverbeke
66c1ca857b Update the parser to accept the new syntax 2011-07-27 15:19:31 +02:00
Marijn Haverbeke
300eb30113 Output native_name field for native mods when needed 2011-07-27 15:19:31 +02:00
Marijn Haverbeke
e9b2487db7 Have the pretty-printer parentesize unary ops when needed 2011-07-27 15:19:31 +02:00
Marijn Haverbeke
a6260ebaa2 Update the pretty-printer to output the new syntax 2011-07-27 15:19:31 +02:00
Marijn Haverbeke
557c2a380a Parenthesize ivec types as needed 2011-07-27 15:19:31 +02:00
Marijn Haverbeke
b0059bd357 Hack to make snap-stage1 actually build incompatible changes
You can't build libstd both with stage0 and stage1 if the two are incompatible

This is probably temporary
2011-07-27 15:19:31 +02:00
Marijn Haverbeke
95b926f675 Add missing case for view_item_use in resolve.rs
Closes #748
2011-07-27 10:01:21 +02:00
Brian Anderson
bcb5c4d54f Run compile tests in a way that's safe in a multithreaded environment
In theory. There's still something leaking but I hope it's no longer due to
the test runner doing unsafe things.

This is a pretty nasty patch, working around limitations in the type and task
systems, and it makes the std::test API a little uglier.
2011-07-26 18:39:55 -07:00
Brian Anderson
1c780b4203 Make the setenv tests threadsafe(ish) 2011-07-26 17:47:36 -07:00
Graydon Hoare
797cd9fd0e Try to keep the local and its type together when wrapping a long decl. 2011-07-26 16:28:16 -07:00
Graydon Hoare
4070b75914 Prohibit breaking between "let" and "=" in local decls. 2011-07-26 15:58:50 -07:00
Lindsey Kuper
e1769ab76f Clean up long strings and indentation. 2011-07-26 15:53:00 -07:00
Graydon Hoare
821c1e7a44 Trailing whitespace. 2011-07-26 15:41:43 -07:00
Graydon Hoare
7a1e656ba6 Tidy up fuzzer logic a bit. 2011-07-26 15:41:43 -07:00
Graydon Hoare
ba626779de Handle printing 'auto' occurring in loop-variable context. 2011-07-26 15:41:42 -07:00
Graydon Hoare
1c97510a16 Improve printing of mod and native mod. 2011-07-26 15:41:42 -07:00
Graydon Hoare
69f8d0e787 Handle hardbreaks at bol slightly better, including break_offset calls (tuck offset into previous hardbreak). 2011-07-26 15:41:42 -07:00
Graydon Hoare
0a69196ef3 Handle column-zero \n explicitly rather than looking for \n\n. 2011-07-26 15:41:42 -07:00
Graydon Hoare
63aa869405 Consume EOL after line comment. 2011-07-26 15:41:42 -07:00
Brian Anderson
d52169686b Dump all subprocess output to stdout when running verbose compiler tests 2011-07-26 15:36:58 -07:00
Michael Sullivan
a17735cfb5 Some simple cleanup of trans_bind. 2011-07-26 14:47:44 -07:00
Michael Sullivan
be0629d880 Convert a bunch of cx.fcx.lcx... paths into bcx_...(cx) 2011-07-26 13:02:26 -07:00
Michael Sullivan
4c17cb73a2 Add a bunch of tests for blocks. 2011-07-26 12:34:38 -07:00
Michael Sullivan
9ca0ce91bf Initial implementation of typestate for closures.
There are still things not handled properly: relying on other preconditions
of upvars is likely to cause bad things to happen. We probably want to
disallow it.
2011-07-26 12:30:14 -07:00
Michael Sullivan
166d4f5fe9 Translate anonymous block closures. 2011-07-26 12:30:14 -07:00
Michael Sullivan
ac948b4ccd Resolve and typecheck alias-environment-capturing blocks. 2011-07-26 12:30:14 -07:00
Michael Sullivan
8c8fa79312 Add block and closure protos and parse/pp block and lambda exprs. 2011-07-26 12:30:14 -07:00
Michael Sullivan
eaab0db4ea Fix the freevars pass to actually work on top of visit. 2011-07-26 12:30:14 -07:00
Brian Anderson
49a98f1508 Base scheduler threads on number of cores. Closes #739 2011-07-26 11:12:20 -07:00
Brian Anderson
e37dd2646a Clone all data before before putting it in a test closure
Putting shared boxes into a closure then running that closure in parallel
tasks seems like a recipe for refcounting disaster.

This doesn't completely fix the problems when running in parallel, but I'm
working on it.
2011-07-26 11:12:20 -07:00
Brian Anderson
f110c20609 Join the process server after running all compile tests 2011-07-26 11:12:20 -07:00
Brian Anderson
067cb6d537 Run test process from a dedicated task
This avoids a race wherein test tasks could run processes that stole the
environment of other tasks's processes.
2011-07-26 11:12:20 -07:00
Paul Stansifer
bca34d11ef Oops, left whitespace. 2011-07-26 11:11:25 -07:00
Paul Stansifer
d11c887382 Add basic support for blocks and types in macros. 2011-07-26 11:09:37 -07:00
Marijn Haverbeke
e133f929b7 Convert all code that uses walk.rs in the straightforward way to simple_visit
Code that needs the keep_going functionality is still using walk. I will
add an equivalent to visit.rs later.
2011-07-26 17:13:48 +02:00
Marijn Haverbeke
473a03a214 Add 'simple' visiting to visit.rs 2011-07-26 16:35:31 +02:00
Marijn Haverbeke
2509a3dcae Resolve loop collection expressions in the right scope
Closes #745
2011-07-26 15:52:59 +02:00
Marijn Haverbeke
41d27ddcc2 Fix win tinderbox breaking typo 2011-07-26 15:39:18 +02:00
Marijn Haverbeke
bfaa85b735 Detect duplicate field names in record literals and types
Closes #746
2011-07-26 15:32:16 +02:00
Marijn Haverbeke
2c1250780d Remove tuple support from the compiler 2011-07-26 15:19:56 +02:00
Marijn Haverbeke
bc9db454a0 Fixup test changes 2011-07-26 14:56:24 +02:00
Marijn Haverbeke
c0976ad70b Properly parse 'auto' for loop variable types 2011-07-26 14:53:01 +02:00
Marijn Haverbeke
f8968d1e71 Remove uses of tuples from the test suite 2011-07-26 14:49:40 +02:00
Marijn Haverbeke
aea537779e Remove all uses of tuples from the compiler and stdlib 2011-07-26 14:06:02 +02:00
Marijn Haverbeke
e123366bff Make the pretty-printer output new-style syntax for records 2011-07-26 10:53:24 +02:00
Marijn Haverbeke
ce808bbc6f Make the pretty-printer output new-style syntax for local decls 2011-07-26 10:40:28 +02:00
Marijn Haverbeke
252b8ffe42 Add support for new-style local decls
let x = 5;
    let y: int = 10;
    // as soon as a typestate bug is fixed:
    let x: str = foo, y <- 20u;

'auto' and 'type-first let' will soon be dropped.
2011-07-26 10:27:26 +02:00
Graydon Hoare
5ab213a464 Correct input coordinate tracking on block-opening brace. 2011-07-25 17:35:40 -07:00
Graydon Hoare
f639085a42 Tidy fuzzer a bit. 2011-07-25 17:10:08 -07:00
Graydon Hoare
1243ce271e Recognize and preserve first blank line if first line of file. 2011-07-25 17:10:08 -07:00
Brian Anderson
ac2424dd22 Run test tasks in parallel according to RUST_THREADS. Issue #734 2011-07-25 16:36:38 -07:00
Brian Anderson
2de43c220c Disable task-comm-15. Fails with multiple threads. 2011-07-25 16:34:49 -07:00
Michael Sullivan
25a89e068d Rename the block type to be blk also. Sorry. 2011-07-25 14:18:07 -07:00
Graydon Hoare
552bff8a21 Adjust pp interface to that printing a crate (an reproducing literals/comments) takes a reader, not just a filename. Fixes first big pp-fuzzer bug. 2011-07-25 14:04:49 -07:00
Graydon Hoare
5749a2deac Fix signature and add string_reader to ioivec. 2011-07-25 14:04:49 -07:00
Michael Sullivan
6bcdb48e35 Disallow block as a variable name in preparation for it becoming a keyword. 2011-07-25 13:42:38 -07:00
Brian Anderson
758c11b22c Ignore various files that are probably not tests when searching for tests
Closes #732
2011-07-25 12:20:23 -07:00
Graydon Hoare
42e57f64b7 remove datalayout from the intrinsics.ll.in file, silence linkage warning. 2011-07-25 11:50:09 -07:00
Marijn Haverbeke
19507787a9 Add support for bracey record types and literals
type foo = {mutable x: int, y: int};
    auto myfoo = {mutable x: 10, y: 20u};

The old syntax is also still supported.
2011-07-25 17:41:00 +02:00
Marijn Haverbeke
cce1b4667b Add look-ahead to parser object 2011-07-25 17:16:41 +02:00
Marijn Haverbeke
dca67f95cb Make the lexer slightly less stateful 2011-07-25 16:46:08 +02:00
Marijn Haverbeke
e949aab10a Remove some rustboot-isms
Closes #464
2011-07-25 15:07:48 +02:00
Marijn Haverbeke
48013db5c5 Tie up the ends needed to get external consts working
Closes #658
2011-07-25 14:58:59 +02:00
Marijn Haverbeke
f0be65cb50 Fix span information returned by parser::parse_seq
Its hi pos used to be the end of the token after the sequence. It now
properly reports the end of the closing token.
2011-07-25 14:04:37 +02:00
Marijn Haverbeke
beab6ba8aa Add a pass that checks for unreachable alt arms 2011-07-25 13:52:59 +02:00
Brian Anderson
bd81adabff Add task::send and task::recv 2011-07-24 16:18:31 -07:00
Brian Anderson
73fed01108 Add task::worker. Spawns a task and returns a channel to it
It takes a lot of boilerplate to create a task and establish a way to talk to
it. This function simplifies that, allowing you to write something like
'worker(f).chan <| start'. Implementation is very unsafe and only works for a
few types of channels, but something like this is very useful.
2011-07-24 16:18:05 -07:00
Brian Anderson
b82bedb28e Reindent lib-task.rs 2011-07-24 16:17:25 -07:00
Brian Anderson
2573fe7026 The Big Test Suite Overhaul
This replaces the make-based test runner with a set of Rust-based test
runners. I believe that all existing functionality has been
preserved. The primary objective is to dogfood the Rust test
framework.

A few main things happen here:

1) The run-pass/lib-* tests are all moved into src/test/stdtest. This
is a standalone test crate intended for all standard library tests. It
compiles to build/test/stdtest.stageN.

2) rustc now compiles into yet another build artifact, this one a test
runner that runs any tests contained directly in the rustc crate. This
allows much more fine-grained unit testing of the compiler. It
compiles to build/test/rustctest.stageN.

3) There is a new custom test runner crate at src/test/compiletest
that reproduces all the functionality for running the compile-fail,
run-fail, run-pass and bench tests while integrating with Rust's test
framework. It compiles to build/test/compiletest.stageN.

4) The build rules have been completely changed to use the new test
runners, while also being less redundant, following the example of the
recent stageN.mk rewrite.

It adds two new features to the cfail/rfail/rpass/bench tests:

1) Tests can specify multiple 'error-pattern' directives which must be
satisfied in order.

2) Tests can specify a 'compile-flags' directive which will make the
test runner provide additional command line arguments to rustc.

There are some downsides, the primary being that Rust has to be
functioning pretty well just to run _any_ tests, which I imagine will
be the source of some frustration when the entire test suite
breaks. Will also cause some headaches during porting.

Not having individual make rules, each rpass, etc test no longer
remembers between runs whether it completed successfully. As a result,
it's not possible to incrementally fix multiple tests by just running
'make check', fixing a test, and repeating without re-running all the
tests contained in the test runner. Instead you can filter just the
tests you want to run by using the TESTNAME environment variable.

This also dispenses with the ability to run stage0 tests, but they
tended to be broken more often than not anyway.
2011-07-24 15:34:34 -07:00
Paul Stansifer
e6e53aff63 Add --expand option to rustc to pretty-print expanded code. 2011-07-23 14:33:12 -07:00
Eric Holk
63e77a3de1 Attempt to put out burning Windows tinderbox. 2011-07-23 13:01:30 -07:00