Commit Graph

173 Commits

Author SHA1 Message Date
Philipp Brüschweiler
8bf0033345 Remove unused shape fields from typedescs 2013-06-23 12:49:16 +02:00
bors
3b126e4d6d auto merge of #7274 : thestinger/rust/size_hint, r=huonw
I ran into a weird lifetime bug blocking updating the `collect` method to use `FromIterator`, but everything here works fine.
2013-06-22 23:07:55 -07:00
Daniel Micay
d2e9912aea vec: remove BaseIter implementation
I removed the `static-method-test.rs` test because it was heavily based
on `BaseIter` and there are plenty of other more complex uses of static
methods anyway.
2013-06-23 02:05:20 -04:00
Philipp Brüschweiler
de471a2eca Fix take glue of owned trait objects
This finishes the incomplete conversion of unique traits as two-word
allocations started in 211d038abc.

Fixes #5882, #6717, #7153, #7208.
2013-06-22 09:37:40 +02:00
bors
dc4560dc26 auto merge of #7182 : Aatch/rust/trans-refactor-pt2, r=graydon
This is another big refactoring of `trans` though this is unlikely to have much of an
impact on code size or speed.

The major change here is the implementation of a `Type` struct which is the new
home for all your LLVM `TypeRef` needs. It's a simple wrapper struct, with static
methods for constructing types, then regular methods for
manipulating/interrogating them. The purpose of this is mostly to make the code
surrounding them somewhat more ideomatic. A line like: `T_ptr(T_ptr(T_i8()))` is 
now `Type::i8().ptr_to().ptr_to()`,which is much more like regular Rust code.

There are a variety of smaller changes here and there:

* Remove address spaces. At least it doesn't generate them, I haven't spent much
  time looking for related code.
* Use a macro for declaring the LLVM intrinsics, makes it look much nicer.
* Make the type for a string slice actually create a named `str_slice` type in LLVM,
  this makes reading the appropriate code much easier.
* Change the way struct and enum type names are generated. This just means
  that a struct like `struct Foo { a: int }` now produces the IR 
  `%struct.Foo = type { i64 }`, which is much easier to read. Similarly, other structs
  are a bit tighter to make it easier to read.

--- --- ---

This PR did get away from me a little, as I occasionally got distracted or as I fixed
up problems with unrelated code that were stopping me from continuing. One major
thing is that this PR contains the work from #7168, since that would have conflicted
with this and it was broken anyway. Sorry for bundling it like this.

Fixes #3670 and #7063

--- --- ---

EDIT: This no longer removes the llvm insn stats.
2013-06-21 19:19:58 -07:00
James Miller
81cf72c264 Finish up Type refactoring 2013-06-22 12:35:35 +12:00
James Miller
fd83b92b59 More Type refactorings 2013-06-22 12:26:33 +12:00
bors
f886520d24 auto merge of #7219 : sstewartgallus/rust/cleanup, r=graydon 2013-06-21 16:01:59 -07:00
James Miller
3bc4d1a120 Remove all #[cfg(stage0)]-protected code
New snapshot means this can all go. Also removes places that have
comments that say they are workarounds for stage0 errors.
2013-06-21 02:43:02 +12:00
Brian Anderson
b7a6919899 rustc: Dispose of LLVM passes in test cases 2013-06-19 15:18:25 -07:00
Steven Stewart-Gallus
b8efa2ebe0 Cleanup src/librustc/back 2013-06-18 18:50:37 -07:00
Graydon Hoare
d904c72af8 replace #[inline(always)] with #[inline]. r=burningtree. 2013-06-18 14:48:48 -07:00
Brian Anderson
fd09e40f97 Revert "stop using an absolute rpath"
This reverts commit 708395d65d.
2013-06-17 12:37:06 -07:00
Huon Wilson
bbcff95ac5 remove unused imports 2013-06-16 12:20:12 +10:00
bors
c989b79127 auto merge of #7132 : thestinger/rust/rpath, r=brson
This is a bad default, because the binaries will point at an absolute
path regardless of where they are moved. This opens up a security issue
for packages, because they will attempt to load libraries from a path
that's often owned by a regular user.

Every Rust binary is currently flagged by Debian, Fedora and Arch lint
checkers as having dangerous rpaths. They don't meet the requirements to
be placed in the repositories without manually stripping this from each
binary.

The relative rpath is still enough to keep the binaries working until
they are moved relative to the crates they're linked against.

