Commit Graph

63435 Commits

Author SHA1 Message Date
bors 252d3da8a6 Auto merge of #41469 - arielb1:rustc-spring-cleaning, r=eddyb
Performance audit, Spring 2017

Fix up some quite important performance "surprises" I've found running callgrind on rustc.
2017-04-22 20:07:01 +00:00
Ariel Ben-Yehuda a660ad84b3 bail out of selection when there are multiple surviving candidates
In some cases (e.g. <[int-var] as Add<[int-var]>>), selection can turn up
a large number of candidates. Bailing out early avoids O(n^2) performance.

This improves item-type checking time by quite a bit, resulting in ~2% of total
time-to-typeck.
2017-04-22 21:02:50 +03:00
Ariel Ben-Yehuda a0f145ba8c add a cache to impl_polarity
this is another one of these things that looks *much* worse on valgrind.
2017-04-22 21:02:41 +03:00
Ariel Ben-Yehuda 81af6fb67c allocate less strings in `symbol_names`
this improves trans performance by *another* 10%.
2017-04-22 21:02:02 +03:00
Ariel Ben-Yehuda 266d36f3b1 weak_lang_items: check for `lang` attribute before calling `value_str`
improves trans performance by *another* 10%.
2017-04-22 21:00:50 +03:00
Ariel Ben-Yehuda ece6c8434b cache attributes of items from foreign crates
this avoids parsing item attributes on each call to `item_attrs`, which takes
off 33% (!) of translation time and 50% (!) of trans-item collection time.
2017-04-22 21:00:50 +03:00
Ariel Ben-Yehuda acd0e40b86 short-cut SharedCrateContext::layout_of
That method is *incredibly* hot, so this ends up saving 10% of trans
time.

BTW, we really should be doing dependency tracking there - and possibly be
taking the respective perf hit (got to find a way to make DTMs fast), but
`layout_cache` is a non-dep-tracking map.
2017-04-22 21:00:50 +03:00
Ariel Ben-Yehuda e1377a4f47 avoid calling `mk_region` unnecessarily
this improves typeck & trans performance by 1%. This looked hotter on
callgrind than it is on a CPU.
2017-04-22 21:00:50 +03:00
Ariel Ben-Yehuda 3bf00450cb remove cleanup branches to the resume block
This improves LLVM performance by 10% lost during the shimmir transition.
2017-04-22 21:00:50 +03:00
bors cb4065b9ce Auto merge of #41431 - GuillaumeGomez:hoedown-default, r=aturon
Re-enable hoedown by default

r? @rust-lang/docs

cc @aturon
2017-04-22 17:37:04 +00:00
bors 9cc77d7690 Auto merge of #41464 - frewsxcv:rollup, r=frewsxcv
Rollup of 3 pull requests

- Successful merges: #41077, #41355, #41450
- Failed merges:
2017-04-22 14:17:36 +00:00
Corey Farwell b37163c81c Rollup merge of #41450 - rillian:rustc-wrapper, r=alexcrichton
Update cargo for 1.18.0.

Bump our associated cargo to pick up the RUSTC_WRAPPER feature
for use with build caches.
2017-04-22 09:02:58 -04:00
Corey Farwell e282817186 Rollup merge of #41355 - nikomatsakis:incr-comp-refactor-trans-2, r=eddyb
Refactor trans some more to pave way for incremental compilation

Various refactorings paving the way for the newer approach to incremental compilation (And, in particular, to "query-ifying" trans). My partial goal is to remove `SharedCrateContext`; this PR gets about as far as I can easily get before starting to really want the red/green algorithm.

r? @eddyb
cc @michaelwoerister
2017-04-22 09:02:57 -04:00
Corey Farwell 5e1351b17b Rollup merge of #41077 - petrochenkov:boundparen, r=nikomatsakis
syntax: Support parentheses around trait bounds

An implementation for https://github.com/rust-lang/rust/issues/39318#issuecomment-290956826

r? @nikomatsakis
2017-04-22 09:02:56 -04:00
Guillaume Gomez 9c97882055 Fix line display 2017-04-22 14:56:36 +02:00
bors 6d841da4a0 Auto merge of #39999 - bitshifter:struct_align, r=eddyb
Implementation of repr struct alignment RFC 1358.

