Commit Graph

18486 Commits

Author SHA1 Message Date
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
bors
e3d0c1eb0e auto merge of #6731 : thomaslee/rust/issue-6575, r=pcwalton
Fix for #6575. In the trans phase, rustc emits code for a function parameter that goes completely unused in the event the return type of the function in question happens to be an immediate.

This patch modifies rustc & parts of rustrt to ensure that the vestigial parameter is no longer present in compiled code.
2013-05-28 17:37:57 -07:00
bors
5676056ae6 auto merge of #6775 : yjh0502/rust/issue_6696, r=catamorphism 2013-05-28 15:40:53 -07:00
bors
9a06ff0590 auto merge of #6707 : catamorphism/rust/issue-5543, r=catamorphism 2013-05-28 14:35:00 -07:00
Tim Chevalier
7ad1cc71e3 testsuite: Add main function to issue-5554 test 2013-05-28 13:43:10 -07:00
bors
d7e1f08b21 auto merge of #6774 : alexcrichton/rust/silence-warnings, r=graydon
Also as a bonus this fixes #6767
2013-05-28 13:35:05 -07:00
Alex Crichton
b04c40bb1c Silence various warnings throughout test modules 2013-05-28 15:27:35 -05:00
bors
833ed21f87 auto merge of #6786 : thestinger/rust/revert-noalias-mut-rptr, r=nikomatsakis
it can alias `&const` and `@mut`
2013-05-28 10:11:05 -07:00
Daniel Micay
accc5272f8 noalias on all &mut parameters is too coarse
it can alias `&const` and `@mut`
2013-05-28 13:05:50 -04:00
Alex Crichton
8749cb59d8 Fix 'make check-stage1-std' by correcting dependencies 2013-05-28 09:37:38 -05:00
bors
05735a934a auto merge of #6783 : hoelzro/rust/master, r=bstrie
I think settings like this should be left up to the user.
2013-05-28 07:16:59 -07:00
Rob Hoelz
2505416408 Remove colorcolumn setting 2013-05-28 16:06:15 +02:00
bors
c33258bee1 auto merge of #6773 : lkuper/rust/alt-to-match, r=thestinger
RIP `alt`.
2013-05-28 05:07:59 -07:00
bors
24784e8030 auto merge of #6771 : thestinger/rust/highlight, r=luqmana
This works with pandoc linked against highlighting-kate >= 0.5.3.8. It seems to just be a no-op with earlier versions, because I successfully ran this through `try`.

This also fixes some consistency issues (like making `Example`/`Examples` always a header and always using three tildes).
2013-05-28 04:02:02 -07:00
bors
b738b5766e auto merge of #6754 : thestinger/rust/noalias, r=nikomatsakis
The compiler guarantees that there are no other references to a unique pointer when it's passed by-value to a function.

The existence of the header and annihilator don't matter since it's not relevant to the call:

> For a call to the parent function, dependencies between memory references from before or after the call and from those during the call are “irrelevant” to the noalias keyword for the arguments and return value used in that call.

@graydon's tracing garbage collector stores the metadata outside of the boxes, so that won't be a problem. I'm unsure if updating the header while inside a function where it's marked as `noalias` would be a problem anyway since you never actually read or write to the header.

@nikomatsakis: r?
2013-05-28 02:59:03 -07:00
bors
7ee329e97a auto merge of #6770 : lkuper/rust/6762, r=catamorphism 2013-05-28 01:50:03 -07:00
bors
fe7f528e5d auto merge of #6769 : catamorphism/rust/issue-4994, r=thestinger
r? @thestinger As called for in #4994
2013-05-28 00:44:05 -07:00
bors
f7f36a8373 auto merge of #6766 : fdr/rust/time-by-value, r=catamorphism
Per the recommendation of the now-removed FIXME.
2013-05-27 23:41:19 -07:00
bors
6264df5331 auto merge of #6777 : alexcrichton/rust/less-memory, r=graydon
Via my super-accurate timing (`/usr/bin/time -l`), I get 2431119360 => 1884430336 == ~520MB

