Commit graph

69964 commits

Author SHA1 Message Date
Oliver Schneider
a24edb9bce
Add structured suggestions for trait imports 2017-11-20 09:17:27 +01:00
bors
ef94d5c1f1 Auto merge of #46068 - wesleywiser:incr_duplicate_read_stats, r=michaelwoerister
[incremental] Collect stats about duplicated edge reads from queries

Part of #45873
2017-11-20 03:34:13 +00:00
bors
f50fd075c2 Auto merge of #45225 - eddyb:trans-abi, r=arielb1
Refactor type memory layouts and ABIs, to be more general and easier to optimize.

To combat combinatorial explosion, type layouts are now described through 3 orthogonal properties:
* `Variants` describes the plurality of sum types (where applicable)
  * `Single` is for one inhabited/active variant, including all C `struct`s and `union`s
  * `Tagged` has its variants discriminated by an integer tag, including C `enum`s
  * `NicheFilling` uses otherwise-invalid values ("niches") for all but one of its inhabited variants
* `FieldPlacement` describes the number and memory offsets of fields (if any)
  * `Union` has all its fields at offset `0`
  * `Array` has offsets that are a multiple of its `stride`; guarantees all fields have one type
  * `Arbitrary` records all the field offsets, which can be out-of-order
* `Abi` describes how values of the type should be passed around, including for FFI
  * `Uninhabited` corresponds to no values, associated with unreachable control-flow
  * `Scalar` is ABI-identical to its only integer/floating-point/pointer "scalar component"
  * `ScalarPair` has two "scalar components", but only applies to the Rust ABI
  * `Vector` is for SIMD vectors, typically `#[repr(simd)]` `struct`s in Rust
  * `Aggregate` has arbitrary contents, including all non-transparent C `struct`s and `union`s

Size optimizations implemented so far:
* ignoring uninhabited variants (i.e. containing uninhabited fields), e.g.:
  * `Option<!>` is 0 bytes
  * `Result<T, !>` has the same size as `T`
* using arbitrary niches, not just `0`, to represent a data-less variant, e.g.:
  * `Option<bool>`, `Option<Option<bool>>`, `Option<Ordering>` are all 1 byte
  * `Option<char>` is 4 bytes
* using a range of niches to represent *multiple* data-less variants, e.g.:
  * `enum E { A(bool), B, C, D }` is 1 byte

Code generation now takes advantage of `Scalar` and `ScalarPair` to, in more cases, pass around scalar components as immediates instead of indirectly, through pointers into temporary memory, while avoiding LLVM's "first-class aggregates", and there's more untapped potential here.

Closes #44426, fixes #5977, fixes #14540, fixes #43278.
2017-11-19 22:12:22 +00:00
Eduard-Mihai Burtescu
f9f5ab98b0 Revert "tests: Update run-make/issue-25581 to reflect how fat pointers are passed."
This reverts commit b12dcdef4f.
2017-11-19 23:38:48 +02:00
Eduard-Mihai Burtescu
89e437354a rustc_trans: remove primitive_align optimization. 2017-11-19 20:33:46 +02:00
bors
5041b3bb3d Auto merge of #45454 - Aaronepower:master, r=alexcrichton
Updated Release notes for 1.22.0

