Commit Graph

4987 Commits

Author SHA1 Message Date
Brian Anderson
1b15c9e155 Remove estr conversion functions. Issue #855 2011-09-01 15:55:39 -07:00
Brian Anderson
f07a328c16 Convert rust_list_files to istrs. Issue #855 2011-09-01 15:51:47 -07:00
Brian Anderson
82634cd530 Convert rust_getcwd to istrs. Issue #855 2011-09-01 15:51:47 -07:00
Brian Anderson
372aa4d210 Factor out make_istr utility function in runtime. Issue #855 2011-09-01 15:51:47 -07:00
Tim Chevalier
3690f38d79 No, not all fn constraints have the same args as the fn does, in the same order...
derp!

Closes #862
2011-09-01 15:41:09 -07:00
Brian Anderson
1262df652f Reduce the amount of locking in the kernel's memory region
The only thing here that really needs locking on malloc and free is
access to the allocation list, which is only used for TRACK_ALLOCATIONS.

Improves bench/task-perf-vector-party by 70%.
2011-09-01 14:20:43 -07:00
Brian Anderson
dabf1be226 Add a benchmark for cross-task kernel memory region synchronization
Vectors are allocated from the kernel's memory region, which has some heinous
synchronization. This is a stress test of vector allocation in many tasks.
2011-09-01 14:20:02 -07:00
Marijn Haverbeke
30447e1091 Remove misleading outdated comment in alias.rs 2011-09-01 22:37:52 +02:00
Marijn Haverbeke
458ac89894 Back out copy-glue
This wasn't a good idea after all.
2011-09-01 22:37:23 +02:00
Brian Anderson
ad3dcc0689 Remove the last use of istr::to_estr from rustc. Issue #855 2011-09-01 13:21:29 -07:00
Brian Anderson
8f531e769a Convert rust_file_is_dir from estrs to cstrs. Issue #855 2011-09-01 13:16:44 -07:00
Brian Anderson
baa1e8790d Check error code in rust_file_is_dir. Prevent comparison of uninitialized mem 2011-09-01 13:16:44 -07:00
Tim Chevalier
4951bb8bfc Test for #876
This is the test case for #876. Xfailed for now.
2011-09-01 13:12:59 -07:00
Brian Anderson
387903e702 Register new snapshots 2011-09-01 13:01:40 -07:00
Brian Anderson
91ea2577cd Remove a few more istr conversions. Issue #855 2011-09-01 12:14:36 -07:00
Brian Anderson
7924368268 Allow istrs as patterns. Issue #855 2011-09-01 12:14:36 -07:00
Brian Anderson
4c25d81041 Remove some uses of str_buf builtin. Issue #855 2011-09-01 12:14:35 -07:00
Brian Anderson
bb56a75343 Convert main functions to istrs. Issue #855 2011-09-01 12:14:35 -07:00
Brian Anderson
3fe743bc9c Remove various istr conversions. Issue #855 2011-09-01 12:14:34 -07:00
Brian Anderson
5ebe61cdda Consolidate std::str tests into stdtest::str 2011-09-01 12:14:34 -07:00
Brian Anderson
d0c509ad1b Remove a bunch of string builtins. Issue #855 2011-09-01 12:14:33 -07:00
Brian Anderson
a7bc386c53 Delete parts of std::str that are no longer exported. Issue #855 2011-09-01 12:14:33 -07:00
Brian Anderson
34d197de97 Remove last users of str::sbuf. Issue #855 2011-09-01 12:14:32 -07:00
Brian Anderson
b714150487 Remove more functions from std::str. Issue #855 2011-09-01 12:14:32 -07:00
Brian Anderson
6b22640a1f Convert std::test to istrs. Issue #855 2011-09-01 12:14:31 -07:00
Brian Anderson
775b64c955 Remove the estr #fmt. Issue #855 2011-09-01 12:14:31 -07:00
Brian Anderson
a45068cf27 Convert fs::path_is_absolute internals to istrs. Issue #855 2011-09-01 12:14:30 -07:00
Patrick Walton
cc08fd1ef9 rt: Allow iteration over the dynastack 2011-09-01 11:47:59 -07:00
Patrick Walton
9d00ef9a46 rt: Make logging more resilient to null vector pointers (useful when debugging GC) 2011-09-01 11:47:58 -07:00
Patrick Walton
bbac2dd768 rt: Make debug string in rust_obstack slightly prettier 2011-09-01 11:47:58 -07:00
Patrick Walton
83ac32e8aa rt: Zero out dynamic allocas for now 2011-09-01 11:47:58 -07:00
Patrick Walton
a6c14964c8 rt: Include rust_shape.h in rust_obstack.cpp and remove the duplicate DPRINT() macro 2011-09-01 11:47:58 -07:00
Patrick Walton
156bc7f012 rt: Add a missing FIXME to rust_obstack.cpp for segmented stacks 2011-09-01 11:47:58 -07:00
Patrick Walton
876142f051 rt: Remove duplicate DPRINT() macro from rust_gc.cpp 2011-09-01 11:47:58 -07:00
Patrick Walton
60137273d2 rt: Disable debug spew in rust_shape 2011-09-01 11:47:58 -07:00
Marijn Haverbeke
fb196e6ef1 Make alias analysis properly recognize closures in call position
I figured this'd break a few things, but in fact it causes no problems
whatsoever.
2011-09-01 16:38:30 +02:00
Marijn Haverbeke
6ba4eacddf Make resolve recognize upvars
Upvars are now marked with def_upvar throughout, not just when going
through freevars::lookup_def. This makes things less error-prone. One
thing to watch out for is that def_upvar is used in `for each` bodies
too, when they refer to a local outside the body.
2011-09-01 16:32:44 +02:00
Marijn Haverbeke
2d1dec78e7 Move mutability checking into its own pass.
Having it in the alias pass was slightly more efficient (finding
expression roots has to be done in both passes), but further muddled
up the already complex alias checker.