Closes #6637.
2013-05-27 22:29:09 -07:00
bors
26fb16e36f auto merge of #6776 : graydon/rust/node-type-table-hashmap, r=thestinger
Smallintmap was being populated with sparse keys during ast deserialization.
2013-05-27 21:20:11 -07:00
Jihyun Yu
4521c34775 Fix #6696 2013-05-28 12:35:06 +09:00
bors
6d7d759129 auto merge of #6752 : osaut/rust/tutorial-tasks, r=graydon
* Add a short section and an example illustrating the use of ARC. 
* Header for the section of Future changed to be more descriptive: "Backgrounding computations: Futures".
2013-05-27 20:23:05 -07:00
Alex Crichton
ae7df57c5a Prevent refcount cycles during linting
Shaves off ~600MB of memory while compiling rustc
2013-05-27 22:22:09 -05:00
Graydon Hoare
3c4ce79518 rustc: Switch ty::node_type_table to smallintmap, cut 400mb memory use off a librustc build.
Smallintmap was being populated with sparse keys during ast deserialization.
2013-05-27 19:50:49 -07:00
Tom Lee
b7f71e1ee6 Implementing suggestions from @nikomatsakis 2013-05-27 19:34:25 -07:00
bors
2061ce9aff auto merge of #6741 : pcwalton/rust/intra-crate-start, r=graydon
r? @brson
2013-05-27 18:26:04 -07:00
Tim Chevalier
351f6033d6 testsuite: Update core to std 2013-05-27 17:32:32 -07:00
Tim Chevalier
403aee1082 testsuite: Test cases, one xfailed, one not 2013-05-27 17:32:32 -07:00
Tim Chevalier
58547d6488 testsuite: Add working test for #5550 2013-05-27 17:32:31 -07:00
Tim Chevalier
6c03fbfefd testsuite: Add passing test for #4735 2013-05-27 17:32:31 -07:00
Tom Lee
a85993ff69 Added _RUST_STAGEN guard to rust_call_tydesc_glue 2013-05-27 17:13:01 -07:00
Tom Lee
cddd274e4d Add _RUST_STAGE0 #ifdefs 2013-05-27 17:13:01 -07:00
Tom Lee
67283eaad2 Omit unused implicit argument if return type is immediate. 2013-05-27 17:13:01 -07:00
bors
e6a838d051 auto merge of #6739 : kballard/rust/issue-6419, r=catamorphism
Apple Clang uses different version numbering than "regular" clang, but
it also provides the "regular" version it's based on. Update the sed
pattern to pull out this "regular" version number instead of the Apple
version number.
2013-05-27 16:53:06 -07:00
bors
dbc57584bd auto merge of #6724 : thestinger/rust/swap_fast, r=thestinger
Passing higher alignment values gives the optimization passes more freedom since it can copy in larger chunks. This change results in rustc outputting the same post-optimization IR as clang for swaps and most copies excluding the lack of information about padding.

Code snippet:

```rust
#[inline(never)]
fn swap<T>(x: &mut T, y: &mut T) {
    util::swap(x, y);
}
```

Original IR (for `int`):

```llvm
define internal fastcc void @_ZN9swap_283417_a71830ca3ed2d65d3_00E(i64*, i64*) #1 {
static_allocas:
  %2 = icmp eq i64* %0, %1
  br i1 %2, label %_ZN4util9swap_283717_a71830ca3ed2d65d3_00E.exit, label %3

; <label>:3                                       ; preds = %static_allocas
  %4 = load i64* %0, align 1
  %5 = load i64* %1, align 1
  store i64 %5, i64* %0, align 1
  store i64 %4, i64* %1, align 1
  br label %_ZN4util9swap_283717_a71830ca3ed2d65d3_00E.exit

_ZN4util9swap_283717_a71830ca3ed2d65d3_00E.exit:  ; preds = %3, %static_allocas
  ret void
}
```

After #6710:

```llvm
define internal fastcc void @_ZN9swap_283017_a71830ca3ed2d65d3_00E(i64* nocapture, i64* nocapture) #1 {
static_allocas:
  %2 = load i64* %0, align 1
  %3 = load i64* %1, align 1
  store i64 %3, i64* %0, align 1
  store i64 %2, i64* %1, align 1
  ret void
}
```

After this change:

```llvm
define internal fastcc void @_ZN9swap_283017_a71830ca3ed2d65d3_00E(i64* nocapture, i64* nocapture) #1 {
static_allocas:
  %2 = load i64* %0, align 8
  %3 = load i64* %1, align 8
  store i64 %3, i64* %0, align 8
  store i64 %2, i64* %1, align 8
  ret void
}
```

Another example:

