summary refs log tree commit diff
path: root/src/librustc_back
AgeCommit message (Collapse)AuthorLines
2015-09-14Auto merge of #28256 - petrochenkov:conv, r=alexcrichtonbors-1/+5
This patch transforms functions of the form ``` fn f<Generic: AsRef<Concrete>>(arg: Generic) { let arg: &Concrete = arg.as_ref(); // Code using arg } ``` to the next form: ``` #[inline] fn f<Generic: AsRef<Concrete>>(arg: Generic) { fn f_inner(arg: &Concrete) { // Code using arg } f_inner(arg.as_ref()); } ``` Therefore, most of the code is concrete and not duplicated during monomorphisation (unless inlined) and only the tiny bit of conversion code is duplicated. This method was mentioned by @aturon in the Conversion Traits RFC (https://github.com/rust-lang/rfcs/blame/master/text/0529-conversion-traits.md#L249) and similar techniques are not uncommon in C++ template libraries. This patch goes to the extremes and applies the transformation even to smaller functions<sup>1</sup> for purity of the experiment. *Some of them can be rolled back* if considered too ridiculous. <sup>1</sup> However who knows how small are these functions are after inlining and everything. The functions in question are mostly `fs`/`os` functions and not used especially often with variety of argument types, so the code size reduction is rather small (but consistent). Here are the sizes of stage2 artifacts before and after the patch: https://gist.github.com/petrochenkov/e76a6b280f382da13c5d https://gist.github.com/petrochenkov/6cc28727d5256dbdfed0 Note: All the `inner` functions are concrete and unavailable for cross-crate inlining, some of them may need `#[inline]` annotations in the future. r? @aturon
2015-09-10Auto merge of #28282 - DiamondLovesYou:optional-data-layout, r=alexcrichtonbors-3/+11
NFC.
2015-09-09Refactor `TargetOptions::data_layout` into an `Option`al value to reflect ↵Richard Diamond-3/+11
current usage. NFC.
2015-09-09Reduce code bloat from conversion traits in function parametersVadim Petrochenkov-1/+5
2015-09-05DragonFly: Remove -L paths from pre_link_args.Michael Neumann-2/+0
Having -L/usr/local/lib in the linking path by default interferes with an already installed version of Rust during building of Rust.
2015-09-03Use proper span for break and continue labelsSimonas Kazlauskas-2/+2
Fixes #28109
2015-09-03Add an intital HIR and lowering stepNick Cameron-61/+15
2015-08-30fixes #27124 for DragonFlyMichael Neumann-1/+1
2015-08-25Auto merge of #27957 - overminder:aug23-i686-android, r=alexcrichtonbors-0/+27
- All the libstd tests are passing in the optimized build against a Zenfone2 and the x86 Android emulator. I haven't tested the other libraries though.
2015-08-23i686-linux-android: set -mcpu to pentium4.Overmind JIANG-1/+4
To allow SSE2 to be used.
2015-08-23Auto merge of #27927 - DiamondLovesYou:no-asm, r=alexcrichtonbors-0/+4
2015-08-23New cross target: i686-linux-androidTim JIANG-0/+24
- All the libstd tests are now passing in the optimized build against a Zenfone2 and the x86 Android simulator.
2015-08-21Add a `allow_asm` option so virtual ISA based targets (JS/PNaCl/WAsm) can ↵Richard Diamond-0/+4
disallow the asm! macro.
2015-08-19rustc_back: add configure options for default linker and arMarc-Antoine Perennou-2/+2
Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com>
2015-08-15Add issue for the rustc_private feature everywhereAlex Crichton-1/+1
2015-08-15Auto merge of #27839 - gkoz:netbsd_ar, r=brsonbors-1/+1
NetBSD didn't get its fix for #27124 and still suffers from that issue.
2015-08-14rustc: Allow changing the default allocatorAlex Crichton-0/+22
This commit is an implementation of [RFC 1183][rfc] which allows swapping out the default allocator on nightly Rust. No new stable surface area should be added as a part of this commit. [rfc]: https://github.com/rust-lang/rfcs/pull/1183 Two new attributes have been added to the compiler: * `#![needs_allocator]` - this is used by liballoc (and likely only liballoc) to indicate that it requires an allocator crate to be in scope. * `#![allocator]` - this is a indicator that the crate is an allocator which can satisfy the `needs_allocator` attribute above. The ABI of the allocator crate is defined to be a set of symbols that implement the standard Rust allocation/deallocation functions. The symbols are not currently checked for exhaustiveness or typechecked. There are also a number of restrictions on these crates: * An allocator crate cannot transitively depend on a crate that is flagged as needing an allocator (e.g. allocator crates can't depend on liballoc). * There can only be one explicitly linked allocator in a final image. * If no allocator is explicitly requested one will be injected on behalf of the compiler. Binaries and Rust dylibs will use jemalloc by default where available and staticlibs/other dylibs will use the system allocator by default. Two allocators are provided by the distribution by default, `alloc_system` and `alloc_jemalloc` which operate as advertised. Closes #27389
2015-08-14fixes #27124 for netbsdGleb Kozyrev-1/+1
NetBSD didn't get its fix for #27124 and still suffers from that issue.
2015-08-12Remove all unstable deprecated functionalityAlex Crichton-1/+0
This commit removes all unstable and deprecated functions in the standard library. A release was recently cut (1.3) which makes this a good time for some spring cleaning of the deprecated functions.
2015-08-11rollup merge of #27676: alexcrichton/msvc-unwindAlex Crichton-0/+1
This commit leverages the runtime support for DWARF exception info added in #27210 to enable unwinding by default on 64-bit MSVC. This also additionally adds a few minor fixes here and there in the test harness and such to get `make check` entirely passing on 64-bit MSVC: * The invocation of `maketest.py` now works with spaces/quotes in CC * debuginfo tests are disabled on MSVC * A link error for librustc was hacked around (see #27438)
2015-08-11rollup merge of #27672: eefriedman/ios-target-cpuAlex Crichton-2/+2
This matches the behavior of clang. See also discussion on #27307.
2015-08-11rollup merge of #27622: eefriedman/https-urlAlex Crichton-2/+2
Also fixes a few outdated links.
2015-08-11trans: Re-enable unwinding on 64-bit MSVCAlex Crichton-0/+1
This commit leverages the runtime support for DWARF exception info added in #27210 to enable unwinding by default on 64-bit MSVC. This also additionally adds a few minor fixes here and there in the test harness and such to get `make check` entirely passing on 64-bit MSVC: * The invocation of `maketest.py` now works with spaces/quotes in CC * debuginfo tests are disabled on MSVC * A link error for librustc was hacked around (see #27438)
2015-08-11Use correct target CPU for iOS simulator.Eli Friedman-2/+2
This matches the behavior of clang.
2015-08-11Rollup merge of #27647 - rust-lang:issue-27646, r=alexcrichtonManish Goregaokar-1/+1
This is in line with other targets. Closes #27646
2015-08-11Auto merge of #27518 - alexcrichton:msvc-builtin-llvm-ar, r=huonwbors-0/+1
This means that we no longer need to ship the `llvm-ar.exe` binary in the MSVC distribution, and after a snapshot we can remove a good bit of logic from the makefiles!
2015-08-10trans: Specify `archive_format` for MSVCAlex Crichton-0/+1
This means that we no longer need to ship the `llvm-ar.exe` binary in the MSVC distribution, and after a snapshot we can remove a good bit of logic from the makefiles!
2015-08-10Remove morestack supportAlex Crichton-23/+0
This commit removes all morestack support from the compiler which entails: * Segmented stacks are no longer emitted in codegen. * We no longer build or distribute libmorestack.a * The `stack_exhausted` lang item is no longer required The only current use of the segmented stack support in LLVM is to detect stack overflow. This is no longer really required, however, because we already have guard pages for all threads and registered signal handlers watching for a segfault on those pages (to print out a stack overflow message). Additionally, major platforms (aka Windows) already don't use morestack. This means that Rust is by default less likely to catch stack overflows because if a function takes up more than one page of stack space it won't hit the guard page. This is what the purpose of morestack was (to catch this case), but it's better served with stack probes which have more cross platform support and no runtime support necessary. Until LLVM supports this for all platform it looks like morestack isn't really buying us much. cc #16012 (still need stack probes) Closes #26458 (a drive-by fix to help diagnostics on stack overflow)
2015-08-10Use pentium4 for base CPU on i686-pc-windows-msvcElaine "See More" Nemo-1/+1
This is in line with other targets. Closes #27646
2015-08-09Use https URLs to refer to rust-lang.org where appropriate.Eli Friedman-2/+2
Also fixes a few outdated links.
2015-07-30Implement Win64 eh_personality natively.Vadim Chugunov-0/+7
2015-07-28remove `get_ident` and `get_name`, make `as_str` soundOliver Schneider-19/+9
2015-07-24Rollup merge of #27137 - dhuseby:fixing_bitrig_linking, r=alexcrichtonSteve Klabnik-3/+1
fixes the linking error on bitrig.
2015-07-23switching to gnu archive formatDave Huseby-1/+1
2015-07-23fixes #27124 for freebsdDave Huseby-1/+1
2015-07-23switching to gnu archive format per review requestDave Huseby-0/+1
2015-07-23review feedback fixesDave Huseby-1/+0
2015-07-23fixes #27124 for bitrigDave Huseby-3/+1
2015-07-20fixes #27124 for openbsdSébastien Marie-1/+1
the "bsd" archive_format don't work under openbsd. use of "" (system ar) is ok. use of "gnu" is ok too.
2015-07-16trans: Clean up handling the LLVM data layoutAlex Crichton-457/+4
Turns out for OSX our data layout was subtly wrong and the LLVM update must have exposed this. Instead of fixing this I've removed all data layouts from the compiler to just use the defaults that LLVM provides for all targets. All data layouts (and a number of dead modules) are removed from the compiler here. Custom target specifications can still provide a custom data layout, but it is now an optional key as the default will be used if one isn't specified.
2015-07-16trans: Add kind to writeArchiveAlex Crichton-0/+6
Updates our LLVM bindings to be able to write out multiple kinds of archives. This commit also enables using LLVM instead of the system ar on all current targets.
2015-07-11adding support for i686-unknown-freebsd targetDave Huseby-0/+30
2015-07-10Auto merge of #26926 - alexcrichton:llvm-archive-writer, r=brsonbors-362/+8
We have previously always relied upon an external tool, `ar`, to modify archives that the compiler produces (staticlibs, rlibs, etc). This approach, however, has a number of downsides: * Spawning a process is relatively expensive for small compilations * Encoding arguments across process boundaries often incurs unnecessary overhead or lossiness. For example `ar` has a tough time dealing with files that have the same name in archives, and the compiler copies many files around to ensure they can be passed to `ar` in a reasonable fashion. * Most `ar` programs found do **not** have the ability to target arbitrary platforms, so this is an extra tool which needs to be found/specified when cross compiling. The LLVM project has had a tool called `llvm-ar` for quite some time now, but it wasn't available in the standard LLVM libraries (it was just a standalone program). Recently, however, in LLVM 3.7, this functionality has been moved to a library and is now accessible by consumers of LLVM via the `writeArchive` function. This commit migrates our archive bindings to no longer invoke `ar` by default but instead make a library call to LLVM to do various operations. This solves all of the downsides listed above: * Archive management is now much faster, for example creating a "hello world" staticlib is now 6x faster (50ms => 8ms). Linking dynamic libraries also recently started requiring modification of rlibs, and linking a hello world dynamic library is now 2x faster. * The compiler is now one step closer to "hassle free" cross compilation because no external tool is needed for managing archives, LLVM does the right thing! This commit does not remove support for calling a system `ar` utility currently. We will continue to maintain compatibility with LLVM 3.5 and 3.6 looking forward (so the system LLVM can be used wherever possible), and in these cases we must shell out to a system utility. All nightly builds of Rust, however, will stop needing a system `ar`.
2015-07-10trans: Use LLVM's writeArchive to modify archivesAlex Crichton-362/+8
We have previously always relied upon an external tool, `ar`, to modify archives that the compiler produces (staticlibs, rlibs, etc). This approach, however, has a number of downsides: * Spawning a process is relatively expensive for small compilations * Encoding arguments across process boundaries often incurs unnecessary overhead or lossiness. For example `ar` has a tough time dealing with files that have the same name in archives, and the compiler copies many files around to ensure they can be passed to `ar` in a reasonable fashion. * Most `ar` programs found do **not** have the ability to target arbitrary platforms, so this is an extra tool which needs to be found/specified when cross compiling. The LLVM project has had a tool called `llvm-ar` for quite some time now, but it wasn't available in the standard LLVM libraries (it was just a standalone program). Recently, however, in LLVM 3.7, this functionality has been moved to a library and is now accessible by consumers of LLVM via the `writeArchive` function. This commit migrates our archive bindings to no longer invoke `ar` by default but instead make a library call to LLVM to do various operations. This solves all of the downsides listed above: * Archive management is now much faster, for example creating a "hello world" staticlib is now 6x faster (50ms => 8ms). Linking dynamic libraries also recently started requiring modification of rlibs, and linking a hello world dynamic library is now 2x faster. * The compiler is now one step closer to "hassle free" cross compilation because no external tool is needed for managing archives, LLVM does the right thing! This commit does not remove support for calling a system `ar` utility currently. We will continue to maintain compatibility with LLVM 3.5 and 3.6 looking forward (so the system LLVM can be used wherever possible), and in these cases we must shell out to a system utility. All nightly builds of Rust, however, will stop needing a system `ar`.
2015-07-09Use vec![elt; n] where possibleUlrik Sverdrup-4/+2
The common pattern `iter::repeat(elt).take(n).collect::<Vec<_>>()` is exactly equivalent to `vec![elt; n]`, do this replacement in the whole tree. (Actually, vec![] is smart enough to only call clone n - 1 times, while the former solution would call clone n times, and this fact is virtually irrelevant in practice.)
2015-07-01Add netbsd amd64 supportAlex Newman-5/+68
2015-06-27rustc_back: Learn about i686-pc-windows-msvcAlex Crichton-1/+29
This commit adds the i686-pc-windows-msvc triple to the compiler's repertoire of triples to prepare for targeting 32-bit MSVC.
2015-06-21rustc_trans: Use custom PATH for archive commandsAlex Crichton-1/+4
This commit ensures that the modifications made in #26382 also apply to the archive commands run in addition to the linker commands.
2015-06-17collections: Split the `collections` featureAlex Crichton-1/+1
This commit also deprecates the `as_string` and `as_slice` free functions in the `string` and `vec` modules.
2015-06-17core: Split apart the global `core` featureAlex Crichton-5/+5
This commit shards the broad `core` feature of the libcore library into finer grained features. This split groups together similar APIs and enables tracking each API separately, giving a better sense of where each feature is within the stabilization process. A few minor APIs were deprecated along the way: * Iterator::reverse_in_place * marker::NoCopy