Commit Graph

21631 Commits

Author SHA1 Message Date
Daniel Micay
20567a0c3c vec: implement DeepClone 2013-08-27 13:47:15 -04:00
bors
0baa92707a auto merge of #8789 : pnkfelix/rust/fsk-fix-typo-in-rust-mode.el, r=pnkfelix
Fix #6887.  (or rather, a bug injected by my prior commit for fixing that bug.)
2013-08-27 08:00:51 -07:00
bors
4fa09e08ed auto merge of #8777 : Kimundi/rust/doc_stuff, r=cmr 2013-08-27 06:45:50 -07:00
bors
932d7b9465 auto merge of #8780 : brson/rust/from_elem, r=thestinger 2013-08-27 05:30:54 -07:00
bors
d9b0d4b603 auto merge of #8779 : brson/rust/macsupp, r=thestinger
This callstack changed when the FFI did. I am still a little frightened by
this suppression.

cc #8253
2013-08-27 04:15:54 -07:00
Felix S. Klock II
1f13eab3c0 fix typo in rust-mode.el 2013-08-27 12:48:51 +02:00
bors
947513c4f4 auto merge of #8773 : catamorphism/rust/rustpkg-version-flag, r=anasazi
r? anyone. Now, rustpkg --version does something useful!
2013-08-27 03:00:52 -07:00
bors
604ab9477a auto merge of #8757 : vadimcn/rust/debug-info-tests, r=brson
Now that new LLVM has landed, the debug info works on Windows as well.   Most existing tests pass, except for the following four, which I left disabled for now:
lexical-scope-in-for-loop
lexical-scope-in-if
lexical-scope-in-match
lexical-scopes-in-block-expression

Also, fixed a small problem with the debug info test runner.
2013-08-26 23:35:54 -07:00
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
Marvin Löbel
8f17ac9099 Rewrote module tutorial 2013-08-27 04:15:11 +02: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
Brian Anderson
063d9ca928 std: Make vec::from_elem failure-safe 2013-08-26 18:17:56 -07:00
Brian Anderson
7406c2d0b7 Fix valgrind suppression on mac
This callstack changed when the FFI did. I am still a little frightened by
this suppression.
2013-08-26 17:39:50 -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
f3d017cbab rustpkg: Implement --version command-line option
Now, rustpkg --version does something useful!
2013-08-26 15:34:34 -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
Vadim Chugunov
7f79b52ad9 Un-disabled debug info tests on Windows. 2013-08-26 01:23:18 -07:00