```rust
#[inline(never)]
fn set<T>(x: &mut T, y: T) {
    *x = y;
}
```

Before, with `(int, int)` (align 1):

```llvm
define internal fastcc void @_ZN8set_282517_8fa972e3f9e451983_00E({ i64, i64 }* nocapture, { i64, i64 }* nocapture) #1 {
static_allocas:
  %2 = bitcast { i64, i64 }* %1 to i8*
  %3 = bitcast { i64, i64 }* %0 to i8*
  tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* %3, i8* %2, i64 16, i32 1, i1 false)
  ret void
}
```

After, with `(int, int)` (align 8):

```llvm
define internal fastcc void @_ZN8set_282617_8fa972e3f9e451983_00E({ i64, i64 }* nocapture, { i64, i64 }* nocapture) #1 {
static_allocas:
  %2 = bitcast { i64, i64 }* %1 to i8*
  %3 = bitcast { i64, i64 }* %0 to i8*
  tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* %3, i8* %2, i64 16, i32 8, i1 false)
  ret void
}
```
2013-05-27 15:56:08 -07:00
Daniel Micay
e6c04dea03 fix casts on 32-bit 2013-05-27 18:14:00 -04:00
Lindsey Kuper
32c6199161 Change alt to match in filenames. 2013-05-27 17:28:39 -04:00
bors
5d04ee805b auto merge of #6715 : Xazax-hun/rust/incoming, r=graydon
Preliminary implementation for: https://github.com/mozilla/rust/issues/6275

This is my first (non hello world) rust code, so it may not be idiomatic.
2013-05-27 13:44:08 -07:00
bors
b0f3686515 auto merge of #6703 : sanxiyn/rust/allocation-lint, r=sanxiyn
Fix #6145. In particular, handle operator overloading.
2013-05-27 12:38:12 -07:00
Lindsey Kuper
c9c4d92889 Add xfail'd test for #6762. 2013-05-27 15:21:45 -04:00
Tim Chevalier
77de84b4f6 extra: Add reserve and reserve_at_least to extra::deque
As called for in #4994
2013-05-27 11:47:38 -07:00
Daniel Micay
0d5fdce82e syntax highlight code examples in docstrings 2013-05-27 14:47:21 -04:00
bors
d98cc9995f auto merge of #6768 : lkuper/rust/3538, r=thestinger
There were several old `#[doc(hidden)]` attributes in libstd and
libextra, left over from when rustdoc didn't hide private
definitions, tagged with `FIXME #3538`.

Since #3538 is now closed, I removed the `#[doc(hidden)]` attributes
as well as the FIXMEs, but I left `#[doc(hidden)]` in
libstd/task/spawn.rs and libstd/task/rt.rs since those two are
apparently `pub`, as well as in libextra/std.rc since std/extra is
`pub`.
2013-05-27 11:41:08 -07:00
Seo Sanghyeon
8f80323f09 Remove unnecessary allocations flagged by lint 2013-05-28 03:14:44 +09:00
Seo Sanghyeon
363e672736 Use adjustments table for allocation lint 2013-05-28 03:12:13 +09:00
Lindsey Kuper
beec6e4b21 Get rid of no-longer-needed #[doc(hidden)] attributes.
There were several old `#[doc(hidden)]` attributes in libstd and
libextra, left over from when rustdoc didn't hide private
definitions, tagged with `FIXME #3538`.

Since #3538 is now closed, I removed the `#[doc(hidden)]` attributes
as well as the FIXMEs, but I left `#[doc(hidden)]` in
libstd/task/spawn.rs and libstd/task/rt.rs since those two are
apparently `pub`, as well as in libextra/std.rc since std/extra is
`pub`.
2013-05-27 13:29:48 -04:00
Daniel Farina
c6f3577f72 Increment copyright year of time.rs 2013-05-27 10:02:48 -07:00
Daniel Farina
379460558b Use passing by-value in gmtime, mktime
Per the recommendation of the now-removed FIXME.
2013-05-27 10:02:48 -07:00
bors
3941f78a1b auto merge of #6763 : steveklabnik/rust/core_to_std, r=thestinger
When I submitted #6748 yesterday, I used the old name.

r? @thestinger
2013-05-27 07:08:04 -07:00
Steve Klabnik
e2fcb92a6d Fix docs to use std instead of core.
When I submitted #6748 yesterday, I used the old name.
2013-05-27 08:19:57 -05:00