summary refs log tree commit diff
path: root/src/librustc_trans
AgeCommit message (Collapse)AuthorLines
2015-07-06Add a boolean flag to ExistentialBounds tracking whether theNiko Matsakis-0/+10
region-bound is expected to change in Rust 1.3, but don't use it for anything in this commit. Note that this is not a "significant" part of the type (it's not part of the formal model) so we have to normalize this away or trans starts to get confused because two equal types wind up with distinct LLVM types.
2015-06-23Auto merge of #26490 - alexcrichton:fix-msvc-again, r=brsonbors-9/+15
This commit ensures that the modifications made in #26382 also apply to the archive commands run in addition to the linker commands.
2015-06-23change `const_val` enum and its variants to camel-caseOliver Schneider-3/+4
2015-06-21rustc_trans: Use custom PATH for archive commandsAlex Crichton-9/+15
This commit ensures that the modifications made in #26382 also apply to the archive commands run in addition to the linker commands.
2015-06-21Make expr_is_lval more robustAriel Ben-Yehuda-11/+165
Previously it also tried to find out the best way to translate the expression, which could ICE during type-checking. Fixes #23173 Fixes #24322 Fixes #25757
2015-06-20Auto merge of #26198 - stygstra:issue-24258, r=huonwbors-11/+52
When overflow checking on `<<` and `>>` was added for integers, the `<<` and `>>` operations broke for SIMD types (`u32x4`, `i16x8`, etc.). This PR implements checked shifts on SIMD types. Fixes #24258.
2015-06-20Auto merge of #26411 - dotdash:fat_in_registers, r=aatchbors-252/+263
This has a number of advantages compared to creating a copy in memory and passing a pointer. The obvious one is that we don't have to put the data into memory but can keep it in registers. Since we're currently passing a pointer anyway (instead of using e.g. a known offset on the stack, which is what the `byval` attribute would achieve), we only use a single additional register for each fat pointer, but save at least two pointers worth of stack in exchange (sometimes more because more than one copy gets eliminated). On archs that pass arguments on the stack, we save a pointer worth of stack even without considering the omitted copies. Additionally, LLVM can optimize the code a lot better, to a large degree due to the fact that lots of copies are gone or can be optimized away. Additionally, we can now emit attributes like nonnull on the data and/or vtable pointers contained in the fat pointer, potentially allowing for even more optimizations. This results in LLVM passes being about 3-7% faster (depending on the crate), and the resulting code is also a few percent smaller, for example: |text|data|filename| |----|----|--------| |5671479|3941461|before/librustc-d8ace771.so| |5447663|3905745|after/librustc-d8ace771.so| | | | | |1944425|2394024|before/libstd-d8ace771.so| |1896769|2387610|after/libstd-d8ace771.so| I had to remove a call in the backtrace-debuginfo test, because LLVM can now merge the tails of some blocks when optimizations are turned on, which can't correctly preserve line info. Fixes #22924 Cc #22891 (at least for fat pointers the code is good now)
2015-06-20Pass fat pointers in two immediate argumentsBjörn Steinbrink-116/+183
This has a number of advantages compared to creating a copy in memory and passing a pointer. The obvious one is that we don't have to put the data into memory but can keep it in registers. Since we're currently passing a pointer anyway (instead of using e.g. a known offset on the stack, which is what the `byval` attribute would achieve), we only use a single additional register for each fat pointer, but save at least two pointers worth of stack in exchange (sometimes more because more than one copy gets eliminated). On archs that pass arguments on the stack, we save a pointer worth of stack even without considering the omitted copies. Additionally, LLVM can optimize the code a lot better, to a large degree due to the fact that lots of copies are gone or can be optimized away. Additionally, we can now emit attributes like nonnull on the data and/or vtable pointers contained in the fat pointer, potentially allowing for even more optimizations. This results in LLVM passes being about 3-7% faster (depending on the crate), and the resulting code is also a few percent smaller, for example: text data filename 5671479 3941461 before/librustc-d8ace771.so 5447663 3905745 after/librustc-d8ace771.so 1944425 2394024 before/libstd-d8ace771.so 1896769 2387610 after/libstd-d8ace771.so I had to remove a call in the backtrace-debuginfo test, because LLVM can now merge the tails of some blocks when optimizations are turned on, which can't correctly preserve line info. Fixes #22924 Cc #22891 (at least for fat pointers the code is good now)
2015-06-20Auto merge of #26382 - alexcrichton:less-racy-path, r=brsonbors-1/+11
Environment variables are global state so this can lead to surprising results if the driver is called in a multithreaded environment (e.g. doctests). There shouldn't be any memory corruption that's possible, but a lot of the bots have been failing because they can't find `cc` or `gcc` in the path during doctests, and I highly suspect that it is due to the compiler modifying `PATH` in a multithreaded fashion. This commit moves the logic for appending to `PATH` to only affect the child process instead of also affecting the parent, at least for the linking stage. When loading dynamic libraries the compiler still modifies `PATH` on Windows, but this may be more difficult to fix than spawning off a new process.
2015-06-20Support checked Shl/Shr on SIMD typesDavid Stygstra-11/+52
2015-06-20Make trans_arg_datum fill a destination vector instead of returning its resultBjörn Steinbrink-61/+57
This makes it easier to support translating a single rust argument to more than one llvm argument value later.
2015-06-20Simplify argument forwarding in the various shim generatorsBjörn Steinbrink-62/+16
2015-06-20Use a single match arm for all TyRef variants when deducing function ↵Björn Steinbrink-26/+20
argument attributes This makes it a lot easier to later add attributes for fat pointers.
2015-06-19Auto merge of #24527 - nikomatsakis:issue-24085, r=nikomatsakisbors-1/+2
Expand the "givens" set to cover transitive relations. The givens array stores relationships like `'c <= '0` (where `'c` is a free region and `'0` is an inference variable) that are derived from closure arguments. These are (rather hackily) ignored for purposes of inference, preventing spurious errors. The current code did not handle transitive cases like `'c <= '0` and `'0 <= '1`. Fixes #24085. r? @pnkfelix cc @bkoropoff *But* I am not sure whether this fix will have a compile-time hit. I'd like to push to try branch observe cycle times.
2015-06-19Auto merge of #26351 - eddyb:tls-tcx, r=nikomatsakisbors-484/+394
Pre-requisite for splitting the type context into global and local parts. The `Repr` and `UserString` traits were also replaced by `Debug` and `Display`.
2015-06-19Expand the "givens" set to cover transitive relations. The givens arrayNiko Matsakis-1/+2
stores relationships like `'c <= '0` (where `'c` is a free region and `'0` is an inference variable) that are derived from closure arguments. These are (rather hackily) ignored for purposes of inference, preventing spurious errors. The current code did not handle transitive cases like `'c <= '0` and `'0 <= '1`. Fixes #24085.
2015-06-19Rollup merge of #26414 - alexcrichton:msvc-fix-build, r=brsonManish Goregaokar-1/+6
Currently all these do is cause linker errors as they try to lower to GNU-like exception handling, none of which exists with MSVC.
2015-06-19rustc: remove Repr and UserString.Eduard Burtescu-314/+272
2015-06-19rustc: replace Repr/UserString impls with Debug/Display ones.Eduard Burtescu-25/+13
2015-06-19rustc: remove some unused UserString and Repr impls.Eduard Burtescu-1/+1
2015-06-19Clean up unused argument/variable warnings.Eduard Burtescu-6/+5
2015-06-19rustc: use the TLS type context in Repr and UserString.Eduard Burtescu-177/+177
2015-06-18rustc_trans: Disable landing pads on MSVCAlex Crichton-1/+6
Currently all these do is cause linker errors as they try to lower to GNU-like exception handling, none of which exists with MSVC.
2015-06-19rustc: leave only one free top-level function in ppaux, and private.Eduard Burtescu-5/+5
2015-06-19rustc: use Repr and UserString instead of ppaux::ty_to_string.Eduard Burtescu-57/+52
2015-06-19rustc: reduce ppaux's public footprint to 5 functions.Eduard Burtescu-3/+2
2015-06-19rustc: remove ownership of tcx from trans' context.Eduard Burtescu-137/+108
2015-06-18Auto merge of #26147 - arielb1:assoc-trans, r=nikomatsakisbors-4/+8
Fixes #25700 r? @nikomatsakis
2015-06-18Normalize associated types in closure signaturesAriel Ben-Yehuda-4/+8
Fixes #25700.
2015-06-18Auto merge of #26192 - alexcrichton:features-clean, r=aturonbors-9/+10
This commit shards the all-encompassing `core`, `std_misc`, `collections`, and `alloc` features into finer-grained components that are much more easily opted into and tracked. This reflects the effort to push forward current unstable APIs to either stabilization or removal. Keeping track of unstable features on a much more fine-grained basis will enable the library subteam to quickly analyze a feature and help prioritize internally about what APIs should be stabilized. A few assorted APIs were deprecated along the way, but otherwise this change is just changing the feature name associated with each API. Soon we will have a dashboard for keeping track of all the unstable APIs in the standard library, and I'll also start making issues for each unstable API after performing a first-pass for stabilization.
2015-06-18Fix libstd testsAlex Crichton-1/+0
2015-06-18remove unused functions from trans and llvmOliver Schneider-56/+0
2015-06-17rustc_driver: Frob the global PATH lessAlex Crichton-1/+11
Environment variables are global state so this can lead to surprising results if the driver is called in a multithreaded environment (e.g. doctests). There shouldn't be any memory corruption that's possible, but a lot of the bots have been failing because they can't find `cc` or `gcc` in the path during doctests, and I highly suspect that it is due to the compiler modifying `PATH` in a multithreaded fashion. This commit moves the logic for appending to `PATH` to only affect the child process instead of also affecting the parent, at least for the linking stage. When loading dynamic libraries the compiler still modifies `PATH` on Windows, but this may be more difficult to fix than spawning off a new process.
2015-06-17Auto merge of #26326 - nikomatsakis:optimize-fulfillment-cache-in-tcx, ↵bors-3/+3
r=pcwalton When we successfully resolve a trait reference with no type/lifetime parameters, like `i32: Foo` or `Box<u32>: Sized`, this is in fact globally true. This patch adds a simple global to the tcx to cache such cases. The main advantage of this is really about caching things like `Box<Vec<Foo>>: Sized`. It also points to the need to revamp our caching infrastructure -- the current caches make selection cost cheaper, but we still wind up paying a high cost in the confirmation process, and in particular unrolling out dependent obligations. Moreover, we should probably do caching more uniformly and with a key that takes the where-clauses into account. But that's for later. For me, this shows up as a reasonably nice win (20%) on Servo's script crate (when built in dev mode). This is not as big as my initial measurements suggested, I think because I was building my rustc with more debugging enabled at the time. I've not yet done follow-up profiling and so forth to see where the new hot spots are. Bootstrap times seem to be largely unaffected. cc @pcwalton This is technically a [breaking-change] in that functions with unsatisfiable where-clauses may now yield errors where before they may have been accepted. Even before, these functions could never have been *called* by actual code. In the future, such functions will probably become illegal altogether, but in this commit they are still accepted, so long as they do not rely on the unsatisfiable where-clauses. As before, the functions still cannot be called in any case.
2015-06-17Auto merge of #26062 - eefriedman:cleanup-cached, r=nikomatsakisbors-0/+7
Using the wrong landing pad has obvious bad effects, like dropping a value twice. Testcase written by Alex Crichton. Fixes #25089.
2015-06-17More test fixes and fallout of stability changesAlex Crichton-5/+1
2015-06-17Fallout in tests and docs from feature renamingsAlex Crichton-1/+1
2015-06-17std: Split the `std_misc` featureAlex Crichton-1/+1
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-17alloc: Split apart the global `alloc` featureAlex Crichton-1/+1
2015-06-17core: Split apart the global `core` featureAlex Crichton-4/+10
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
2015-06-17Auto merge of #26025 - alexcrichton:update-llvm, r=brsonbors-55/+104
This commit updates the LLVM submodule in use to the current HEAD of the LLVM repository. This is primarily being done to start picking up unwinding support for MSVC, which is currently unimplemented in the revision of LLVM we are using. Along the way a few changes had to be made: * As usual, lots of C++ debuginfo bindings in LLVM changed, so there were some significant changes to our RustWrapper.cpp * As usual, some pass management changed in LLVM, so clang was re-scrutinized to ensure that we're doing the same thing as clang. * Some optimization options are now passed directly into the `PassManagerBuilder` instead of through CLI switches to LLVM. * The `NoFramePointerElim` option was removed from LLVM, favoring instead the `no-frame-pointer-elim` function attribute instead. * The `LoopVectorize` option of the LLVM optimization passes has been disabled as it causes a divide-by-zero exception to happen in LLVM for zero-sized types. This is reported as https://llvm.org/bugs/show_bug.cgi?id=23763 Additionally, LLVM has picked up some new optimizations which required fixing an existing soundness hole in the IR we generate. It appears that the current LLVM we use does not expose this hole. When an enum is moved, the previous slot in memory is overwritten with a bit pattern corresponding to "dropped". When the drop glue for this slot is run, however, the switch on the discriminant can often start executing the `unreachable` block of the switch due to the discriminant now being outside the normal range. This was patched over locally for now by having the `unreachable` block just change to a `ret void`.
2015-06-16rustc: Update LLVMAlex Crichton-55/+104
This commit updates the LLVM submodule in use to the current HEAD of the LLVM repository. This is primarily being done to start picking up unwinding support for MSVC, which is currently unimplemented in the revision of LLVM we are using. Along the way a few changes had to be made: * As usual, lots of C++ debuginfo bindings in LLVM changed, so there were some significant changes to our RustWrapper.cpp * As usual, some pass management changed in LLVM, so clang was re-scrutinized to ensure that we're doing the same thing as clang. * Some optimization options are now passed directly into the `PassManagerBuilder` instead of through CLI switches to LLVM. * The `NoFramePointerElim` option was removed from LLVM, favoring instead the `no-frame-pointer-elim` function attribute instead. Additionally, LLVM has picked up some new optimizations which required fixing an existing soundness hole in the IR we generate. It appears that the current LLVM we use does not expose this hole. When an enum is moved, the previous slot in memory is overwritten with a bit pattern corresponding to "dropped". When the drop glue for this slot is run, however, the switch on the discriminant can often start executing the `unreachable` block of the switch due to the discriminant now being outside the normal range. This was patched over locally for now by having the `unreachable` block just change to a `ret void`.
2015-06-15Add a (somewhat hacky) cache to the tcx that tracks "global" trait refsNiko Matsakis-3/+3
that are known to have been satisfied *somewhere*. This means that if one fn finds that `SomeType: Foo`, then every other fn can just consider that to hold. Unfortunately, there are some complications: 1. If `SomeType: Foo` includes dependent conditions, those conditions may trigger an error. This error will be repored in the first fn where `SomeType: Foo` is evaluated, but not in the other fns, which can lead to uneven error reporting (which is sometimes confusing). 2. This kind of caching can be unsound in the presence of unsatisfiable where clauses. For example, suppose that the first fn has a where-clause like `i32: Bar<u32>`, which in fact does not hold. This will "fool" trait resolution into thinking that `i32: Bar<u32>` holds. This is ok currently, because it means that the first fn can never be calle (since its where clauses cannot be satisfied), but if the first fn's successful resolution is cached, it can allow other fns to compile that should not. This problem is fixed in the next commit.
2015-06-15save-analysis: fix a couple of span bugsNick Cameron-6/+8
2015-06-15Rebasing and bug fixingNick Cameron-39/+45
2015-06-15save-analysis: use a macro for 'downcasting'Nick Cameron-139/+132
2015-06-15save-analysis: API-ify struct litsNick Cameron-33/+65
2015-06-15save-analysis: merge StructRef and TypeRefNick Cameron-8/+4
2015-06-15save-analysis: API-ify implsNick Cameron-53/+131