Also factors out some duplication in the mutability-checking code.
2011-09-01 16:32:38 +02:00
Marijn Haverbeke
34ae491ca9 Store arg mode and objfield mutability in their def 2011-09-01 16:32:38 +02:00
Marijn Haverbeke
9ba3fe5e40 Clean up handling of restriction contexts in alias analysis 2011-09-01 09:45:55 +02:00
Brian Anderson
91f05fba11 Reexport std::str::alloc. Windows still needs this. Issue #855 2011-08-31 21:15:08 -07:00
Erick Tryzelaar
b199e9da92 Expose STDERR to rust. 2011-08-31 20:40:00 -07:00
Patrick Walton
614a930c51 rt: Make the dynamic stack self-describing 2011-08-31 19:19:05 -07:00
Patrick Walton
729437d2c0 rt: Set n_params appropriately in upcall_get_type_desc 2011-08-31 18:03:12 -07:00
Brian Anderson
53a9d5a1d2 Start paring down std::str. Issue #855 2011-08-31 16:24:09 -07:00
Brian Anderson
cb55ef6e12 Convert benchmarks to istrs. Issue #855 2011-08-31 16:24:08 -07:00
Brian Anderson
04700066f3 Convert fuzzer to istrs. Issue #855 2011-08-31 16:24:08 -07:00
Brian Anderson
81b31429e4 Remove more uses of str from std::run. Issue #855 2011-08-31 16:24:08 -07:00
Brian Anderson
1772ee3c43 Remove a few more usages of std::str from rustc. Issue #855 2011-08-31 16:24:08 -07:00
Patrick Walton
dc6f78561c rt: Prevent trailing commas from showing up when logging oddly aligned arrays 2011-08-31 16:22:19 -07:00
Patrick Walton
dfcbfa61f3 rt: Introduce "end_dp" bailouts in order to avoid marching past the end of oddly aligned vectors 2011-08-31 16:02:17 -07:00
Patrick Walton
143569fce4 rt: Make |align| a member of the shape glue class instead of threading it through every function 2011-08-31 15:25:32 -07:00
Michael Sullivan
03ddc8fdd3 Don't check arguments types if there are an incorrect number of args. Closes #871. 2011-08-31 16:46:46 -04:00
Michael Sullivan
7c02517f75 Check all paths return properly in blocks. Closes #874. 2011-08-31 16:15:02 -04:00
Michael Sullivan
722fa00681 Get rid of the hack that ignores () typed things in fn tail position.
Closes #868. Unfortunately, this causes certain invalid programs to
fail type-checking instead of failing type-state when a type-state
error message would probably be more intuitive. (Although, by any
reasonable interpretation of the static semantics, it technically
ought to be a type error.)
2011-08-31 16:01:25 -04:00
Brian Anderson
498e38b705 Convert uses of #fmt to #ifmt. Issue #855 2011-08-31 11:44:06 -07:00
Michael Sullivan
959938e891 Produce the start of an immutable treemap. 2011-08-31 14:10:15 -04:00
Marijn Haverbeke
6209e844ee Replace xfail-stageN with simply xfail-test
Closes #799
2011-08-31 16:32:16 +02:00
Marijn Haverbeke
66bc014720 Revert "Replace xfail-stageN with simply xfail-test"
This reverts commit 574194f6bc.
2011-08-31 14:24:08 +02:00
Marijn Haverbeke
574194f6bc Replace xfail-stageN with simply xfail-test
Closes #799
2011-08-31 13:43:09 +02:00
Brian Anderson
c36d29c1dc Register new snapshots 2011-08-31 00:44:40 -07:00
Brian Anderson
be2ad97a61 Allow main to take istrs. Issue #855 2011-08-30 23:57:09 -07:00
Brian Anderson
4007006574 Convert compiletest to istrs. Issue #855 2011-08-30 21:08:07 -07:00
Brian Anderson
eb70267e5e Convert #env to istrs. Temporarily disable usage in rustc. Issue #855 2011-08-30 21:08:07 -07:00
Brian Anderson
04928ed3f0 Add a FIXME about the bogosity of aio::ip_to_sbuf 2011-08-30 21:08:07 -07:00
Brian Anderson
c94d4cff03 Convert std::net to istrs. Issue #855 2011-08-30 21:08:07 -07:00
Brian Anderson
0abec867c3 Support istrs as fail argument. Issue #855 2011-08-30 21:08:07 -07:00
Brian Anderson
4c936d7992 Add #ifmt extension, like #fmt but for istrs. Issue #855 2011-08-30 21:08:07 -07:00
Brian Anderson
9e2c5f77a4 Remove the %S istr conversion from #fmt
I want to do the #fmt transition a different way. Issue #855
2011-08-30 21:08:07 -07:00
Patrick Walton
fc0212a63b rt: Override the character interpretation of u8/i8 values when logging 2011-08-30 19:34:27 -07:00
Patrick Walton
c6a47e4087 rustc: Hoist derived tydesc GC roots up to the top of the function so the GC doesn't try to access uninitialized tydescs 2011-08-30 17:46:56 -07:00
Tim Chevalier
6d8bb3ce29 Un-xfail zip-same-length
There was a type error that was getting reported poorly. Fixed it.
(Now to figure out why the error was reported so poorly...)
2011-08-30 17:19:13 -07:00
Tim Chevalier
9f7ed2f054 Add a total version of vec::last that has a precondition 2011-08-30 17:17:42 -07:00
Tim Chevalier
4fc72c2130 XFAIL zip-same-length -- that's ok, since it's a new test 2011-08-30 16:43:12 -07:00
Tim Chevalier
819b00079c Library test cases for vec::zip 2011-08-30 16:42:32 -07:00
Tim Chevalier
268533a920 Add a precondition on vec::zip
vec::zip now has the precondition that the two argument vectors
are the same length. Changed uses of it to reflect that.

