about summary refs log tree commit diff
path: root/src/librustc_trans
AgeCommit message (Collapse)AuthorLines
2017-11-19rustc_trans: use more of the trans::mir and ty::layout APIs throughout.Eduard-Mihai Burtescu-860/+646
2017-11-19rustc_trans: do not introspect LLVM aggregate field types.Eduard-Mihai Burtescu-48/+14
2017-11-19rustc_trans: remove obsolete Type methods.Eduard-Mihai Burtescu-17/+4
2017-11-19rustc_trans: use a predictable layout for constant ADTs.Eduard-Mihai Burtescu-93/+64
2017-11-19rustc_trans: avoid working with sizes/offsets and alignments as integers.Eduard-Mihai Burtescu-901/+776
2017-11-18Auto merge of #46009 - kennytm:fix-38878-again, r=alexcrichtonbors-3/+3
Fix #38878 again — restart linker when seeing SIGBUS in additional to SIGSEGV. In https://github.com/rust-lang/rust/pull/45985#issuecomment-344586645 we see a linker crashed due to Bus Error (signal 10) on macOS. The error was not caught by #40422 since the PR only handles Segmentation Fault (signal 11). The crash log indicates the problem is the same as #38878, so we just amend #40422 to include SIGBUS as well. (Additionally, modified how the crash logs are printed so that irrelevant logs are truly filtered out.)
2017-11-18remove the `generator_sigs` map, query, and plumbingNiko Matsakis-1/+1
2017-11-18stop using the `closure_kinds` query / table for anythingNiko Matsakis-1/+1
Closure Kind is now extracted from the closure substs exclusively.
2017-11-18Auto merge of #45899 - eddyb:meta-race, r=alexcrichtonbors-18/+35
rustc_trans: atomically write .rmeta outputs to avoid races. Fixes #45841 in a similar vein to how LLVM writes archives: write a temporary file and then rename it. r? @alexcrichton
2017-11-17rustc_trans: move const & lvalue access helpers from adt.Eduard-Mihai Burtescu-329/+251
2017-11-17Auto merge of #45996 - eddyb:even-mirer-1, r=arielb1bors-1/+10
MIR: hide .rodata constants vs by-ref ABI clash in trans. Back in #45380, constants were copied into locals during MIR creation to ensure that arguments ' memory can be used by the callee, if the constant is placed in `.rodata` and the ABI passes it by-ref. However, there are several drawbacks (see https://github.com/rust-lang/rust/pull/45380#discussion_r150447709), most importantly the complication of constant propagation (UB if a constant ends up in `Call` arguments) and inconveniencing analyses. Instead, I've modified the `rustc_trans` implementation of calls to copy an `Operand::Constant` argument locally if it's not immediate, and added a test that segfaults without the copy. cc @dotdash @arielb1
2017-11-17MIR: hide .rodata constants vs by-ref ABI clash in trans.Eduard-Mihai Burtescu-1/+10
2017-11-16Auto merge of #45897 - tromey:trait-object-debug, r=michaelwoeristerbors-1/+95
Trait object debug This enables better debugging of trait objects. See the individual commits for explanations. This required an LLVM bump.
2017-11-16Auto merge of #45528 - alexcrichton:avx512, r=arielb1bors-3/+8
rustc: Add some more compatibility with AVX-512 * Increase the maximum vector size in the ABI calculations to ensure that AVX-512 operands are immediates. * Add a few more `target_feature` matchings for AVX-512 features
2017-11-16Auto merge of #45920 - sunfishcode:trap-on-unreachable, r=Zoxcbors-0/+2
Enable TrapUnreachable in LLVM. This patch enables LLVM's TrapUnreachable flag, which tells it to translate `unreachable` instructions into hardware trap instructions, rather than allowing control flow to "fall through" into whatever code happens to follow it in memory. This follows up on https://github.com/rust-lang/rust/issues/28728#issuecomment-332581533. For example, for @zackw's testcase [here](https://github.com/rust-lang/rust/issues/42009#issue-228745924), the output function contains a `ud2` instead of no code, so it won't "fall through" into whatever happens to be next in memory. (I'm also working on the problem of LLVM optimizing away infinite loops, but the patch here is useful independently.) I tested this patch on a few different codebases, and the code size increase ranged from 0.0% to 0.1%.
2017-11-16In additional to segfault, retry the linker on bus error as well.kennytm-3/+3
2017-11-15Emit debug info for trait object pointerTom Tromey-1/+95
Emit better debugging information for a trait object pointer. In particular, now: * The fields are explicitly represented in the DWARF; * DWARF for the vtable itself is emitted; and * The DWARF for the vtable's type has a DW_AT_containing_type which points to the concrete type for which the vtable was emitted. This is a small DWARF extension, that allows debuggers to determine the real type of the object to which a trait object points. I'll submit the gdb patch to take advantage of this new debuginfo once this lands. The vtable type is not currently complete -- it doesn't include members for the pointers it contains. This information was not needed for this feature. This addresses part 1 of #1563.
2017-11-15Auto merge of #45944 - eddyb:provide, r=nikomatsakisbors-22/+7
rustc_driver: expose a way to override query providers in CompileController. This API has been a long-time coming and will probably become the main method for custom drivers (that is, binaries other than `rustc` itself that use `librustc_driver`) to adapt the compiler's behavior.
2017-11-13Rollup merge of #45828 - pornel:printoption, r=nrckennytm-21/+0
Remove deprecated message Follow up of #43067
2017-11-12rustc_driver: base extern query providers on local ones.Eduard-Mihai Burtescu-22/+7
2017-11-12Auto merge of #45900 - rkruppe:u128-to-f32-saturation-by-default, r=alexcrichtonbors-1/+1
Make saturating u128 -> f32 casts the default behavior ... rather than being gated by `-Z saturating-float-casts`. There are several reasons for this: 1. Const eval already implements this behavior. 2. Unlike with float->int casts, this behavior is uncontroversially the right behavior and it is not as performance critical. Thus there is no particular need to make the bug fix for u128->f32 casts opt-in. 3. Having two orthogonal features under one flag is silly, and never should have happened in the first place. 4. Benchmarking float->int casts with the -Z flag should not pick up performance changes due to the u128->f32 casts (assuming there are any). Fixes #41799
2017-11-11Control LLVM's TrapUnreachable feature through rustc's TargetOptions.Dan Gohman-0/+2
2017-11-10Auto merge of #45804 - gnzlbg:div_intr, r=alexcrichtonbors-1/+2
[intrinsics] add missing div and rem vector intrinsics
2017-11-10rustc: Add some more compatibility with AVX-512Alex Crichton-3/+8
* Increase the maximum vector size in the ABI calculations to ensure that AVX-512 operands are immediates. * Add a few more `target_feature` matchings for AVX-512 features
2017-11-10Make saturating u128 -> f32 casts the default behaviorRobin Kruppe-1/+1
... rather than being gated by -Z saturating-float-casts. There are several reasons for this: 1. Const eval already implements this behavior. 2. Unlike with float->int casts, this behavior is uncontroversially the right behavior and it is not as performance critical. Thus there is no particular need to make the bug fix for u128->f32 casts opt-in. 3. Having two orthogonal features under one flag is silly, and never should have happened in the first place. 4. Benchmarking float->int casts with the -Z flag should not pick up performance changes due to the u128->f32 casts (assuming there are any). Fixes #41799
2017-11-10Rollup merge of #45783 - kennytm:compiler-test-fixes, r=alexcrichtonkennytm-5/+6
Miscellaneous changes for CI, Docker and compiletest. This PR contains 7 independent commits that improves interaction with CI, Docker and compiletest. 1. a4e5c91cb8 — Forces a newline every 100 dots when testing in quiet mode. Prevents spurious timeouts when abusing the CI to test Android jobs. 2. 1b5aaf22e8 — Use vault.centos.org for dist-powerpc64le-linux, see #45744. 3. 33400fbbcd — Modify `src/ci/docker/run.sh` so that the docker images can be run from Docker Toolbox for Windows on Windows 7. I haven't checked the behavior of the newer Docker for Windows on Windows 10. Also, "can run" does not mean all the test can pass successfully (the UDP tests failed last time I checked) 4. d517668a08 — Don't emit a real warning the linker segfault, which affects UI tests like https://github.com/rust-lang/rust/pull/45489#issuecomment-340134944. Log it instead. 5. 51e2247948 — During run-pass, trim the output if stdout/stderr exceeds 416 KB (top 160 KB + bottom 256 KB). This is an attempt to avoid spurious failures like https://github.com/rust-lang/rust/pull/45384#issuecomment-341755788 6. 9cfdabaf3c — Force `gem update --system` before deploy. This is an attempt to prevent spurious error #44159. 7. eee10cc482 — Tries to print the crash log on macOS on failure. This is an attempt to debug #45230.
2017-11-10rustc_trans: atomically write .rmeta outputs to avoid races.Eduard-Mihai Burtescu-18/+35
2017-11-09Auto merge of #45761 - gnzlbg:xsave_feature, r=alexcrichtonbors-1/+3
[xsave] whitelist xsave target feature Required for https://github.com/rust-lang-nursery/stdsimd/issues/171
2017-11-08Auto merge of #45867 - michaelwoerister:check-ich-stability, r=nikomatsakisbors-14/+13
incr.comp.: Verify stability of incr. comp. hashes and clean up various other things. The main contribution of this PR is that it adds the `-Z incremental-verify-ich` functionality. Normally, when the red-green tracking system determines that a certain query result has not changed, it does not re-compute the incr. comp. hash (ICH) for that query result because that hash is already known. `-Z incremental-verify-ich` tells the compiler to re-hash the query result and compare the new hash against the cached hash. This is a rather thorough way of - testing hashing implementation stability, - finding missing `[input]` annotations on `DepNodes`, and - finding missing read-edges, since both a missed read and a missing `[input]` annotation can lead to something being marked as green instead of red and thus will have a different hash than it should have. Case in point, implementing this verification logic and activating it for all `src/test/incremental` tests has revealed several such oversights, all of which are fixed in this PR. r? @nikomatsakis
2017-11-08incr.comp.: Remove unused DepKind::WorkProduct.Michael Woerister-13/+1
2017-11-07Clean upRobin Kruppe-32/+26
2017-11-07Implement more efficient saturationRobin Kruppe-71/+63
2017-11-07Make trans const eval error on overflow and NaN, matching HIR const eval.Robin Kruppe-25/+40
2017-11-07Extract (f32::MAX + 0.5 ULP) constantRobin Kruppe-6/+7
2017-11-07Saturating casts between integers and floats (both directions).Robin Kruppe-13/+228
This affects regular code generation as well as constant evaluation in trans, but not the HIR constant evaluator because that one returns an error for overflowing casts and NaN-to-int casts. That error is conservatively correct and we should be careful to not accept more code in constant expressions. The changes to code generation are guarded by a new -Z flag, to be able to evaluate the performance impact. The trans constant evaluation changes are unconditional because they have no run time impact and don't affect type checking either.
2017-11-07Auto merge of #45666 - Amanieu:tls-model, r=alexcrichtonbors-11/+39
Allow overriding the TLS model This PR adds the ability to override the default "global-dynamic" TLS model with a more specific one through a target json option or a command-line option. This allows for better code generation in certain situations. This is similar to the `-ftls-model=` option in GCC and Clang.
2017-11-07incr.comp.: Sort exported symbols list in order to achieve stable incr. ↵Michael Woerister-1/+12
comp. hash.
2017-11-07Remove deprecated messageKornel-21/+0
Second stage of #43067
2017-11-06Move tls-model to a -Z option since it is unstableAmanieu d'Antras-1/+1
2017-11-06[intrinsics] add missing div and rem vector intrinsicsgnzlbg-1/+2
2017-11-06If the linker segfaulted, don't emit it as a warning.kennytm-5/+6
Prevent spuriously breaking UI tests. See https://github.com/rust-lang/rust/pull/45489#issuecomment-340134944.
2017-11-05[xsave] whitelist xsave target featuresgnzlbg-1/+3
Whitelists `xsave`, `xsaveopt`, `xsavec`, `xsavec`.
2017-11-05Auto merge of #45748 - petrochenkov:short, r=alexcrichtonbors-1/+1
Shorten paths to auxiliary files created by tests I'm hitting issues with long file paths to object files created by the test suite, similar to https://github.com/rust-lang/rust/issues/45103#issuecomment-335622075. If we look at the object file path in https://github.com/rust-lang/rust/issues/45103 we can see that the patch contains of few components: ``` specialization-cross-crate-defaults.stage2-x86_64-pc-windows-gnu.run-pass.libaux\specialization_cross_crate_defaults.specialization_cross_crate_defaults0.rust-cgu.o ``` => 1. specialization-cross-crate-defaults // test name, required 2. stage2 // stage disambiguator, required 3. x86_64-pc-windows-gnu // target disambiguator, required 4. run-pass // mode disambiguator, rarely required 5. libaux // suffix, can be shortened 6. specialization_cross_crate_defaults // required, there may be several libraries in the directory 7. specialization_cross_crate_defaults0 // codegen unit name, can be shortened? 8. rust-cgu // suffix, can be shortened? 9. o // object file extension This patch addresses items `4`, `5` and `8`. `libaux` is shortened to `aux`, `rust-cgu` is shortened to `rcgu`, mode disambiguator is omitted unless it's necessary (for pretty-printing and debuginfo tests, see https://github.com/rust-lang/rust/pull/24537/commits/38d26d811a44ba93637c84ce77a58af88c47f0ac) I haven't touched names of codegen units though (`specialization_cross_crate_defaults0`). Is it useful for them to have descriptive names including the crate name, as opposed to just `0` or `cgu0` or something?
2017-11-04rustc: Handle some libstd symbole exports betterAlex Crichton-1/+10
Right now symbol exports, particularly in a cdylib, are handled by assuming that `pub extern` combined with `#[no_mangle]` means "export this". This isn't actually what we want for some symbols that the standard library uses to implement itself, for example symbols related to allocation. Additionally other special symbols like `rust_eh_personallity` have no need to be exported from cdylib crate types (only needed in dylib crate types). This commit updates how rustc handles these special symbols by adding to the hardcoded logic of symbols like `rust_eh_personallity` but also adding a new attribute, `#[rustc_std_internal_symbol]`, which forces the export level to be considered the same as all other Rust functions instead of looking like a C function. The eventual goal here is to prevent functions like `__rdl_alloc` from showing up as part of a Rust cdylib as it's just an internal implementation detail. This then further allows such symbols to get gc'd by the linker when creating a cdylib.
2017-11-04Auto merge of #45384 - mikhail-m1:mir_add_false_edges_terminator_kind, r=arielb1bors-2/+4
add TerminatorKind::FalseEdges and use it in matches impl #45184 and fixes #45043 right way. False edges unexpectedly affects uninitialized variables analysis in MIR borrowck.
2017-11-03Shorten paths to auxiliary files created by testsVadim Petrochenkov-1/+1
2017-11-03Cache the TLS model in the crate contextAmanieu d'Antras-5/+12
2017-11-03Add support for specifying the TLS modelAmanieu d'Antras-5/+30
2017-11-03Fix error message for invalid code/reloc modelsAmanieu d'Antras-6/+2
2017-11-02Make the difference between lint codes and error codes explicitOliver Schneider-3/+3