http://wiki.debian.org/RpathIssue
https://fedoraproject.org/wiki/Packaging:Guidelines#Beware_of_Rpath
2013-06-15 16:13:09 -07:00
Daniel Micay
708395d65d stop using an absolute rpath
This is a bad default, because the binaries will point at an absolute
path regardless of where they are moved. This opens up a security issue
for packages, because they will attempt to load libraries from a path
that's often owned by a regular user.

Every Rust binary is currently flagged by Debian, Fedora and Arch lint
checkers as having dangerous rpaths. They don't meet the requirements to
be placed in the repositories without manually stripping this from each
binary.

The relative rpath is still enough to keep the binaries working until
they are moved relative to the crates they're linked against.

http://wiki.debian.org/RpathIssue
https://fedoraproject.org/wiki/Packaging:Guidelines#Beware_of_Rpath
2013-06-15 18:17:24 -04:00
James Miller
cc908b772c Remove @-fields from CrateContext
Remove all the explicit @mut-fields from CrateContext, though many
fields are still @-ptrs.
This required changing every single function call that explicitly
took a @CrateContext, so I took advantage and changed as many as I
could get away with to &-ptrs or &mut ptrs.
2013-06-16 09:20:40 +12:00
James Miller
b1f39ce403 Move CrateContext into it's own file 2013-06-16 09:17:50 +12:00
bors
83d44f87e5 auto merge of #7125 : alexcrichton/rust/rusti-issues, r=brson
This un-reverts the reverts of the rusti commits made awhile back. These were reverted for an LLVM failure in rustpkg. I believe that this is not a problem with these commits, but rather that rustc is being used in parallel for rustpkg tests (in-process). This is not working yet (almost! see #7011), so I serialized all the tests to run one after another.

@brson, I'm mainly just guessing as to the cause of the LLVM failures in rustpkg tests. I'm confident that running tests in parallel is more likely to be the problem than those commits I made.

Additionally, this fixes two recently reported issues with rusti.
2013-06-15 01:04:05 -07:00
Daniel Micay
585f5f7f79 add IteratorUtil to the prelude 2013-06-14 23:15:42 -04:00
Alex Crichton
dc18321ef5 Don't run passes again on JIT code
These passes are already run beforehand, no need to do them twice.
2013-06-13 22:53:10 -07:00
Alex Crichton
a90fffe367 Revert "Revert "Have JIT execution take ownership of the LLVMContextRef""
This reverts commit 19adece68b.
2013-06-13 21:25:18 -07:00
Brian Anderson
19adece68b Revert "Have JIT execution take ownership of the LLVMContextRef"
This reverts commit 5c5095d25e.

Conflicts:
	src/librusti/rusti.rc
2013-06-13 13:08:57 -07:00
Steven Stewart-Gallus
d9d50a5bd4 Remove unused imports
I was able to remove unused imports, and fix the following warnings

src/libstd/hashmap.rs:23:15: 23:23 warning: unused import [-W unused-imports (default)]
src/libstd/task/spawn.rs:95:15: 95:23 warning: unused import [-W unused-imports (default)]
src/libstd/rt/uv/mod.rs:42:0: 42:9 warning: unused import [-W unused-imports (default)]
src/libstd/rt/uv/mod.rs:45:0: 45:9 warning: unused import [-W unused-imports (default)]
src/librustc/middle/trans/meth.rs:26:0: 26:26 warning: unused import [-W unused-imports (default)]
src/librustc/back/link.rs:210:20: 210:25 warning: unused import [-W unused-imports (default)]

I was unable to fix the following unused import warnings. The code
here was weird.

src/libextra/std.rc:40:11: 40:14 warning: unused import [-W unused-imports (default)]
src/libextra/std.rc:40:16: 40:24 warning: unused import [-W unused-imports (default)]
2013-06-13 10:46:17 -07:00
Huon Wilson
096f6f56a8 Use @str instead of @~str in libsyntax and librustc. Fixes #5048.
This almost removes the StringRef wrapper, since all strings are
Equiv-alent now. Removes a lot of `/* bad */ copy *`'s, and converts
several things to be &'static str (the lint table and the intrinsics
table).