Also added a few vector-enumerating utilities to vec.rs, which
necessitated in making some functions in u8 declared-pure.
2011-08-30 16:39:22 -07:00
Tim Chevalier
d37e8cfc67 Test that fn preconditions get typechecked 2011-08-30 16:39:17 -07:00
Tim Chevalier
2e53da5126 Typecheck function preconditions
It turned out that function preconditions weren't getting checked
at all, so you could write a constraint on a fn decl that was total
nonsense. Fixed now.
2011-08-30 16:20:16 -07:00
Tim Chevalier
f62add95da Eliminate an unchecked use of map::get in ppaux 2011-08-30 16:19:52 -07:00
Patrick Walton
b722dc36a5 rt: Fix logging of type-parametric resources 2011-08-30 15:56:42 -07:00
Patrick Walton
05d96f155f rustc: Allow non-type-parametric resources to be logged 2011-08-30 13:50:48 -07:00
Marijn Haverbeke
7bbe8d2e8c Stop relying on klunky hack in alias.rs
It assumed node_ids increased monotonically for locals, but macros
make this no longer the case, and it was a dubious assumption anyway.
It now numbers locals itself and uses that to determine which precede
which.
2011-08-30 17:03:00 +02:00
Marijn Haverbeke
61392f9f82 Clean up trans_build, factor repeated code into function 2011-08-30 14:02:20 +02:00
Marijn Haverbeke
e17e6af4f0 Change a number of result-returning functions to return @block_ctxt
The uniformity doesn't seem to be worth the extra noise and pointless
code being generated. If something doesn't produce a value, don't make
it return one. (For now, trans_[exprtype] things are left in the result-
returning form, even when they never return anything useful, since in
that case uniformity is arguably helpful.)
2011-08-30 13:50:58 +02:00
Marijn Haverbeke
adec3ecfe0 Remove compiler-bug-workaround that's no longer needed 2011-08-30 13:10:10 +02:00
Marijn Haverbeke
c1ba28c777 Glob-import trans_build in other trans files
The capitalization already prevents name clashes. Being able to refer to the
bitcode-construction primitives directly makes the code cleaner.
2011-08-30 13:04:57 +02:00
Graydon Hoare
41fb042def Stab-in-the-dark error fix for the crashing windows tinderboxes. Helps win2 anyways. 2011-08-29 17:35:24 -07:00
Patrick Walton
f1ed03dfa5 rt: Have data::walk_fn be defensive regarding whether the derived implementation of walk_fn moves the data pointer 2011-08-29 16:50:06 -07:00
Patrick Walton
0a4d43379e rt: Move to a custom alignof since __alignof__ returns the "preferred" alignment rather than the one that gets used in structs 2011-08-29 16:24:03 -07:00
Patrick Walton
b16a9a984a rt: Don't dereference a null pointer when traversing a function with no environment 2011-08-29 15:27:55 -07:00
Marijn Haverbeke
b623ddfb7e Warn for exports that refer to non-existent items
Closes #865
2011-08-29 23:46:58 +02:00
Marijn Haverbeke
4db388ea6c Remove obsolete exports 2011-08-29 23:46:38 +02:00
Brian Anderson
3d26665e60 Rename upcall_istr_push to rust_istr_push in rustrt.def.in 2011-08-29 14:18:46 -07:00
Marijn Haverbeke
b099b1e3f7 Make std::istr::push_byte efficient
It used to allocate two (!) heap values per pushed byte. It now goes through
a runtime function that simply grows the istr and writes the byte.
2011-08-29 22:46:49 +02:00
Marijn Haverbeke
14567c5eb0 Factor vector reserve code in runtime into its own function 2011-08-29 22:35:29 +02:00
Marijn Haverbeke
eb4661fc52 Factor vector-allocation code, always allocate space for at least 4 elts
(This prevents the first few reallocs when growing a vector.)
2011-08-29 22:30:18 +02:00
Brian Anderson
5483b910d6 Convert a block to a fn in trans_ivec::trans_add
The block was not valgrind-clean
2011-08-29 11:07:42 -07:00
Marijn Haverbeke
9f41bc854d Don't duplicate ivec-iterating loop code
trans_ivec is starting to look almost pleasant
2011-08-29 16:14:24 +02:00
Marijn Haverbeke
9084a3ca1b Register snapshot
The win snapshot is not on s3 yet, because of tinderbox breakage. The file
can be gotten at [1] in the meantime.