[rendered](https://github.com/Aaronepower/rust/blob/master/RELEASES.md)
2017-11-19 17:23:01 +00:00
Michael Woerister
8d6f869c98
Remove some trailing whitespace. 2017-11-19 17:26:19 +01:00
Michael Woerister
a4ad5dbcb7
Fix tidy line-length issue. 2017-11-19 17:12:04 +01:00
Eduard-Mihai Burtescu
88e4d2c291 rustc_trans: work around i686-pc-windows-msvc byval align LLVM bug. 2017-11-19 17:58:38 +02:00
bors
d8d5b6180f Auto merge of #46074 - scottmcm:unspecialize-nth, r=bluss
Undo the Sized specialization from Iterator::nth

I just added this as part of https://github.com/rust-lang/rust/pull/45595, but I'm now afraid there's a specialization issue with it, since I tried to add [another similar specialization](https://github.com/rust-lang/rust/compare/master...scottmcm:faster-iter-by-ref?expand=1#diff-1398f322bc563592215b583e9b0ba936R2390), and ended up getting really disturbing test failures like
```
thread 'iter::test_by_ref_folds' panicked at 'assertion failed: `(left == right)`
  left: `15`,
 right: `15`', src\libcore\../libcore/tests\iter.rs:1720:4
```

So since this wasn't the most critical part of the change and a new beta is branching within a week, I think putting this part back to what it was before is the best option.
2017-11-19 12:20:14 +00:00
Eduard-Mihai Burtescu
b0812de556 cargotest: temporarily use eddyb/servo to include servo/servo#19285. 2017-11-19 11:48:12 +02:00
Eduard-Mihai Burtescu
fb832833e2 Don't glob-import overlapping variant names in test/codegen/match-optimizes-away.rs. 2017-11-19 09:12:10 +02:00
bors
c5c70ef723 Auto merge of #46064 - Keruspe:master, r=sfackler
update openssl{,-sys} to fix build with libressl 2.6.x
2017-11-19 05:19:10 +00:00
bors
8703e7d0e3 Auto merge of #46048 - cramertj:update-libc-2, r=alexcrichton
Update libc to include Fuchsia changes

This is an update of libc to include the updated Fuchsia "open" flags added in https://github.com/rust-lang/libc/pull/849.

cc @smklein
r? @alexcrichton
2017-11-19 03:02:15 +00:00
Eduard-Mihai Burtescu
95687bfe27 rustc_trans: (hack) use preferred alignment for atomic loads/stores. 2017-11-19 03:56:37 +02:00
Eduard-Mihai Burtescu
753d582f62 rustc: rename CachedLayout to LayoutDetails. 2017-11-19 02:43:56 +02:00
Eduard-Mihai Burtescu
8437d7c0f1 rustc: extend the niche-filling enum optimization past 2 variants. 2017-11-19 02:43:56 +02:00
Eduard-Mihai Burtescu
d893285b65 rustc: use layout::Abi::ScalarPair for structs in more cases. 2017-11-19 02:43:56 +02:00
Eduard-Mihai Burtescu
801a1a0fc1 rustc_trans: remove type_is_fat_ptr and its uses. 2017-11-19 02:43:56 +02:00
Eduard-Mihai Burtescu
fa67abd127 rustc: don't special-case Box<T> as having a pointer layout. 2017-11-19 02:43:55 +02:00
Eduard-Mihai Burtescu
18ecc564f2 rustc_trans: support scalar pairs directly in the Rust ABI. 2017-11-19 02:43:55 +02:00
Eduard-Mihai Burtescu
7a36141465 rustc: unpack scalar pair newtype layout ABIs. 2017-11-19 02:43:55 +02:00
Eduard-Mihai Burtescu
37a7521ef9 rustc: unpack scalar newtype layout ABIs. 2017-11-19 02:43:55 +02:00
Eduard-Mihai Burtescu
0b8697241f rustc_trans: be more relaxed with non-lvalue consumes, especially ZSTs. 2017-11-19 02:43:55 +02:00
Eduard-Mihai Burtescu
c4d9ada701 rustc: place ZSTs first during struct field reordering. 2017-11-19 02:43:55 +02:00
Eduard-Mihai Burtescu
cdeb4b0d25 rustc: encode scalar pairs in layout ABI. 2017-11-19 02:43:32 +02:00
Eduard-Mihai Burtescu
f1b7cd9925 rustc_trans: restrict "immediate pairs" to pairs of scalars. 2017-11-19 02:14:33 +02:00
Eduard-Mihai Burtescu
ac60872077 rustc_trans: generate LLVM pointee types based on alignment. 2017-11-19 02:14:33 +02:00
Eduard-Mihai Burtescu
f8d5d0c30c rustc_trans: compute better align/dereferenceable attributes from pointees. 2017-11-19 02:14:33 +02:00
Eduard-Mihai Burtescu
ced5e04e8b rustc: optimize out uninhabited types and variants. 2017-11-19 02:14:33 +02:00
Eduard-Mihai Burtescu
f62e43da28 rustc: track validity ranges for layout::Abi::Scalar values. 2017-11-19 02:14:33 +02:00
Eduard-Mihai Burtescu
5df25c4aed rustc: remove redundant/unused fields from layout::Abi::Vector. 2017-11-19 02:14:33 +02:00
Eduard-Mihai Burtescu
b203a26efb rustc: generalize layout::Variants::NicheFilling to niches other than 0. 2017-11-19 02:14:33 +02:00
Eduard-Mihai Burtescu
0190f270c1 rustc_trans: check for layout::I1 instead of TyBool. 2017-11-19 02:14:33 +02:00
Eduard-Mihai Burtescu
abbc1ddbd0 rustc: make TyLayout::field(NonZero<*T>, 0) return &T. 2017-11-19 02:14:33 +02:00
Eduard-Mihai Burtescu
de3e581e29 rustc: support u128 discriminant ranges. 2017-11-19 02:14:32 +02:00
Eduard-Mihai Burtescu
018323ffc2 rustc: collapse the remains of Layout into Variants (enums vs everything else). 2017-11-19 02:14:32 +02:00
Eduard-Mihai Burtescu
b28f668e26 rustc: move size, align & primitive_align from Abi::Aggregate to layout. 2017-11-19 02:14:32 +02:00
Eduard-Mihai Burtescu
b723af284a rustc_trans: go through layouts uniformly for fat pointers and variants. 2017-11-19 02:14:32 +02:00
Eduard-Mihai Burtescu
026214c858 rustc: collapse Layout::FatPointer into Layout::Univariant. 2017-11-19 02:14:32 +02:00
Eduard-Mihai Burtescu
3fd6b00082 rustc_trans: query LLVM types from a layout instead of a Ty. 2017-11-19 02:14:32 +02:00
Eduard-Mihai Burtescu
1477119344 rustc_trans: keep a layout instead of a type in {Lvalue,Operand}Ref. 2017-11-19 02:14:32 +02:00
Eduard-Mihai Burtescu
88f70323e4 rustc_trans: nest abi::ArgType's for fat pointers instead of eagerly flattening. 2017-11-19 02:14:31 +02:00
Eduard-Mihai Burtescu
f2e7e17d9e rustc_trans: pass OperandRef arguments to trans_intrinsic_call. 2017-11-19 02:14:31 +02:00
Eduard-Mihai Burtescu
b2d52d2132 rustc: do not pub use Layout::* in layout. 2017-11-19 02:14:31 +02:00
Eduard-Mihai Burtescu
d0ab6e8644 rustc_trans: compute LLVM types from type layouts, not Rust types. 2017-11-19 02:14:31 +02:00
Eduard-Mihai Burtescu
fad99542c8 rustc: split layout::FieldPlacement::Linear back into Union and Array. 2017-11-19 02:14:31 +02:00
Eduard-Mihai Burtescu
18d54aa7d5 rustc: move layout::Struct into FieldPlacement/Abi. 2017-11-19 02:14:31 +02:00
Eduard-Mihai Burtescu
08f9f134fd rustc: hide details in Layout in favor of Abi or FieldPlacement. 2017-11-19 02:14:31 +02:00
Eduard-Mihai Burtescu
ed788a62f6 rustc: store CachedLayout for each variant of enum Layout's instead of Struct. 2017-11-19 02:14:31 +02:00