Commit Graph

32265 Commits

Author SHA1 Message Date
bors
d8a26184dc auto merge of #17011 : nodakai/rust/rustdoc-stronger-crate, r=alexcrichton
If you browse to, say, http://doc.rust-lang.org/libc/types/os/common/posix01/struct.timeval.html , you will see the "location" window showing `libc::types::os::common::posix01`.  The first element points to a crate and others point modules.  This patch adds the bold attribute to the first (ie. crate) element so that it stands out more.
2014-09-06 17:51:24 +00:00
Daniel Micay
5aa2da0133 fix sized deallocation for proc 2014-09-06 13:50:58 -04:00
Daniel Micay
395e453c06 fix a sized deallocation issue in the glue code 2014-09-06 13:50:58 -04:00
Peter Atashian
d3ec0674bb readdir: return error instead of failing on invalid UTF-16
Fixes #15279

Signed-off-by: Peter Atashian <retep998@gmail.com>
2014-09-06 12:51:42 -04:00
bors
6eabd85265 auto merge of #17003 : nick29581/rust/impl, r=pcwalton
closes #16955 

r? @pcwalton
2014-09-06 14:51:26 +00:00
bors
9f2ba967a0 auto merge of #17002 : tari/rust/std-mut-ref-slice, r=alexcrichton
`std::slice` exported `ref_slice` but not `mut_ref_slice`. This change makes it export both.
2014-09-06 13:06:27 +00:00
Piotr Czarnecki
808e039d40 Fix ICE with trans of calls to foreign fns
It was failing occasionally.
2014-09-06 12:31:05 +01:00
Piotr Czarnecki
10935de0cd rustc: Refactor middle::trans::inline 2014-09-06 12:31:05 +01:00
bors
a356e98803 auto merge of #16997 : gamazeps/rust/master, r=huonw
Changed the names according to the issue #16988
2014-09-06 10:31:29 +00:00
bors
20c0ba1279 auto merge of #16907 : SimonSapin/rust/tempdir-result, r=huonw
This allows using `try!()`

[breaking-change]

Fixes #16875
2014-09-06 08:01:33 +00:00
bors
4bea7b3ed0 auto merge of #16367 : epdtry/rust/parallel-codegen, r=alexcrichton
This branch adds support for running LLVM optimization and codegen on different parts of a crate in parallel.  Instead of translating the crate into a single LLVM compilation unit, `rustc` now distributes items in the crate among several compilation units, and spawns worker threads to optimize and codegen each compilation unit independently.  This improves compile times on multicore machines, at the cost of worse performance in the compiled code.  The intent is to speed up build times during development without sacrificing too much optimization.

On the machine I tested this on, `librustc` build time with `-O` went from 265 seconds (master branch, single-threaded) to 115s (this branch, with 4 threads), a speedup of 2.3x.  For comparison, the build time without `-O` was 90s (single-threaded).  Bootstrapping `rustc` using 4 threads gets a 1.6x speedup over the default settings (870s vs. 1380s), and building `librustc` with the resulting stage2 compiler takes 1.3x as long as the master branch (44s vs.  55s, single threaded, ignoring time spent in LLVM codegen).

The user-visible changes from this branch are two new codegen flags:

 * `-C codegen-units=N`: Distribute items across `N` compilation units.
 * `-C codegen-threads=N`: Spawn `N` worker threads for running optimization and codegen.  (It is possible to set `codegen-threads` larger than `codegen-units`, but this is not very useful.)

Internal changes to the compiler are described in detail on the individual commit messages.

Note: The first commit on this branch is copied from #16359, which this branch depends on.

r? @nick29581
2014-09-06 06:06:35 +00:00
bors
da1395b6cb auto merge of #17039 : vadimcn/rust/test_lots_of_files, r=alexcrichton 2014-09-06 03:31:34 +00:00
Vadim Chugunov
6a7e6017c5 Disable test_lots_of_files on Windows 2014-09-05 19:55:25 -07:00
Huon Wilson
9151874f40 Use more jQuery to avoid displaying Expand Description more often.
Sometimes (e.g. on Rust CI) the "expand description" text of the
collapse toggle was displayed by default, when a page is first
loaded (even though the description is expanded), because some
Content-Security-Policy settings disable inline CSS.