[1] marijnhaverbeke.nl/upload/rust-stage0-2011-08-29-c9c5ee2-winnt-i386-bed0aeb9cdf7831a7c1d9337a2b351699f0d25cd.tar.bz2
2011-08-29 14:45:09 +02:00
Marijn Haverbeke
c9c5ee252a Implement non-internal ivecs
Vectors are now similar to our old, pre-internal vectors, except that
they are uniquely owned, not refcounted.

Their name should probably change too, then. I've renamed them to vec
in the runtime, will do so throughout the compiler later.
2011-08-29 09:07:53 +02:00
Marijn Haverbeke
855e0a4713 Fix bug in mutable-local-marking
Locals passed by mutable alias weren't being marked as mutated
2011-08-29 09:01:27 +02:00
Graydon Hoare
4eb86d4978 Merge pull request #870 from marijnh/llvm-update
Follow LLVM header file shuffling
2011-08-28 17:14:46 -07:00
Marijn Haverbeke
5751acee92 Register new snapshot
I'll need to do a snapshot that builds stage1 with the stage0 libs,
so this one is to sync the stage0 libs with the current codebase.
2011-08-28 21:40:34 +02:00
Marijn Haverbeke
58110b1b13 Follow LLVM header file shuffling
This allows us to compile against revision 138708. I need this, because
the version we currently use is causing mysterious corruption of object
files during linking on win, apparently triggered by my vec-representation
patch.
2011-08-28 20:59:05 +02:00
Brian Anderson
5f57a508af Convert misc compiler bits to istrs. Issue #855 2011-08-27 18:05:59 -07:00
Brian Anderson
cffd9b8044 Convert rustc driver to istrs. Issue #855 2011-08-27 17:47:06 -07:00
Brian Anderson
7efbfea8d0 Convert rustc::syntax::ext::base to istrs. Issue #855 2011-08-27 16:55:48 -07:00
Brian Anderson
9857048929 Convert rustc::driver::session to istrs. Issue #855 2011-08-27 16:47:50 -07:00
Brian Anderson
3dc2419443 Convert rustc::syntax::codemap to istrs. Issue #855 2011-08-27 15:58:17 -07:00
Brian Anderson
9fb085560d Convert rustc::syntax::ast_util to istrs. Issue #855 2011-08-27 15:54:46 -07:00
Brian Anderson
cbad23a747 Convert pretty-printer to istrs. Issue #855 2011-08-27 15:54:46 -07:00
Brian Anderson
675073c266 Convert parser to istrs. Issue #855 2011-08-27 15:54:46 -07:00
Brian Anderson
427d42228f Convert rustc::syntax::eval to istrs. Issue #855 2011-08-27 15:54:45 -07:00
Brian Anderson
26516dc8d2 Convert rustc::syntax::token to istrs. Issue #855 2011-08-27 15:54:45 -07:00
Brian Anderson
58dedcd090 Convert lexer to istrs. Issue #855 2011-08-27 15:54:45 -07:00
Brian Anderson
d2ae28fc99 Convert rustc::util to istrs. Issue #855 2011-08-27 15:54:45 -07:00
Brian Anderson
54691f9a6c Convert rustc::metadata to istrs. Issue #855 2011-08-27 15:54:45 -07:00
Brian Anderson
7d70685eef Convert the rest of rustc::middle to istrs. Issue #855 2011-08-27 15:54:45 -07:00
Brian Anderson
9e01e05f3b Convert rustc::middle::trans to istrs. Issue #855 2011-08-27 15:54:45 -07:00
Brian Anderson
f09ef6ec66 Convert rest of the AST to istrs. Issue #855 2011-08-27 15:54:45 -07:00
Brian Anderson
f603e912ee Convert local_ctxt to istrs. Issue #855 2011-08-27 15:54:45 -07:00
Brian Anderson
afe27d461c Convert crate_ctxt to istrs. Issue #855 2011-08-27 15:54:45 -07:00
Brian Anderson
32b4524806 Convert middle::trans_common to istrs. Issue #855 2011-08-27 15:54:44 -07:00
Brian Anderson
fcdbdaf2ab Convert the rest of rustc::lib::llvm to istrs. Issue #855 2011-08-27 15:54:44 -07:00
Brian Anderson
d7fa75413f Convert rustc::lib::llvm to istr::sbufs. Issue #855 2011-08-27 15:54:44 -07:00
Brian Anderson
138973335a Add std::istr::as_buf for converting to cstrs. Issue #855 2011-08-27 15:54:44 -07:00
Brian Anderson
7284f820d5 Support istrs in #fmt. Issue #855
The format string may be an istr and istr args may be used with %S
2011-08-27 15:54:44 -07:00
Brian Anderson
6b3f0b21be Convert the rest of rustc::back to istrs. Issue #855 2011-08-27 15:54:44 -07:00
Brian Anderson
a58bfced3c Convert back::link to istrs. Issue #855 2011-08-27 15:54:44 -07:00
Brian Anderson
9c9c5c9054 Remove ast::identistr. Issue #855 2011-08-27 15:54:44 -07:00
Brian Anderson
03119fe269 Convert ast::ident to istr. Issue #855 2011-08-27 15:54:44 -07:00
Brian Anderson
652332f9d4 Convert std::map::new_str_hash to istrs. Issue #855 2011-08-27 15:54:44 -07:00
Brian Anderson
faef9490ae Optimize std::istr::to_estr. Issue #855 2011-08-27 15:54:44 -07:00
Brian Anderson
15e3ae7936 Convert std::os to istrs. Issue #855 2011-08-27 15:54:44 -07:00
Brian Anderson
85b4253bc1 Convert std::generic_os to istrs. Issue #855 2011-08-27 15:54:43 -07:00
Brian Anderson
ccc68fc18b Add std::istr::str_from_cstr. Issue #855 2011-08-27 15:54:43 -07:00
Brian Anderson
b2408d57f0 Convert portions of rustc to istrs. Recover a lot of performance.
Issue #855
2011-08-27 15:54:43 -07:00
Brian Anderson
fcc031c5b4 Convert std::io to istrs. Issue #855 2011-08-27 15:54:43 -07:00
Brian Anderson
20178b9312 Convert std::run to istrs. Issue #855 2011-08-27 15:53:09 -07:00
Brian Anderson
4cf2e510e0 Convert std::getopts to istrs. Issue #855 2011-08-27 15:53:09 -07:00
Brian Anderson
3a5f4e7a74 Convert the task-comm parts of compiletest to istrs. Issue #855
This reduces the amount of voodoo in compiletest considerably.
2011-08-27 15:53:09 -07:00
Brian Anderson
c2eafd268b Convert std::fs to istrs. Issue #855 2011-08-27 15:53:09 -07:00
Brian Anderson
051f1ff562 Convert std::sha1 to istrs. Issue #855 2011-08-27 15:53:09 -07:00
Brian Anderson
bd84fbe9f3 Convert std::term to istrs. Issue #855 2011-08-27 15:53:08 -07:00
Brian Anderson
8146ca982e Convert std::u64 to istrs. Issue #855 2011-08-27 15:53:08 -07:00
Brian Anderson
53be480d20 Convert std::int to istrs. Issue #855 2011-08-27 15:53:08 -07:00
Brian Anderson
ee2a11eb4f Convert std::uint to istrs. Issue #855 2011-08-27 15:53:08 -07:00
Brian Anderson
69e6abf9ce Rename std::istr::from_str/to_str to from_estr/to_estr. Issue #855
This will make it a bit clearer what's going on
2011-08-27 15:53:08 -07:00
Brian Anderson
2c8a93aa3b Convert std::bitv to istrs. Issue #855 2011-08-27 15:53:08 -07:00
Brian Anderson
805e3098c5 Don't output bogus spans when reporting a message without one.
Emacs gets confused by <input>:0:0:0:0:
2011-08-27 15:45:11 -07:00
Brian Anderson
609e38d8e7 Output error spans that don't confuse emacs compilation mode. Closes #845 2011-08-27 15:39:53 -07:00
Eric Holk
640886ceb6 Polymorphic MapReduce! 2011-08-26 18:03:33 -07:00
Eric Holk
5c0cc474be stdlib: more test cases for treemap. 2011-08-26 18:03:32 -07:00
Eric Holk
2fab948e01 stdlib: Added a treemap traversal function. 2011-08-26 18:03:32 -07:00
Eric Holk
cd913b454d stdlib: Added an incredibly simple treemap. 2011-08-26 18:03:32 -07:00
Eric Holk
78f07a1453 Deleting trailing whitespace 2011-08-26 18:03:32 -07:00
Patrick Walton
5fe80a0d48 rt: Allow closures to be logged 2011-08-26 17:05:59 -07:00
Eric Holk
45cac8a95f Adding a test case to make sure spawning polymorphic functions works. 2011-08-26 16:31:14 -07:00
Paul Stansifer
230a5869b4 Bugfix. --pretty typed requires expansion. Closes #691. 2011-08-26 15:13:57 -07:00
Brian Anderson
22d4641a30 Fix invalid reads of cstrs in trans 2011-08-26 14:03:22 -07:00
Brian Anderson
2744bcd693 Revert "Use cstrcache in C_str, C_cstr, C_shape."
This reverts commit d5173b1f2c.
2011-08-26 13:58:26 -07:00
Brian Anderson
f0820662c9 Revert "Add rustc::middle::cstrcache for getting c string bufs safely"
This reverts commit 4e136d1fd9.
2011-08-26 13:58:19 -07:00
Brian Anderson
d5173b1f2c Use cstrcache in C_str, C_cstr, C_shape.
This fixes up the current leaks.
2011-08-26 13:20:23 -07:00
Brian Anderson
4e136d1fd9 Add rustc::middle::cstrcache for getting c string bufs safely
We continue to leak string buffers in trans so this creates a way to get c
string buffers from strings while guaranteeing that they are not freed before
use.

