summary refs log tree commit diff
path: root/src/librustc/lib
AgeCommit message (Collapse)AuthorLines
2014-03-30Removed deprecated functions `map` and `flat_map` for vectors and slices.Marvin Löbel-1/+1
2014-03-29auto merge of #13143 : gentlefolk/rust/issue-9227, r=michaelwoeristerbors-0/+13
Only supports crate level statics. No debug info is generated for function level statics. Closes #9227. As discussed at the end of the comments for #9227, I took an initial stab at adding support for function level statics and decided it would be enough work to warrant being split into a separate issue. See #13144 for the new issue describing the need to add support for function level static variables.
2014-03-28Convert most code to new inner attribute syntax.Brian Anderson-2/+2
Closes #2569
2014-03-27Initial support for emitting DWARF for static vars.gentlefolk-0/+13
Only supports crate level statics. No debug info is generated for function level statics. Closes #9227.
2014-03-22rustc: Fix fallout of removing get()Alex Crichton-4/+2
2014-03-18rustc: remove obsolete linkage typesBen Noordhuis-4/+4
Remove obsolete linkage types from the llvm::Linkage enum. The linkage types are no-ops and weren't used inside rustc anyway.
2014-03-18rustc: remove linker_private/linker_private_weakBen Noordhuis-2/+0
Remove the linker_private and linker_private_weak linkage attributes, they have been superseded by private and private_weak and have been removed in upstream LLVM in commit r203866.
2014-03-05rustc: Fix support for LLVM 3.3Alex Crichton-0/+1
The llvm.copysign and llvm.round intrinsics weren't added until LLVM 3.4, so if we're on LLVM 3.3 we lower these to calls in libm instead of LLVM intrinsics. This should fix our travis failures.
2014-03-04Rename struct fields with uppercase characters in their names to use lowercasePalmer Cox-9/+9
2014-03-04Rename all variables that have uppercase characters in their names to use ↵Palmer Cox-20/+20
only lowercase characters
2014-02-23Move std::{trie, hashmap} to libcollectionsAlex Crichton-1/+1
These two containers are indeed collections, so their place is in libcollections, not in libstd. There will always be a hash map as part of the standard distribution of Rust, but by moving it out of the standard library it makes libstd that much more portable to more platforms and environments. This conveniently also removes the stuttering of 'std::hashmap::HashMap', although 'collections::HashMap' is only one character shorter.
2014-02-21Changed NonCamelCaseTypes lint to warn by defaultmr.Shu-0/+1
Added allow(non_camel_case_types) to librustc where necesary Tried to fix problems with non_camel_case_types outside rustc fixed failing tests Docs updated Moved #[allow(non_camel_case_types)] a level higher. markdown.rs reverted Fixed timer that was failing tests Fixed another timer
2014-01-29auto merge of #11853 : alexcrichton/rust/up-llvm, r=brsonbors-0/+2
This upgrade brings commit by @eddyb to help optimizations of virtual calls in a few places (https://github.com/llvm-mirror/llvm/commit/6d2bd95) as well as a commit by @c-a to *greatly* improve the runtime of the optimization passes (https://github.com/rust-lang/llvm/pull/3). Nice work to these guys!
2014-01-29Upgrade LLVMAlex Crichton-0/+2
This upgrade brings commit by @eddyb to help optimizations of virtual calls in a few places (https://github.com/llvm-mirror/llvm/commit/6d2bd95) as well as a commit by @c-a to *greatly* improve the runtime of the optimization passes (https://github.com/rust-lang/llvm/pull/3). Nice work to these guys!
2014-01-29auto merge of #11879 : thestinger/rust/frame-pointer, r=alexcrichtonbors-1/+2
This is still used for Rust code (`Options.NoFramePointerElim = true`).
2014-01-29enable fp-elim when debug info is disabledDaniel Micay-1/+2
This can almost be fully disabled, as it no longer breaks retrieving a backtrace on OS X as verified by @alexcrichton. However, it still breaks retrieving the values of parameters. This should be fixable in the future via a proper location list... Closes #7477
2014-01-28Add appropriate LLVM module flags for debug info.comex-0/+5
Set "Dwarf Version" to 2 on OS X to avoid toolchain incompatibility, and set "Debug Info Version" to prevent debug info from being stripped from bitcode. Fixes #11352.
2014-01-22libc: switch `free` to the proper signatureDaniel Micay-2/+2
This does not attempt to fully propagate the mutability everywhere, but gives new code a hint to avoid the same issues.
2014-01-15Issue #3511 - Rationalize temporary lifetimes.Niko Matsakis-2/+5
Major changes: - Define temporary scopes in a syntax-based way that basically defaults to the innermost statement or conditional block, except for in a `let` initializer, where we default to the innermost block. Rules are documented in the code, but not in the manual (yet). See new test run-pass/cleanup-value-scopes.rs for examples. - Refactors Datum to better define cleanup roles. - Refactor cleanup scopes to not be tied to basic blocks, permitting us to have a very large number of scopes (one per AST node). - Introduce nascent documentation in trans/doc.rs covering datums and cleanup in a more comprehensive way.
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