Commit Graph

21617 Commits

Author SHA1 Message Date
bors
35f975b838 auto merge of #8700 : alexcrichton/rust/better-llvm, r=thestinger
Beforehand, it was unclear whether rust was performing the "recommended set" of
optimizations provided by LLVM for code. This commit changes the way we run
passes to closely mirror that of clang, which in theory does it correctly. The
notable changes include:

* Passes are no longer explicitly added one by one. This would be difficult to
  keep up with as LLVM changes and we don't guaranteed always know the best
  order in which to run passes
* Passes are now managed by LLVM's PassManagerBuilder object. This is then used
  to populate the various pass managers run.
* We now run both a FunctionPassManager and a module-wide PassManager. This is
  what clang does, and I presume that we *may* see a speed boost from the
  module-wide passes just having to do less work. I have no measured this.
* The codegen pass manager has been extracted to its own separate pass manager
  to not get mixed up with the other passes
* All pass managers now include passes for target-specific data layout and
  analysis passes

Some new features include:

* You can now print all passes being run with `-Z print-llvm-passes`
* When specifying passes via `--passes`, the passes are now appended to the
  default list of passes instead of overwriting them.
* The output of `--passes list` is now generated by LLVM instead of maintaining
  a list of passes ourselves
* Loop vectorization is turned on by default as an optimization pass and can be
  disabled with `-Z no-vectorize-loops`