Hopefully this can be made efficient in the istr regime.
2011-08-26 13:20:23 -07:00
Brian Anderson
3aef2c1d7d Add a valgrind suppression for the llvm::User leak
It's been around forever. I don't know what it is, but I need the compiler to
be valgrind clean for the istr transition so I'm suppressing it.
2011-08-26 13:20:22 -07:00
Graydon Hoare
4133e3ec82 Mostly-trivial commit to test build cycle on windows service. 2011-08-26 13:14:02 -07:00
Tim Chevalier
c02f346e2c Revert "Revert "Use typestate constraints for trans_be""
This reverts commit b0db13956f.

(Should work now that we have a new snapshot)
2011-08-26 10:14:58 -07:00
Tim Chevalier
5472d2238a Merge remote-tracking branch 'graydon/master' into snap 2011-08-26 10:11:04 -07:00
Tim Chevalier
8b9a78e8c4 Register snapshot 2011-08-26 09:55:26 -07:00
Marijn Haverbeke
5917d80cd7 Pass stuff to take_ty, free_ty, and drop_ty by address, even when immediate
The glue-calling will spill the values again anyway. This should
prevent a lot of load/spill junk in the output. It is also necessary
to be able to have unique vecs be immediate values (take must know the
actual address to be able to duplicate).
2011-08-26 11:20:10 +02:00
Tim Chevalier
b0db13956f Revert "Use typestate constraints for trans_be"
This reverts commit 1b60bba141.
(Need a snapshot first)
2011-08-26 00:59:41 -07:00
Tim Chevalier
1b60bba141 Use typestate constraints for trans_be
trans_be now has a precondition that its expression argument
is a call expr. Obviously this code may be going away soon, but
I wanted to exercise typestate somehow and this was an easy one :-)
2011-08-26 00:47:21 -07:00
Tim Chevalier
844e2d7d1c Test case for checks on pattern-bound vars 2011-08-26 00:46:53 -07:00
Tim Chevalier
26e1cacb21 Let typestate constraints mention pattern-bound vars 2011-08-26 00:39:50 -07:00
Tim Chevalier
b099760269 Remove remaining use of 'pred' and make 'pred' a non-reserved word. Huzzah\! 2011-08-25 22:26:45 -07:00
Tim Chevalier
48c6953001 Remove typestate workaround that's no longer necessary 2011-08-25 18:48:34 -07:00
Tim Chevalier
809a833e34 Test case for unchecked blocks 2011-08-25 18:33:57 -07:00
Tim Chevalier
f841e89443 Support unchecked blocks
This patch supports the syntax

    unchecked {
      ...
    }

    to disable purity checking within a block. Presumably it will only be
    used within a declared "pure fn". However, there is no checking that it
    doesn't occur elsewhere, and it would be harmless for it to do so.

    I went with Lindsey's suggestion for the syntax, but it's subject to
    change.

    This allows you to write code that uses predicates that call arbitrary
    Rust functions, but you must declare your intentions by wrapping it in
    an unchecked { ... } block. The test case run-pass/unchecked-predicates.rs
    demonstrates how to do that.