The main changes around rustc::ty::Layout::struct:
* Added abi_align field which stores abi alignment before repr align is applied
* align field contains transitive repr alignment
* Added padding vec which stores padding required after fields

The main user of this information is rustc_trans::adt::struct_llfields
which determines the LLVM fields to be used by LLVM, including padding
fields.

A possible future optimisation would be to put the padding Vec in an Option, since it will be unused unless you are using repr align.
2017-04-22 11:50:40 +00:00
Guillaume Gomez 91fb6bc1eb Fix tests 2017-04-22 13:25:14 +02:00
Guillaume Gomez d79b511f5c Fix invalid linkage 2017-04-22 13:25:14 +02:00
Guillaume Gomez 295f25b198 Set hoedown to generate error index 2017-04-22 13:25:14 +02:00
Guillaume Gomez 80a2a94d5a Re-enable hoedown by default 2017-04-22 13:25:14 +02:00
bors ff13b7c918 Auto merge of #41459 - frewsxcv:rollup, r=frewsxcv
Rollup of 4 pull requests

- Successful merges: #37658, #41405, #41432, #41435
- Failed merges:
2017-04-22 03:31:53 +00:00
Corey Farwell df72158d47 Rollup merge of #41435 - estebank:issue-33884, r=nikomatsakis
Add test for issue 33884

Fix #33884.

r=nikomatsakis
2017-04-21 23:29:15 -04:00
Corey Farwell 48a9d5f6d3 Rollup merge of #41432 - abonander:issue_41211, r=jseyfried
Don't panic if an attribute macro fails to resolve at crate root