There are many instances of .to_managed(), unfortunately.
2013-06-13 10:20:52 +10:00
Huon Wilson
efc71a8bdb std: unify the str -> [u8] functions as 3 methods: .as_bytes() and .as_bytes_with_null[_consume]().
The first acts on &str and is not nul-terminated, the last two act on strings
that are always null terminated (&'static str, ~str and @str).
2013-06-12 12:21:04 +10:00
Huon Wilson
ba4a4778cc std: convert str::{*shift,pop}* to methods. 2013-06-12 12:21:04 +10:00
Alex Crichton
5c5095d25e Have JIT execution take ownership of the LLVMContextRef
Also stop leaking the ExecutionEngine created for jit code by forcibly disposing
of it after the JIT code has finished executing
2013-06-10 13:17:04 -07:00
Huon Wilson
838191c40b std: replace str::{starts,ends}_with with the method. 2013-06-11 01:03:24 +10:00
Huon Wilson
ccd0ac59e9 std: remove str::{connect,concat}*. 2013-06-10 23:57:03 +10:00
Huon Wilson
c32fb53cf9 std: remove str::{len, slice, is_empty} in favour of methods. 2013-06-10 23:02:54 +10:00
Huon Wilson
4b806b4d06 std: remove each_char* fns and methods from str, replaced by iterators. 2013-06-09 02:22:23 +10:00
bors
2c65e2e385 auto merge of #6956 : Blei/rust/fix-symbol-mangling, r=catamorphism
Handle more characters that appear in types, most notably <>): were
missing. Also the new scheme takes care that no two different input
strings result in the same mangled string, which was not the case before.

Fixes #6921
2013-06-05 14:13:43 -07:00
Philipp Brüschweiler
eb62781720 rustc:🔙🔗 redo symbol mangling
Handle more characters that appear in types, most notably <>): were
missing. Also the new scheme takes care that no two different input
strings result in the same mangled string, which was not the case before.

Fixes #6921
2013-06-05 22:21:25 +02:00
John Clements
22d21ab4c2 rename repr to name 2013-06-05 12:01:37 -07:00
Tim Chevalier
341678b815 rustc: Call str::is_empty 2013-06-01 18:48:07 -07:00
James Miller
6e075b6bb6 Better optimization pipeline 2013-06-02 00:08:38 +12:00
James Miller
85e3c96236 Remove the slow bb-vectorize pass 2013-05-31 09:01:13 -04:00
bors
1dd5cd9731 auto merge of #6833 : fdr/rust/fix-warnings, r=Aatch
Fix a laundry list of warnings involving unused imports that glutted
up compilation output.  There are more, but there seems to be some
false positives (where 'remedy' appears to break the build), but this
particular set of fixes seems safe.
2013-05-31 00:43:45 -07:00
Daniel Farina
aef1e10eba Remove unnecessary 'use' forms
Fix a laundry list of warnings involving unused imports that glutted
up compilation output.  There are more, but there seems to be some
false positives (where 'remedy' appears to break the build), but this
particular set of fixes seems safe.
2013-05-30 13:08:18 -07:00
Niko Matsakis
7a1a40890d Remove copy bindings from patterns. 2013-05-30 15:20:36 -04:00
Björn Steinbrink
1720d9f663 Remove a bunch of unnecessary allocations and copies 2013-05-30 11:49:04 +02:00
Erick Tryzelaar
b916e65f3e librustc: add some imports to back/passes.rs rs=burningtree 2013-05-29 20:00:43 -07:00
Patrick Walton
206ab89629 librustc: Stop reexporting the standard modules from prelude. 2013-05-29 19:04:53 -07:00
James Miller
faf1afee16 Further refactor optimization pass handling
This refactors pass handling to use the argument names, so it can be used
in a similar manner to `opt`. This may be slightly less efficient than the
previous version, but it is much easier to maintain.

It also adds in the ability to specify a custom pipeline on the command
line, this overrides the normal passes, however. This should completely
close #2396.
2013-05-29 20:08:20 +12:00
James Miller
6861d542a2 Remove now-unused import 2013-05-29 14:16:49 +12:00
James Miller
998e2ce4ff Remove passes that were causing bad optmizations 2013-05-29 14:16:49 +12:00
James Miller
4988c89e86 Move the initial dead prototype removal pass 2013-05-29 14:16:49 +12:00
James Miller
a5b87d71e0 Fix pass creation typo 2013-05-29 14:16:49 +12:00
James Miller
d694e283b3 Refactor optimization pass handling.
Refactor the optimization passes to explicitly use the passes. This commit
just re-implements the same passes as were already being run.

It also adds an option (behind `-Z`) to run the LLVM lint pass on the
unoptimized IR.
2013-05-29 14:16:49 +12:00