2011-08-25 18:28:23 -07:00
Tim Chevalier
d9bc3cb10c Change "pred" to "pure fn" in all libraries and test cases 2011-08-25 18:24:45 -07:00
Tim Chevalier
1cb85015c3 Change "pred" to "pure fn" within the compiler. 2011-08-25 18:24:40 -07:00
Tim Chevalier
2e89edab1d Register snapshot 2011-08-25 18:01:40 -07:00
Tim Chevalier
e241f2996d Allow pure fns to have any return type 2011-08-25 17:23:35 -07:00
Patrick Walton
4dd23f24d6 rt: Null check in walk_obj_contents. Prevents marking from crashing when calling object constructors. 2011-08-25 17:14:54 -07:00
Patrick Walton
8bd019bdc8 rt: Remember the number of captured type descriptors for objects in the type descriptor crate cache 2011-08-25 14:21:05 -07:00
Brian Anderson
608f7ccded Move ast::pat_id_map to ast::util 2011-08-25 14:15:54 -07:00
Patrick Walton
880fd788eb rustc: Add an extra flag to object tydescs so that shapes know how to find the captured subtydescs 2011-08-25 12:01:10 -07:00
Eric Holk
2f7c583bc1 Cleaning up task and comm exports, updating all the test cases. 2011-08-25 11:21:25 -07:00
Brian Anderson
b31815f8a0 Fix istr::unsafe_from_bytes. Issue #855 2011-08-25 10:33:28 -07:00
Patrick Walton
b371891c7c rt: Fix walk_obj_contents for type-parameteric objects. Hash tables can be logged now. 2011-08-24 16:54:10 -07:00
Patrick Walton
72d78e6a93 rt: Factor out type param construction into from_tydesc and from_obj_shape. (The latter is unimplemented at the moment.) 2011-08-24 15:19:59 -07:00
Brian Anderson
0dc1d7ee57 Register new snapshots 2011-08-24 15:00:26 -07:00
Tim Chevalier
da766791d3 hmm, this should have been in the last commit. Oops. 2011-08-24 14:29:08 -07:00
Tim Chevalier
c6155d1fd1 Change "pred" to "pure fn" (but still accept "pred")
This is part 1 of changing the "pred" keyword to "pure fn".
Right now, the compiler accepts both "pred" and "pure fn".
2011-08-24 14:21:37 -07:00
Brian Anderson
5b5689d4dd Test that processes that are supposed to fail return a non-zero status 2011-08-24 13:24:03 -07:00
Patrick Walton
b07968dda4 rt: Print out fields of objects when logging them 2011-08-24 12:09:06 -07:00
Brian Anderson
65357eeecc XFAIL task-comm-2. Doesn't work under windows 2011-08-24 12:03:08 -07:00
Brian Anderson
b7d74c32b6 Fix combine-tests.py for new ivec regime 2011-08-24 12:03:08 -07:00
Brian Anderson
a0208e3899 Return an error code after fail under win32 2011-08-24 12:03:07 -07:00
Marijn Haverbeke
fa97793139 Revert "Back out copy-glue"
This reverts commit 629ee94a0b.
2011-08-24 20:30:20 +02:00
Brian Anderson
60547f6500 Use memmove to load istr literals. Issue #855 2011-08-24 10:24:59 -07:00
Marijn Haverbeke
629ee94a0b Back out copy-glue
This wasn't a good idea after all.
2011-08-24 17:05:53 +02:00
Marijn Haverbeke
15b540ded4 Use a single builder object throughout
This seems to be faster than creating separate ones for each block
context.
2011-08-24 16:57:33 +02:00
Marijn Haverbeke
b9112525ba Move to a more lightweight builder system
You now do

    bld::Ret(bcx, someval)