All of these "copies" of clang are based off their [source code](http://clang.llvm.org/doxygen/BackendUtil_8cpp_source.html) in case anyone is curious what my source is. I was hoping that this would fix #8665, but this does not help the performance issues found there. Hopefully i'll allow us to tweak passes or see what's going on to try to debug that problem.
2013-08-26 21:25:55 -07:00
Alex Crichton
73540551e5 Rewrite pass management with LLVM
Beforehand, it was unclear whether rust was performing the "recommended set" of
optimizations provided by LLVM for code. This commit changes the way we run
passes to closely mirror that of clang, which in theory does it correctly. The
notable changes include:

* Passes are no longer explicitly added one by one. This would be difficult to
  keep up with as LLVM changes and we don't guaranteed always know the best
  order in which to run passes
* Passes are now managed by LLVM's PassManagerBuilder object. This is then used
  to populate the various pass managers run.
* We now run both a FunctionPassManager and a module-wide PassManager. This is
  what clang does, and I presume that we *may* see a speed boost from the
  module-wide passes just having to do less work. I have no measured this.
* The codegen pass manager has been extracted to its own separate pass manager
  to not get mixed up with the other passes
* All pass managers now include passes for target-specific data layout and
  analysis passes

Some new features include:

* You can now print all passes being run with `-Z print-llvm-passes`
* When specifying passes via `--passes`, the passes are now appended to the
  default list of passes instead of overwriting them.
* The output of `--passes list` is now generated by LLVM instead of maintaining
  a list of passes ourselves
* Loop vectorization is turned on by default as an optimization pass and can be
  disabled with `-Z no-vectorize-loops`
2013-08-26 20:11:51 -07:00
bors
c0aadfd76c auto merge of #8747 : pnkfelix/rust/fsk-issue6887-fix-emacs-compilation-regexp, r=graydon
Fix #6887
2013-08-26 19:55:57 -07:00
bors
af99b8d91e auto merge of #8739 : fhahn/rust/ticket_2275, r=brson
This is a pull request for #2275

I've created a small python script to generate test files for a list of keywords (as break do else enum extern false fn for if impl let loop match mod mut priv pub ref return self static struct super true trait type unsafe use while), but I'm not really sure where to put it. I've added the created files as well.

I did not use 

     fn main() {
        let $KW = "foo"; //~ error
        println($KW); //~ error
    } 

as template, because for return, self, ref, loop, mut and break this does not raise an error in the ```println``` line, only in the ```let``` line.
2013-08-26 18:20:56 -07:00
bors
a8221bd5e2 auto merge of #8438 : cmr/rust/default, r=thestinger 2013-08-26 17:05:57 -07:00
Corey Richardson
6eb924d28e Fix deriving-zero test 2013-08-26 19:47:58 -04:00
Corey Richardson
87d9d37c07 Add a Default trait. 2013-08-26 19:25:53 -04:00
bors
1ac7d809af auto merge of #8712 : catamorphism/rust/rustpkg-issue-7241, r=pcwalton
r? @brson ...multiple workspaces

The test checks that rustpkg uses the first one, rather than complaining
about multiple matches.

Closes #7241
2013-08-26 15:51:15 -07:00
Tim Chevalier
3e4e1a274a rustpkg: Test that different copies of the same package ID can exist in multiple workspaces
The test checks that rustpkg uses the first one, rather than complaining
about multiple matches.

Closes #7241
2013-08-26 15:23:06 -07:00
bors
9cd91c8cc4 auto merge of #8766 : brson/rust/vecfromfn, r=alexcrichton
A recently-enabled test of this is causing valgrind failures.
2013-08-26 13:41:12 -07:00
Brian Anderson
8dc13ac345 std: Make vec::from_fn failure-safe 2013-08-26 13:29:33 -07:00
bors
ce27752a69 auto merge of #8488 : klutzy/rust/mingw-w64, r=brson
This patchset enables rustc to cross-build mingw-w64 outputs.
Tested on mingw + mingw-w64 (mingw-builds, win64/seh/win32-threads/gcc-4.8.1).

I also patched llvm to support Win64 stack unwinding.
ebe22bdbce

I cross-built test/run-pass/smallest-hello-world.rs and confirmed it works.
However, I also found something went wrong if I don't have custom `#[start]` routine.
2013-08-26 11:46:13 -07:00
bors
36b5115585 auto merge of #8764 : blake2-ppc/rust/doc-condition, r=graydon
As mentioned in PR #8563 it seems this tutorial has no inbound link!
2013-08-26 10:36:18 -07:00
blake2-ppc
026304cf15 doc: Link condition and error-handling tutorial from main tutorial 2013-08-26 18:10:40 +02:00
bors
c6eb3ec30c auto merge of #8758 : pnkfelix/rust/fsk-more-oldvisit-ports, r=pnkfelix
Further followup on #7081.

There still remains writeback.rs, but I want to wait to investigate that one because I've seen `make check` issues with it in the past.
2013-08-26 08:26:14 -07:00
Florian Hahn
c921331295 Add script and tests for using keywords as identifiers 2013-08-26 15:50:52 +02:00
bors
5fc211accf auto merge of #8749 : gifnksm/rust/bigint-cfg, r=pnkfelix
This also fixes #4393.
2013-08-26 06:41:15 -07:00
klutzy
442f4a5f2c Support Win64 context switching
This patch saves and restores win64's nonvolatile registers.
This patch also saves stack information of thread environment
block (TEB), which is at %gs:0x08 and %gs:0x10.
2013-08-26 22:16:54 +09:00
klutzy
63e53b8af2 rt: Support SEH/SJLJ personality routine 2013-08-26 22:15:45 +09:00
klutzy
ef20bd44bd rt: Make valgrind Win64-compatible 2013-08-26 22:15:45 +09:00
klutzy
05b6a2f59c std: Add Win64 support
Some extern blobs are duplicated without "stdcall" abi,
since Win64 does not use any calling convention.
(Giving any abi to them causes llvm producing wrong bytecode.)
2013-08-26 22:15:45 +09:00
klutzy
6aff4c67f6 std: Bind write() on Win64 2013-08-26 22:15:32 +09:00
klutzy
37e99ae4cd std: Add Win64 types 2013-08-26 22:15:27 +09:00
klutzy
e41a81b1ee Set main_name "WinMain" on Win64 2013-08-26 22:15:26 +09:00
klutzy
a35bfa2e9b rt: Add {get,record}_sp_limit on Win64
Uses ArbitraryUserPointer area at gs:0x28.
2013-08-26 22:14:31 +09:00
klutzy
5118ef6ff0 rt: Remove leading underscore on Win64
Win64 convention does not use underscore.
2013-08-26 22:14:23 +09:00
bors
540d98e7fc auto merge of #8737 : blake2-ppc/rust/std-str-rsplit, r=huonw
Make CharSplitIterator double-ended which is simple given that the operation is symmetric, once the split-N feature is factored out into its own adaptor.

`.rsplitn_iter()` allows splitting `N` times from the back of a string, so it is a completely new feature. With the double-ended impl, `.split_iter()`, `.line_iter()`, `.word_iter()` all allow picking off elements from either end.

`split_options_iter` is removed with the factoring of the split- and split-N- iterators, instead there is `split_terminator_iter`.

---

Add benchmarks using `#[bench]` and tune CharSplitIterator a bit after Huon Wilson's suggestions

Benchmarks 1-5 do the same split using different implementations of `CharEq`, all splitting an ascii string on ascii space. Benchmarks 6-7 split a unicode string on an ascii char.

Before this PR
test str::bench::split_iter_ascii ... bench: 166 ns/iter (+/- 2)
test str::bench::split_iter_closure ... bench: 113 ns/iter (+/- 1)
test str::bench::split_iter_extern_fn ... bench: 286 ns/iter (+/- 7)
test str::bench::split_iter_not_ascii ... bench: 114 ns/iter (+/- 4)
test str::bench::split_iter_slice ... bench: 220 ns/iter (+/- 12)
test str::bench::split_iter_unicode_ascii ... bench: 217 ns/iter (+/- 3)
test str::bench::split_iter_unicode_not_ascii ... bench: 248 ns/iter (+/- 3)

PR, first commit
test str::bench::split_iter_ascii ... bench: 331 ns/iter (+/- 9)
test str::bench::split_iter_closure ... bench: 114 ns/iter (+/- 2)
test str::bench::split_iter_extern_fn ... bench: 314 ns/iter (+/- 6)
test str::bench::split_iter_not_ascii ... bench: 132 ns/iter (+/- 1)
test str::bench::split_iter_slice ... bench: 157 ns/iter (+/- 3)
test str::bench::split_iter_unicode_ascii ... bench: 502 ns/iter (+/- 64)
test str::bench::split_iter_unicode_not_ascii ... bench: 250 ns/iter (+/- 3)

PR, final version
test str::bench::split_iter_ascii ... bench: 106 ns/iter (+/- 4)
test str::bench::split_iter_closure ... bench: 107 ns/iter (+/- 1)
test str::bench::split_iter_extern_fn ... bench: 267 ns/iter (+/- 6)
test str::bench::split_iter_not_ascii ... bench: 108 ns/iter (+/- 1)
test str::bench::split_iter_slice ... bench: 170 ns/iter (+/- 8)
test str::bench::split_iter_unicode_ascii ... bench: 128 ns/iter (+/- 5)
test str::bench::split_iter_unicode_not_ascii ... bench: 252 ns/iter (+/- 3)

---

There are several ways to deal with `CharEq::only_ascii`. It is a performance optimization, so with that in mind, we allow passing bogus char (outside ascii) as long as they don't match. We use a byte value check to make sure we don't split on these (would split substrings in the middle of encoded char).  (A more principled way would be to only pass the ascii codepoints to the CharEq when it indicates only_ascii, but that undoes some of the performance optimization.)
2013-08-26 05:06:16 -07:00
blake2-ppc
4de9bca4d8 std::str: Tune CharSplitIterator after benchmarks
Implement Huon Wilson's suggestions (since the benchmarks agree!).

Use `self.sep.matches(byte as char) && byte < 128u8` to match in the
only_ascii case so that mistaken matches outside the ascii range can't
create invalid substrings.

Put the conditional on only_ascii outside the loop.
2013-08-26 13:30:46 +02:00
Felix S. Klock II
2f82d89b28 Placate make tidy. 2013-08-26 13:27:36 +02:00
gifnksm
f8f17a39ce bigint: fix wrong benchmark fn name 2013-08-26 20:27:20 +09:00
bors
501eea0842 auto merge of #8744 : jld/rust/discr64, r=nikomatsakis
This is in preparation for making discriminants not always be int (#1647), but it also makes compiles for a 64-bit target not behave differently — with respect to how many bits of discriminants are preserved — depending on the build host's word size, which is a nice property to have.

We may want to standardize how to abbreviate "discriminant" in a followup change.
2013-08-26 03:51:19 -07:00
Felix S. Klock II
df6644104e Port typeck/check/vtable.rs from oldvisit to <V:Visitor> trait API. 2013-08-26 11:49:24 +02:00
blake2-ppc
413f868220 std::str: bench tests for .split_iter() 2013-08-26 11:48:48 +02:00
Felix S. Klock II
da88f69f06 Port middle/stack_check.rs from oldvisit to <V:Visitor> trait API. 2013-08-26 11:43:14 +02:00
Felix S. Klock II
6af6b088ad Port middle/moves.rs from oldvisit to <V:Visitor> trait API. 2013-08-26 11:31:21 +02:00
Felix S. Klock II
ec6ab8c899 Remove occurrences of oldvisit text to improve grepping for old oldvisit. 2013-08-26 11:10:18 +02:00
Felix S. Klock II
ebfbbe294e Port creader.rs from oldvisit to <V:Visitor> trait API. 2013-08-26 11:01:39 +02:00
bors
bdd188d003 auto merge of #8750 : kballard/rust/str-opt-variant, r=thestinger
Add _opt variants to from_bytes, from_bytes_owned, and from_bytes_slice.
These variants return an Option instead of raising a condition/failing.
2013-08-25 21:36:16 -07:00
bors
24bde7ff5a auto merge of #8751 : brson/rust/metadata-revert, r=brson
This reverts commit 491bc3568c, reversing
changes made to 05f1bbba16.

I've heard reports that this broke something. Don't know details yet.
2013-08-25 20:26:18 -07:00
Brian Anderson
4aa342b868 Revert "auto merge of #8745 : brson/rust/metadata, r=cmr"
This reverts commit 491bc3568c, reversing
changes made to 05f1bbba16.
2013-08-25 20:21:13 -07:00
Kevin Ballard
6f9c68af2e Add _opt variants to str byte-conversion functions
Add _opt variants to from_bytes, from_bytes_owned, and from_bytes_slice.
These variants return an Option instead of raising a condition/failing.
2013-08-25 18:30:31 -07:00
Felix S. Klock II
9d8897ba60 extend file regexp to match files with embedded spaces. 2013-08-26 02:28:27 +02:00
bors
491bc3568c auto merge of #8745 : brson/rust/metadata, r=cmr
This does two things: 1) stops compressing metadata, 2) stops copying the metadata section, instead holding a reference to the buffer returned by the LLVM section iterator.