Adds temporary regression test; this ideally should work as-is (#41430)

Closes #41211

r? @jseyfried
2017-04-21 23:29:15 -04:00
Corey Farwell aff40e2de3 Rollup merge of #41405 - GuillaumeGomez:rustdoc-warning-improvement, r=steveklabnik
Fix line display for hoedown

Fixes #41401.

r? @rust-lang/docs
2017-04-21 23:29:14 -04:00
Corey Farwell 5da19f2b69 Rollup merge of #37658 - GuillaumeGomez:ref_suggestion, r=nikomatsakis,eddyb
Ref suggestion
2017-04-21 23:29:13 -04:00
Niko Matsakis 6d86f81eb1 move the uses of the trans caches into rustc::traits
This makes these routines more readily available for other bits of
code. It also will help when refactoring.
2017-04-21 21:02:14 -04:00
Cameron Hart 946f8e6a59 Use primitive align for tagged enum fill.
Hopefully will fix assert on ARM where vector types are being used as
the fill type for enums containing repr aligned types greater than the
largest possible native type, thus don't match the Layout's alignment
and triggers an assert.
2017-04-22 09:38:23 +10:00
Niko Matsakis 85527456e8 use Symbol/InternedString in the cache 2017-04-21 17:26:53 -04:00
Niko Matsakis f4c183b742 move the trans trait caches into tcx
Arguably these could become custom queries, but I chose not to do that
because the relationship of queries and trait system is not yet fleshed
out enough. For now it seems fine to have them be `DepTrackingMap` using
the memoize pattern.
2017-04-21 17:26:53 -04:00
Niko Matsakis e48a759f51 sort `provide` 2017-04-21 17:26:53 -04:00
Niko Matsakis 264f237f98 make `reachable_set` ref-counted
Once it is computed, no need to deep clone the set.
2017-04-21 17:26:53 -04:00
Niko Matsakis c446cb086b just take `tcx` where we can
The more we can things dependent on just tcx, the easier it will
be to make queries etc later on.
2017-04-21 17:26:53 -04:00
Niko Matsakis 39a58c38a0 introduce the rather simpler symbol-cache in place of symbol-map
The symbol map is not good for incremental: it has inputs from every fn
in existence, and it will change if anything changes. One could imagine
cheating with the symbol-map and exempting it from the usual dependency
tracking, since the results are fully deterministic. Instead, I opted to
just add a per-CGU cache, on the premise that recomputing some symbol
names is not going to be so very expensive.
2017-04-21 17:26:53 -04:00
Niko Matsakis 4c31750cd9 remove `translation_items` from `SharedCrateContext`
If we are going to hash `SharedCrateContext`, we don't want a list of
things that pertain to **every CGU** in there.
2017-04-21 17:26:53 -04:00
Niko Matsakis 8289e5a73e introduce `is_foreign_item` query
This may seem like overkill, but it's exactly what we want/need for
incremental compilation I think. In particular, while generating code
for some codegen unit X, we can wind up querying about any number of
external items, and we only want to be forced to rebuild X is some of
those changed from a foreign item to otherwise. Factoring this into a
query means we would re-run only if some `false` became `true` (or vice
versa).
2017-04-21 17:26:53 -04:00
Guillaume Gomez 7ce1eb77c7 Update ui test 2017-04-21 22:58:15 +02:00
Ralph Giles 1a5c01ccfc Update cargo.
Bump our associated cargo to pick up the RUSTC_WRAPPER feature
for use with build caches.
2017-04-21 11:40:16 -07:00
Vadim Petrochenkov 8838cd10f2 Move parse_remaining_bounds into a separate function 2017-04-21 21:32:44 +03:00
Vadim Petrochenkov 6e75def7db Fix issue with single question mark or paren 2017-04-21 21:32:44 +03:00
Vadim Petrochenkov e038f58105 syntax: Support parentheses around trait bounds 2017-04-21 21:32:44 +03:00
bors 1785bca513 Auto merge of #41445 - frewsxcv:rollup, r=frewsxcv
Rollup of 4 pull requests

- Successful merges: #41372, #41376, #41426, #41429
- Failed merges:
2017-04-21 16:36:41 +00:00
Guillaume Gomez 7d3284ebc1 Create a new method to run coercion inside probe 2017-04-21 16:13:26 +02:00
bors 5695c3e943 Auto merge of #41349 - eddyb:ty-contents, r=nikomatsakis
rustc: replace TypeContents with two independent properties (is_freeze / needs_drop).

`InteriorUnsafe` / `interior_unsafe` was replaced with a private lang-item `Freeze` auto trait in libcore.

`OwnsDtor` / `needs_drop` was replaced with a specialized traversal that *doesn't* avoid caching results in case of a cycle, as the only cycles left can only occur in erroneous "types with infinite sizes", references and raw pointers not having destructors. Also, `Copy` is now checked at every step of the recursion.

r? @nikomatsakis
2017-04-21 14:02:37 +00:00
Eduard-Mihai Burtescu 89bd3f39ca Update #[no_core] users with the "freeze" lang item. 2017-04-21 15:48:35 +03:00
Corey Farwell 35dd55d007 Rollup merge of #41429 - jonathandturner:update_rls_submod, r=alexcrichton
Bump the rls submodule revision

Bump the RLS version to include a few recent fixes.
2017-04-21 08:40:36 -04:00
Corey Farwell d5bbeb1a0a Rollup merge of #41426 - malbarbo:android-x86_64, r=alexcrichton
Add x86_64-linux-android target
2017-04-21 08:40:35 -04:00
Corey Farwell d983256f36 Rollup merge of #41376 - mbrubeck:docs, r=frewsxcv
Expanded docs and examples for PathBuf::file_name and friends

This addresses some common surprises when `PathBuf::set_file_name` is called on the path of a directory rather than a file.

r? @steveklabnik
2017-04-21 08:40:34 -04:00
Corey Farwell cf11d3c66a Rollup merge of #41372 - nbigaouette:master, r=alexcrichton
Use an (over-writable) environment variable for the `gdb` command

Instead of hard-coding the command to run, using the environment
variable `GDB_CMD` (that defaults to `gdb`) allows using a different
debugger than the default `gdb` executable.

This gives the possibility to use `cgdb` as the debugger, which provides
a nicer user interface. Note that one has to use `GDB_CMD="cgdb --"` to
use cgdb (note the trailing `--`) to let cgdb pass the proper arguments
to `gdb`.
2017-04-21 08:40:33 -04:00
Guillaume Gomez 8fe3a9a8f1 Update tests 2017-04-21 12:28:24 +02:00
Guillaume Gomez d360091e79 Add suggestion for & coercions 2017-04-21 12:28:24 +02:00