where you used to say

    bcx.build.Ret(someval)

Two fewer boxes are allocated for each block context, and build calls
no longer go through a vtable.
2011-08-24 16:48:10 +02:00
Marijn Haverbeke
9f44df65ef Ensure values created in an alt guard are cleaned up properly 2011-08-24 14:01:56 +02:00
Marijn Haverbeke
054914712e Remove rust_start_ivec 2011-08-24 13:59:22 +02:00
Marijn Haverbeke
e58c48bdda Optimize += [x] into a simple push operation
This is a preparation for making vectors always-on-the-heap again,
which would cause way too much malloc traffic for this idiom. I will
add an efficient std::vec::push in the future, and migrate += [x] to
that instead.

Reduces compiler code size by 3%
2011-08-24 13:57:27 +02:00
Marijn Haverbeke
bead045f27 Check for is_terminated after translating a block
Closes #861
2011-08-24 10:55:34 +02:00
Brian Anderson
18576e55f7 Resolve a number of FIXMEs 2011-08-23 18:55:37 -07:00
Brian Anderson
c1f2394245 Zero locals with initializers that may break or terminate. Closes #787 2011-08-23 16:29:21 -07:00
Graydon Hoare
c011f13144 Add kind-checking for assign-op, copy, ret, be, fail exprs. Fix caught kinding-violations in rustc and libstd. 2011-08-23 15:58:53 -07:00
Brian Anderson
a3c8d4a5a5 Recheck the while loop contition after continuing. Closes #825 2011-08-23 14:51:22 -07:00
Brian Anderson
68fd28c2c1 Cleanup formatting in std::sha1
This file has suffered a lot of reformats and was looking pretty ragged
2011-08-23 13:22:44 -07:00
Brian Anderson
7b12924813 Fix pretty-printing of istr literals. Issue #855 2011-08-23 11:09:38 -07:00
Brian Anderson
c274d16b7f Eliminate unused variable warnings in stdtest 2011-08-22 21:33:52 -07:00
Brian Anderson
45b614f54a Add ivec::from_str and to_str methods. Issue #855 2011-08-22 21:33:52 -07:00
Brian Anderson
663d07d319 Add std::istr. Issue #855 2011-08-22 21:33:49 -07:00
Brian Anderson
55c54f0db5 Promote std::task::rustrt::leak to std::unsafe::leak
I want to use this for std::istr
2011-08-22 18:05:34 -07:00
Brian Anderson
d6e4fa6b44 Teach rustc to append istrs. Issue #855 2011-08-22 17:40:06 -07:00
Brian Anderson
3ab86fb79e Teach rustc to add istrs. Issue #855 2011-08-22 16:39:18 -07:00
Brian Anderson
aae212727d Encode the istr shape correctly. Issue #855 2011-08-22 16:12:42 -07:00
Brian Anderson
6841f3827a Fix ivec self-append. Closes #816 2011-08-22 15:04:28 -07:00
Brian Anderson
0f1f5e67ea Create correct drop glue for istrs. Issue #855 2011-08-22 14:34:55 -07:00
Brian Anderson
fd8ca2cf5d Translate istr literals. Issue #855 2011-08-22 14:34:36 -07:00
Brian Anderson
0a93a48ff5 Extract trans_ivec::alloc_with_heap from trans_ivec::trans_ivec
Need this for building istrs
2011-08-22 13:30:53 -07:00
Brian Anderson
309a7534d7 Move trans::ivec to middle::trans_ivec 2011-08-22 12:04:05 -07:00
Brian Anderson
179658e20f Move trans_ivec into the ivec module 2011-08-22 11:23:46 -07:00
Brian Anderson
3a5bfae9d9 Silence unused variable warnings in compiletest 2011-08-22 11:00:43 -07:00
Brian Anderson
152cbaade7 Move functions from syntax::ast to syntax::ast_util
This leaves syntax::ast just defining the AST, which strikes me as somewhat
nicer
2011-08-22 10:44:04 -07:00
Brian Anderson
a3affaa20f Remove ast::spawn_dom 2011-08-22 10:42:29 -07:00
Marijn Haverbeke
7d08678b74 Implement pattern guards
The syntax is

    alt x {
        mypat where mycond { ... }
    }