Setting it the style with the `.css` method allows the output to be used
in more places.
2014-09-06 11:04:39 +10:00
jamesluke
4755441fd4 Fix documentation typo. 2014-09-05 16:03:58 -07:00
Stuart Pernsteiner
6d2d47b2fc don't use ld -r with -C codegen-units=1 2014-09-05 14:30:36 -07:00
Brian Anderson
7e12e67936 Optimize Slice::reverse
This makes the completely safe implementation of fannkuchredux perform
the same as C++. Yay, Rust.
2014-09-05 14:12:20 -07:00
Robert Gawdzik ☢
5eea93af39 Fixes type range issue during linting (#16684)
- Ensures the propagated negation sign is properly utilized during type
   checking.
 - Removed redundant type checking, specifically regarding the out of bounds checking
   on a bounded type.
 - Closes #16684
2014-09-05 14:59:39 -04:00
bors
82c052794d auto merge of #16628 : pczarn/rust/hashmap-opt, r=nikomatsakis
This is #15720, rebased and reopened.

cc @nikomatsakis
2014-09-05 17:36:25 +00:00
Stuart Pernsteiner
4d9a478616 add workaround for mingw ld --force-exe-suffix behavior 2014-09-05 09:18:57 -07:00
Stuart Pernsteiner
1b676fb760 don't leave unwanted temporary files with --emit=ir/asm 2014-09-05 09:18:57 -07:00
Stuart Pernsteiner
b5a0b700c6 use target-specific linker args when combining compilation units 2014-09-05 09:18:57 -07:00
Stuart Pernsteiner
4b70269854 add tests for separate compilation 2014-09-05 09:18:57 -07:00
Stuart Pernsteiner
73f8adcbc8 make separate compilation respect #[inline] attributes
Adjust the handling of `#[inline]` items so that they get translated into every
compilation unit that uses them.  This is necessary to preserve the semantics
of `#[inline(always)]`.

Crate-local `#[inline]` functions and statics are blindly translated into every
compilation unit.  Cross-crate inlined items and monomorphizations of
`#[inline]` functions are translated the first time a reference is seen in each
compilation unit.  When using multiple compilation units, inlined items are
given `available_externally` linkage whenever possible to avoid duplicating
object code.
2014-09-05 09:18:57 -07:00
Stuart Pernsteiner
edc5cdcba2 make symbols internal when possible
Add a post-processing pass to `trans` that converts symbols from external to
internal when possible.  Translation with multiple compilation units initially
makes most symbols external, since it is not clear when translating a
definition whether that symbol will need to be accessed from another
compilation unit.  This final pass internalizes symbols that are not reachable
from other crates and not referenced from other compilation units, so that LLVM
can perform more aggressive optimizations on those symbols.
2014-09-05 09:18:57 -07:00
Stuart Pernsteiner
e09bef810a avoid duplicate translation of monomorphizations, drop glue, and visit glue
Use a shared lookup table of previously-translated monomorphizations/glue
functions to avoid translating those functions in every compilation unit where
they're used.  Instead, the function will be translated in whichever
compilation unit uses it first, and the remaining compilation units will link
against that original definition.
2014-09-05 09:18:57 -07:00
Stuart Pernsteiner
da9606247d translate into multiple llvm contexts
Rotate between compilation units while translating.  The "worker threads"
commit added support for multiple compilation units, but only translated into
one, leaving the rest empty.  With this commit, `trans` rotates between various
compilation units while translating, using a simple stragtegy: upon entering a
module, switch to translating into whichever compilation unit currently
contains the fewest LLVM instructions.

Most of the actual changes here involve getting symbol linkage right, so that
items translated into different compilation units will link together properly
at the end.
2014-09-05 09:18:57 -07:00
Stuart Pernsteiner
2e7bc0f808 reuse original symbols for inlined items
When inlining an item from another crate, use the original symbol from that
crate's metadata instead of generating a new symbol using the `ast::NodeId` of
the inlined copy.  This requires exporting symbols in the crate metadata in a
few additional cases.  Having predictable symbols for inlined items will be
useful later to avoid generating duplicate object code for inlined items.
2014-09-05 09:18:57 -07:00
Stuart Pernsteiner
cf672850df run optimization and codegen on worker threads
Refactor the code in `llvm::back` that invokes LLVM optimization and codegen
passes so that it can be called from worker threads.  (Previously, it used
`&Session` extensively, and `Session` is not `Share`.)  The new code can handle
multiple compilation units, by compiling each unit to `crate.0.o`, `crate.1.o`,
etc., and linking together all the `crate.N.o` files into a single `crate.o`
using `ld -r`.  The later linking steps can then be run unchanged.

The new code preserves the behavior of `--emit`/`-o` when building a single
compilation unit.  With multiple compilation units, the `--emit=asm/ir/bc`
options produce multiple files, so combinations like `--emit=ir -o foo.ll` will
not actually produce `foo.ll` (they instead produce several `foo.N.ll` files).

The new code supports `-Z lto` only when using a single compilation unit.
Compiling with multiple compilation units and `-Z lto` will produce an error.
(I can't think of any good reason to do such a thing.)  Linking with `-Z lto`
against a library that was built as multiple compilation units will also fail,
because the rlib does not contain a `crate.bytecode.deflate` file.  This could
be supported in the future by linking together the `crate.N.bc` files produced
when compiling the library into a single `crate.bc`, or by making the LTO code
support multiple `crate.N.bytecode.deflate` files.
2014-09-05 09:18:55 -07:00
Stuart Pernsteiner
e29aa1430b move back:🔗:write into a separate file 2014-09-05 09:18:55 -07:00
Stuart Pernsteiner
0ab27b1d5b split CrateContext into shared and local pieces
Break up `CrateContext` into `SharedCrateContext` and `LocalCrateContext`.  The
local piece corresponds to a single compilation unit, and contains all
LLVM-related components.  (LLVM data structures are tied to a specific
`LLVMContext`, and we will need separate `LLVMContext`s to safely run
multithreaded optimization.)  The shared piece contains data structures that
need to be shared across all compilation units, such as the `ty::ctxt` and some
tables related to crate metadata.
2014-09-05 09:18:55 -07:00
Stuart Pernsteiner
cf35cb365a make CrateContext fields private 2014-09-05 09:18:53 -07:00
bors
074d3da7b0 auto merge of #16775 : jbcrail/rust/fix-rational-docs, r=pcwalton
Minor corrections to Rational documentation.
2014-09-05 15:46:29 +00:00
Steve Klabnik
d929d83eec don't say compromise
@dherman doesn't like it 😄
2014-09-05 06:38:53 -04:00
Steve Klabnik
12d66e6ac3 Fix formatting in the guide.
Thanks @dherman.
2014-09-05 06:37:22 -04:00
Steve Klabnik
1b9c5e69ba Remove unused diagnostic codes.
Fixes #16449.
2014-09-05 06:08:19 -04:00
NODA, Kai
9e82fc7ef9 rustdoc/html: emphasize the crate part of the full path. 2014-09-05 13:53:22 +08:00
Brendan Zabarauskas
88bd646be0 Make integer bit count methods return uints
Fixes rust-lang/rfcs#224
2014-09-05 14:01:41 +10:00
bors
67b97ab6d2 auto merge of #16843 : bkoropoff/rust/reader-writer-box, r=alexcrichton
Cargo needs this to be able to instantiate `TerminfoTerminal<Box<Writer+'a>>` for 'a other than 'static.
2014-09-05 03:31:07 +00:00
Nick Cameron
2df3a5b0d1 Check concrete type in impls with no trait
closes #16955
2014-09-05 14:38:37 +12:00
Brian Anderson
fc3b6383ba Update fannkuchredux benchmark
From the discussion on reddit:
http://www.reddit.com/r/rust/comments/2fenlg/benchmark_improvement_fannkuchredux/

This adds two variants: the primary, that uses an unsafe block, and a secondary
that is completely safe.

The one with the unsafe block matches clang's performance and beats gcc's.
2014-09-04 18:49:59 -07:00
bors
5248b1187d auto merge of #16990 : DiamondLovesYou/rust/level-derive-clone, r=alexcrichton 2014-09-05 01:21:03 +00:00
Piotr Czarnecki
0ad4644ae1 Work around inability to link lifetime of ref bindings (#16994) 2014-09-05 01:24:04 +01:00
Felix Raimundo
d0f1c7dfb0 Update language item from 'share' to 'sync' #16988 2014-09-05 02:03:26 +02:00
Peter Marheine
0b53cc54e1 collections/slice: Reexport mut_ref_slice in addition to ref_slice. 2014-09-04 17:22:58 -06:00
Piotr Czarnecki
27f87c611f std: Fix overflow of HashMap's capacity 2014-09-04 23:22:32 +01:00
Piotr Czarnecki
ae7342a56a std: Refine and document HashMap's code
* branchless `bucket.next()`
* robin_hood is a free function
* fixed the resize policy that was off by one
* documented the growth algorithm
* updated documentation after interface changes
* removed old fixmes
2014-09-04 23:22:32 +01:00
bors
e024017f60 auto merge of #16986 : bjz/rust/bitflags, r=alexcrichton
Closes #16469
2014-09-04 20:21:02 +00:00
Richard Diamond
0dadd3c3ad Auto-derive Clone for syntax::diagnostic::Level. 2014-09-04 13:31:00 -05:00
bors
d3e7922ddd auto merge of #16982 : jbcrail/rust/comment-and-string-corrections, r=alexcrichton
I corrected spelling and capitalization errors in comments and strings.
2014-09-04 18:30:59 +00:00