summary refs log tree commit diff
path: root/src/librustc/lib
AgeCommit message (Collapse)AuthorLines
2014-01-03auto merge of #11262 : alexcrichton/rust/issue-11259, r=pcwaltonbors-1/+1
Closes #11259
2014-01-02auto merge of #11274 : michaelwoerister/rust/issue11083, r=pcwaltonbors-1/+2
This pull request fixes #11083. The problem was that recursive type definitions were not properly handled for enum types, leading to problems with LLVM's metadata "uniquing". This bug has already been fixed for struct types some time ago (#9658) but I seem to have forgotten about enums back then. I added the offending code from issue #11083 as a test case.
2014-01-02debuginfo: Fix issue #11083 and some minor clean up.Michael Woerister-1/+2
2014-01-01Fix usage of rustc --ls on invalid filesAlex Crichton-1/+1
Closes #11259
2013-12-31auto merge of #11187 : alexcrichton/rust/once, r=brsonbors-2/+3
Rationale can be found in the first commit, but this is basically the same thing as `pthread_once`
2013-12-31Convert relevant static mutexes to OnceAlex Crichton-2/+3
2013-12-31Implement volatile_load and volatile_store intrinsics.Peter Zotov-0/+4
2013-12-26librustc: De-`&mut` `TypeNames`Patrick Walton-5/+8
2013-12-26librustc: Remove unused `TypeNames::type_names` tablePatrick Walton-3/+0
2013-12-26librustc: Remove unused `TypeNames::find_name` functionPatrick Walton-7/+0
2013-12-24Stop using C++ exceptions for stack unwinding.Vadim Chugunov-1/+0
2013-12-19rustc: Optimize reading metadata by 4xAlex Crichton-1/+8
We were previously reading metadata via `ar p`, but as learned from rustdoc awhile back, spawning a process to do something is pretty slow. Turns out LLVM has an Archive class to read archives, but it cannot write archives. This commits adds bindings to the read-only version of the LLVM archive class (with a new type that only has a read() method), and then it uses this class when reading the metadata out of rlibs. When you put this in tandem of not compressing the metadata, reading the metadata is 4x faster than it used to be The timings I got for reading metadata from the respective libraries was: libstd-04ff901e-0.9-pre.dylib => 100ms libstd-04ff901e-0.9-pre.rlib => 23ms librustuv-7945354c-0.9-pre.dylib => 4ms librustuv-7945354c-0.9-pre.rlib => 1ms librustc-5b94a16f-0.9-pre.dylib => 87ms librustc-5b94a16f-0.9-pre.rlib => 35ms libextra-a6ebb16f-0.9-pre.dylib => 63ms libextra-a6ebb16f-0.9-pre.rlib => 15ms libsyntax-2e4c0458-0.9-pre.dylib => 86ms libsyntax-2e4c0458-0.9-pre.rlib => 22ms In order to always take advantage of these faster metadata read-times, I sort the files in filesearch based on whether they have an rlib extension or not (prefer all rlib files first). Overall, this halved the compile time for a `fn main() {}` crate from 0.185s to 0.095s on my system (when preferring dynamic linking). Reading metadata is still the slowest pass of the compiler at 0.035s, but it's getting pretty close to linking at 0.021s! The next best optimization is to just not copy the metadata from LLVM because that's the most expensive part of reading metadata right now.
2013-12-11Disable all unwinding on -Z no-landing-pads LTOAlex Crichton-0/+1
When performing LTO, the rust compiler has an opportunity to completely strip all landing pads in all dependent libraries. I've modified the LTO pass to recognize the -Z no-landing-pads option when also running an LTO pass to flag everything in LLVM as nothrow. I've verified that this prevents any and all invoke instructions from being emitted. I believe that this is one of our best options for moving forward with accomodating use-cases where unwinding doesn't really make sense. This will allow libraries to be built with landing pads by default but allow usage of them in contexts where landing pads aren't necessary. cc #10780
2013-12-09Implement LTOAlex Crichton-0/+11
This commit implements LTO for rust leveraging LLVM's passes. What this means is: * When compiling an rlib, in addition to insdering foo.o into the archive, also insert foo.bc (the LLVM bytecode) of the optimized module. * When the compiler detects the -Z lto option, it will attempt to perform LTO on a staticlib or binary output. The compiler will emit an error if a dylib or rlib output is being generated. * The actual act of performing LTO is as follows: 1. Force all upstream libraries to have an rlib version available. 2. Load the bytecode of each upstream library from the rlib. 3. Link all this bytecode into the current LLVM module (just using llvm apis) 4. Run an internalization pass which internalizes all symbols except those found reachable for the local crate of compilation. 5. Run the LLVM LTO pass manager over this entire module 6a. If assembling an archive, then add all upstream rlibs into the output archive. This ignores all of the object/bitcode/metadata files rust generated and placed inside the rlibs. 6b. If linking a binary, create copies of all upstream rlibs, remove the rust-generated object-file, and then link everything as usual. As I have explained in #10741, this process is excruciatingly slow, so this is *not* turned on by default, and it is also why I have decided to hide it behind a -Z flag for now. The good news is that the binary sizes are about as small as they can be as a result of LTO, so it's definitely working. Closes #10741 Closes #10740
2013-12-06Link rustllvm statically, and distribute a static snapshotAlex Crichton-1/+12
In order to keep up to date with changes to the libraries that `llvm-config` spits out, the dependencies to the LLVM are a dynamically generated rust file. This file is now automatically updated whenever LLVM is updated to get kept up-to-date. At the same time, this cleans out some old cruft which isn't necessary in the makefiles in terms of dependencies. Closes #10745 Closes #10744
2013-12-05Update LLVM and jettison jit supportAlex Crichton-12/+0
LLVM's JIT has been updated numerous times, and we haven't been tracking it at all. The existing LLVM glue code no longer compiles, and the JIT isn't used for anything currently. This also rebases out the FixedStackSegment support which we have added to LLVM. None of this is still in use by the compiler, and there's no need to keep this functionality around inside of LLVM. This is needed to unblock #10708 (where we're tripping an LLVM assertion).
2013-12-03Register new snapshotsAlex Crichton-6/+0
2013-11-29Add generation of static libraries to rustcAlex Crichton-27/+37
This commit implements the support necessary for generating both intermediate and result static rust libraries. This is an implementation of my thoughts in https://mail.mozilla.org/pipermail/rust-dev/2013-November/006686.html. When compiling a library, we still retain the "lib" option, although now there are "rlib", "staticlib", and "dylib" as options for crate_type (and these are stackable). The idea of "lib" is to generate the "compiler default" instead of having too choose (although all are interchangeable). For now I have left the "complier default" to be a dynamic library for size reasons. Of the rust libraries, lib{std,extra,rustuv} will bootstrap with an rlib/dylib pair, but lib{rustc,syntax,rustdoc,rustpkg} will only be built as a dynamic object. I chose this for size reasons, but also because you're probably not going to be embedding the rustc compiler anywhere any time soon. Other than the options outlined above, there are a few defaults/preferences that are now opinionated in the compiler: * If both a .dylib and .rlib are found for a rust library, the compiler will prefer the .rlib variant. This is overridable via the -Z prefer-dynamic option * If generating a "lib", the compiler will generate a dynamic library. This is overridable by explicitly saying what flavor you'd like (rlib, staticlib, dylib). * If no options are passed to the command line, and no crate_type is found in the destination crate, then an executable is generated With this change, you can successfully build a rust program with 0 dynamic dependencies on rust libraries. There is still a dynamic dependency on librustrt, but I plan on removing that in a subsequent commit. This change includes no tests just yet. Our current testing infrastructure/harnesses aren't very amenable to doing flavorful things with linking, so I'm planning on adding a new mode of testing which I believe belongs as a separate commit. Closes #552
2013-11-28Register new snapshotsAlex Crichton-37/+0
2013-11-27auto merge of #10684 : jld/rust/unstruct-unhack-typekind, r=alexcrichtonbors-0/+40
2013-11-26Remove enum struct return workaround from LLVM bindings.Jed Davis-0/+40
2013-11-26auto merge of #10312 : thestinger/rust/thread_local, r=alexcritchtonbors-0/+6
This provides a building block for fast thread-local storage. It does not change the safety semantics of `static mut`. Closes #10310
2013-11-26add `#[thread_local]` attributeDaniel Micay-0/+6
This provides a building block for fast thread-local storage. It does not change the safety semantics of `static mut`. Closes #10310
2013-11-26librustc: Remove non-procedure uses of `do` from librustc, librustdoc,Patrick Walton-2/+2
and librustpkg.
2013-11-18Add Win64 calling convention.Eric Holk-0/+1
2013-11-11Remove #[fixed_stack_segment] and #[rust_stack]Alex Crichton-3/+0
These two attributes are no longer useful now that Rust has decided to leave segmented stacks behind. It is assumed that the rust task's stack is always large enough to make an FFI call (due to the stack being very large). There's always the case of stack overflow, however, to consider. This does not change the behavior of stack overflow in Rust. This is still normally triggered by the __morestack function and aborts the whole process. C stack overflow will continue to corrupt the stack, however (as it did before this commit as well). The future improvement of a guard page at the end of every rust stack is still unimplemented and is intended to be the mechanism through which we attempt to detect C stack overflow. Closes #8822 Closes #10155
2013-11-04libsyntax/librustc: Allow calling variadic foreign functions.Luqman Aden-0/+1
2013-11-02Statically link libuv to librustuvAlex Crichton-2/+1
Similarly to the previous commit, libuv is only used by this library, so there's no need for it to be linked into librustrt and available to all crates by default.
2013-10-29Add repr attributes in various places that need them.Jed Davis-0/+6
2013-10-28add support for the `cold` function attributeDaniel Micay-0/+2
This allows a function to marked as infrequently called, resulting in any branch calling it to be considered colder.
2013-10-14Removing ccdeclSteve Klabnik-1/+1
as per https://github.com/mozilla/rust/pull/9606#discussion_r6930872
2013-10-14Remove unused abi attributes.Steve Klabnik-2/+1
They've been replaced by putting the name on the extern block. #[abi = "foo"] goes to extern "foo" { } Closes #9483.
2013-10-11have LLVM print type strings for usDaniel Micay-59/+8
Example: void ({ i64, %tydesc*, i8*, i8*, i8 }*, i64*, %"struct.std::fmt::Formatter[#1]"*)* Before, we would print 20 levels deep due to recursion in the type definition.
2013-10-09option: rewrite the API to use compositionDaniel Micay-1/+1
2013-10-08rm useless fast_ffi attributesDaniel Micay-457/+0
this is no longer used by the compiler
2013-10-08debuginfo: Unified namespace generation approach for crate-local and ↵Michael Woerister-1/+2
external items. Fixed bug related to LLVM metadata uniquing.
2013-10-02auto merge of #9638 : ↵bors-0/+1
pnkfelix/rust/fsk-issue7526-attempt-to-catch-nonuc-statics-in-match-patterns, r=alexcrichton r? anyone Address scariest part of #7526 by adding a new more specific lint (that is set to warn by default, rather than allow).
2013-10-01auto merge of #9599 : alexcrichton/rust/less-fmt, r=huonwbors-7/+7
This also prevents future fmt! usage from leaking into the compiler, but it's still turned on by default for everyone else.
2013-09-30rustc: Remove usage of fmt!Alex Crichton-7/+7
2013-10-01add -Z soft-float optionJyun-Yan You-1/+2
This change adds -Z soft-float option for generating software floating point library calls. It also implies using soft float ABI, that is the same as llc. It is useful for targets that have no FPU.
2013-10-01Add new lint: non_uppercase_pattern_statics, for #7526.Felix S. Klock II-0/+1
This tries to warn about code like: ```rust match (0,0) { (0, aha) => { ... }, ... } ``` where `aha` is actually a static constant, not a binding.
2013-09-16switch Drop to `&mut self`Daniel Micay-4/+4
2013-09-15debuginfo: Fix style nits for pull request.Michael Woerister-1/+0
2013-09-15debuginfo: Support for recursive types.Michael Woerister-0/+4
2013-09-10debuginfo: Wrapped namespace facilities of llvm::DIBuilderMichael Woerister-0/+8
2013-09-09add `noalias` attribute to ~ return valuesDaniel Micay-0/+6
2013-09-04debuginfo: Support for by-value arguments (still excluding some cases of ↵Michael Woerister-0/+6
self arguments)
2013-09-04debuginfo: Support for variables captured in closures and closure type ↵Michael Woerister-0/+19
descriptions.
2013-08-30Tweak pass management and add some more optionsAlex Crichton-4/+2
The only changes to the default passes is that O1 now doesn't run the inline pass, just always-inline with lifetime intrinsics. O2 also now has a threshold of 225 instead of 275. Otherwise the default passes being run is the same. I've also added a few more options for configuring the pass pipeline. Namely you can now specify arguments to LLVM directly via the `--llvm-args` command line option which operates similarly to `--passes`. I also added the ability to turn off pre-population of the pass manager in case you want to run *only* your own passes.
2013-08-26Rewrite pass management with LLVMAlex Crichton-44/+77
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`