The condition may refer to any of the variables bound by the pattern.
When a guard fails, pattern-matching continues with the next pattern.

Closes #857
2011-08-22 17:49:31 +02:00
Marijn Haverbeke
a2466233b4 Fix bug introduced by 1a45a84e73 2011-08-22 17:49:31 +02:00
Marijn Haverbeke
1a45a84e73 Start using copy glue to copy bits that may contain ivecs
This is not currently necessary, but will be, when I land the new ivec
representation.
2011-08-22 14:17:27 +02:00
Marijn Haverbeke
3948f132d9 Write a type_structurally_contains, use it to rewrite has_dynamic_size
(I'll be using this for type-needs-copy-glue in the near future.)
2011-08-22 14:06:20 +02:00
Marijn Haverbeke
42864377a4 Remove silly restriction on passing type params by alias
Since they are now passed by pointer, this is no longer a problem
2011-08-22 14:06:20 +02:00
Marijn Haverbeke
10269dfaeb Replace &ty::t with ty::t throughout the compiler
Type handles are uints, passing them by reference only causes
unnecessary spilling.
2011-08-22 14:06:17 +02:00
Marijn Haverbeke
081caf5bb8 Do not check for self-assign unless dest is initialized
Also, give copy_val and move_val a more sane return type.
2011-08-22 14:05:56 +02:00
Marijn Haverbeke
c930af74d5 Write call_copy_glue 2011-08-22 14:05:54 +02:00
Marijn Haverbeke
cd5e4c21ee Add skeleton of copy glue that actually copies 2011-08-22 11:41:49 +02:00
Marijn Haverbeke
7588a89553 Rename copy_glue back to take_glue 2011-08-22 10:42:56 +02:00
Marijn Haverbeke
b24f978011 Drop arguments on the caller side, not the callee
This makes it easier for the caller to optimize the take/drop away for
temporary values, and opens up new possibilities for alias handling.

Breaks tail calls.
2011-08-22 10:16:09 +02:00
Marijn Haverbeke
35c962e9a1 Pass structural types by pointer, not by value
If we lose tail calls, this is possible. It simplifies things a lot.

Direct motivation: We want ivecs with pointers pointing into
themselves. When copying those, the pointers have to be adjusted. It
is impossible to this when copying them with Load/Store.
2011-08-22 10:16:09 +02:00
Brian Anderson
6ad5b71ad9 Conditionally define CDECL and FASTCALL on windows
These may already be defined by other includes. Hopefully puts out the windows
fire.
2011-08-20 16:31:38 -07:00
Brian Anderson
7dad31d11c Fix comment typos 2011-08-20 16:30:27 -07:00
Brian Anderson
abdb6cd71b Rewrite reap_dead_tasks to never grab the sched lock before a task lock
Doing so contradicts the locking order used everywhere else and causes
deadlocks.

Un-XFAIL task-perf-spawnalot

Closes #854
2011-08-20 16:21:27 -07:00
Patrick Walton
25416bfae1 rustc: Introduce ABI versioning so we can change value representations without breaking the compiler 2011-08-20 14:22:09 -07:00
Patrick Walton
2f650038ad rt: Move the GetProcAddress/dlsym stuff out of rust_gc.cpp into rust_abi.h 2011-08-20 14:06:04 -07:00
Brian Anderson
15e456d547 Convert task-perf-spawnalot to spawn_joinable. XFAIL 2011-08-20 13:02:53 -07:00
Brian Anderson
bc1b6b594b Stop parsing ~[] vector syntax 2011-08-20 11:04:00 -07:00
Brian Anderson
a7d837be74 Stop parsing .() indexes 2011-08-20 11:04:00 -07:00
Brian Anderson
518dc52f85 Reformat
This changes the indexing syntax from .() to [], the vector syntax from ~[] to
[] and the extension syntax from #fmt() to #fmt[]
2011-08-20 11:04:00 -07:00