Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 10 pull requests #69085

Closed
wants to merge 42 commits into from

Conversation

Dylan-DPC-zz
Copy link

Successful merges:

Failed merges:

r? @ghost

matthewjasper and others added 30 commits February 2, 2020 21:46
Union fields have the ParamEnv of the union.
* Handle cycles in `needs_drop` correctly
* Normalize types when computing `needs_drop`
* Move queries from rustc to rustc_ty
* Handle arrays with const-generic lengths
* Use closure for repeated code.
Currently, every iteration of the main loop in `generic_extension`
instantiates a `Parser`, which is expensive because `Parser` is a large
type. Many of those instantiations are only used immutably, particularly
for simple-but-repetitive macros of the sort seen in `html5ever` and PR
68836.

This commit initializes a single "base" parser outside the loop, and
then uses `Cow` to avoid cloning it except for the mutating iterations.
This speeds up `html5ever` runs by up to 15%.
The previous commit wrapped `Parser` within a `Cow` for the hot macro
parsing path. As a result, there's no need for the `Cow` within
`Directory`, because it lies within `Parser`.
This is a small win, because `Failure` is much more common than
`Success`.
This makes it more ergonomic to create a dataflow engine and obviates
the need to pick between `new_gen_kill` and `new_generic`.
Co-Authored-By: Mazdak Farrokhzad <[email protected]>
Co-Authored-By: Tim Robinson <[email protected]>
Co-Authored-By: Peter Todd <[email protected]>
Co-Authored-By: Dylan DPC <[email protected]>
estebank and others added 12 commits February 11, 2020 12:42
…ls, r=pnkfelix

Migrate borrowck dataflow impls to new framework

This uses rust-lang#65672 to implement the dataflow analyses needed by borrowck. These include all the `InitializedPlaces` analyses as well as `Borrows`. Additionally, this PR contains several independent changes around the dataflow API which improve performance and make it more ergonomic.

* An optimization that inhibits the caching of block transfer functions for acyclic MIR (~0.3% I-CNT savings).
* A `ResultsVisitor` for dataflow results that is more efficient than `ResultsCursor` when we have to visit every statement unconditionally (~0.3% I-CNT savings).
* An `into_engine` method on `Analysis` that selects the appropriate `Engine` constructor.
* A `contains` method for `ResultsCursor` as a shorthand for `.get().contains()`.
* A `find_descendants` helper on `MovePath` that replaces `has_any_child_of` on the old `FlowsAtLocation`

These changes made porting the dataflow analyses much easier. Finally, this PR removes some now-unused code in `dataflow/at_location.rs` and elsewhere.