Not compressing metadata requires something like 7x the storage space, but makes running tests about 9% faster. This has been a time improvement on all platforms I've tested, including windows. I considered leaving compression as an option but it doesn't seem to be worth the complexity since we don't currently have any use cases where we need to save that space.

In order to avoid copying the metadata section I had to hack up extra::ebml a bit to support unsafe buffers. We should probably move it into librustc so that it can evolve to support the compiler without worrying about having a crummy interface.

r? @graydon
2013-08-25 13:36:14 -07:00
bors
05f1bbba16 auto merge of #8723 : anasazi/rust/temporary-unkillable-io, r=brson
Also added a home_for_io_with_sched variant to consolidate some cases.

This is a temporary step to resolving #8674.
2013-08-25 12:26:16 -07:00
gifnksm
084cfc10f5 bigint: Add benchmarks 2013-08-26 00:26:03 +09:00
gifnksm
fc41ba167c bigint: un-ignore test_shr 2013-08-25 23:55:12 +09:00
gifnksm
17c8f8bd0c bigint: inlining small functions 2013-08-25 22:47:24 +09:00
gifnksm
b247d17629 bigint: remove unnecessary method implements 2013-08-25 22:36:55 +09:00
gifnksm
36d698d544 bigint: cfg(target_arch = ...) => cfg(target_word_size = ...) 2013-08-25 22:24:52 +09:00
Felix S. Klock II
fe7092dafb revisions to emacs compilation regexp, more readable and robust. 2013-08-25 14:38:12 +02:00