You can view the perf results for the final version of this PR [here](https://perf.rust-lang.org/compare.html?start=29b854fb741809c29764e33fc17c32ba9c6523ba&end=6e516c1410c18cfe4eb6d030a39fdb73c8d8a4fe). Here's an example of the graphviz diagrams that are generated for the `MaybeInitializedPlaces` analysis.

![image](https://user-images.githubusercontent.com/29463364/72846117-c3e97d80-3c54-11ea-8171-3d48981c9ddd.png)
Improve `ty.needs_drop`

* Handle cycles in `needs_drop` correctly
* Normalize types when computing `needs_drop`
* Move queries from rustc to rustc_ty
* Avoid query in simple cases

reopens rust-lang#65918
…enkov

On mismatched argument count point at arguments
Add missing `_zeroed` varants to `AllocRef`

The majority of the allocator wg has decided to add the missing `_zeroed` variants to `AllocRef`:

> these should be added since they can be efficiently implemented with the `mremap` system call on Linux. `mremap` allows you to move/grow/shrink a memory mapping, and any new pages added for growth are guaranteed to be zeroed.
>
> If `AllocRef` does not have these methods then the user will have to manually write zeroes to the added memory since the API makes no guarantees on their contents.

For the full discussion please see rust-lang/wg-allocators#14.

This PR provides default implementations for `realloc_zeroed`, `alloc_excess_zeroed`, `realloc_excess_zeroed`, and `grow_in_place_zeroed`.

r? @Amanieu
…t-lang#69017, r=petrochenkov

ICE in nightly-2020-02-08: handle TerminatorKind::Yield in librustc_mir::transform::promote_consts::Validator method

IR: rust-lang#69017
regressed commit: rust-lang@f8fd462
Source: https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=55e65a869e1f5fef64cc4462b1a5a087

Addresses ICE reported in rust-lang#69017 by handling `TerminatorKind::Yield` in https://github.com/rust-lang/rust/blob/4d1241f5158ffd66730e094d8f199ed654ed52ae/src/librustc_mir/transform/promote_consts.rs#L465-L468.

<details><summary>Nightly build</summary>
<p>

```
$ cargo +nightly build
Compiling yielder v0.1.0 (/Users/chris/Desktop/tests/rustlang-tests/yielder)
error: internal compiler error: src/librustc_mir/transform/promote_consts.rs:467: _1 = suspend(move _21) -> [resume: bb2, drop: bb3] not promotable
 --> src/main.rs:8:27
  |
8 |         println!("-> {}", yield);
  |                           ^^^^^

thread 'rustc' panicked at 'Box<Any>', <::std::macros::panic macros>:2:4
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports

note: rustc 1.43.0-nightly (71c7e14 2020-02-09) running on x86_64-apple-darwin

note: compiler flags: -C debuginfo=2 -C incremental --crate-type bin

note: some of the compiler flags provided by cargo are hidden

error: aborting due to previous error

error: could not compile `yielder`.

To learn more, run the command again with --verbose.
```

</p>
</details>

<details><summary>Stage 1 dev build</summary>
<p>

```
$ cargo +stage1 build
Compiling yielder v0.1.0 (/Users/chris/Desktop/tests/rustlang-tests/yielder)
warning: function is never used: `gen`
 --> src/main.rs:6:4
  |
6 | fn gen() -> impl Generator<usize> {
  |    ^^^
  |
  = note: `#[warn(dead_code)]` on by default

    Finished dev [unoptimized + debuginfo] target(s) in 0.53s
```

</p>
</details>

@jonas-schievink @oli-obk
Preparation for allocator aware `Box`

This cleans up the `Box` code a bit, and uses `Box::from_raw(ptr)` instead of `Box(ptr)`.
Additionally, `box_free` and `exchange_malloc` now uses the `AllocRef` trait and a comment was added on how `box_free` is tied to `Box`.

This a preparation for an upcoming PR, which makes `Box` aware of an allocator.

r? @Amanieu
@Dylan-DPC-zz
Copy link
Author

@bors r+ p=10 rollup=never

@bors
Copy link
Contributor

bors commented Feb 12, 2020

📌 Commit 19bd8af has been approved by Dylan-DPC

@bors bors added the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Feb 12, 2020
@Dylan-DPC-zz Dylan-DPC-zz added the rollup A PR which is a rollup label Feb 12, 2020
@ecstatic-morse
Copy link
Contributor

@Dylan-DPC #68241 was rollup=never for perf reasons. Can you remove it?

@bors
Copy link
Contributor

bors commented Feb 12, 2020

⌛ Testing commit 19bd8af with merge a139bf1b680a4091f993c56bbab996856c4b8e83...

@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-aux of your PR failed (pretty log, raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
2020-02-12T07:03:08.3651061Z failures:
2020-02-12T07:03:08.3651128Z 
2020-02-12T07:03:08.3651970Z ---- check::check_fail stdout ----
2020-02-12T07:03:08.3652454Z running `/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/cargo check`
2020-02-12T07:03:08.3653159Z thread 'check::check_fail' panicked at '
2020-02-12T07:03:08.3653274Z Expected: execs
2020-02-12T07:03:08.3653369Z     but: expected to find:
2020-02-12T07:03:08.3653791Z [..]this function takes 0 parameters but 1 parameter was supplied
2020-02-12T07:03:08.3653946Z did not find in output:
2020-02-12T07:03:08.3654454Z     Checking bar v0.1.0 (/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/cit/t449/bar)
2020-02-12T07:03:08.3654454Z     Checking bar v0.1.0 (/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/cit/t449/bar)
2020-02-12T07:03:08.3654941Z     Checking foo v0.0.1 (/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/cit/t449/foo)
2020-02-12T07:03:08.3655068Z error[E0061]: this function takes 0 arguments but 1 argument was supplied
2020-02-12T07:03:08.3655504Z   |
2020-02-12T07:03:08.3655504Z   |
2020-02-12T07:03:08.3655586Z 1 | extern crate bar; fn main() { ::bar::baz(42); }
2020-02-12T07:03:08.3655956Z   |                               ^^^^^^^^^^ -- supplied 1 argument
2020-02-12T07:03:08.3656397Z   |                               expected 0 arguments
2020-02-12T07:03:08.3656475Z 
2020-02-12T07:03:08.3656567Z error: aborting due to previous error
2020-02-12T07:03:08.3656619Z 
---
2020-02-12T07:03:08.3694536Z 
2020-02-12T07:03:08.3694600Z 
2020-02-12T07:03:08.3700902Z failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test src/test/run-fail/pretty src/test/run-pass-valgrind/pretty src/tools/cargo src/tools/cargotest
2020-02-12T07:03:08.3701082Z Build completed unsuccessfully in 1:55:45
2020-02-12T07:03:08.3756889Z Makefile:50: recipe for target 'check-aux' failed
2020-02-12T07:03:08.3757067Z == clock drift check ==
2020-02-12T07:03:08.3758320Z   local time: make: *** [check-aux] Error 1
2020-02-12T07:03:08.6529361Z   network time: Wed, 12 Feb 2020 07:03:08 GMT
2020-02-12T07:03:08.6529523Z == end clock drift check ==
2020-02-12T07:03:11.3740577Z 
2020-02-12T07:03:11.3740577Z 
2020-02-12T07:03:11.3868968Z ##[error]Bash exited with code '2'.
2020-02-12T07:03:11.3927942Z ##[section]Starting: Checkout rust-lang/rust@auto to s
2020-02-12T07:03:11.3930742Z ==============================================================================
2020-02-12T07:03:11.3930850Z Task         : Get sources
2020-02-12T07:03:11.3930972Z Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN. (Feature Requests)

@bors
Copy link
Contributor

bors commented Feb 12, 2020

💔 Test failed - checks-azure

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Feb 12, 2020
@JohnTitor JohnTitor closed this Feb 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rollup A PR which is a rollup S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
Projects
None yet
Development

Successfully merging this pull request may close these issues.