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

Fact generation for liveness calculations in Polonius #60266

Merged
merged 3 commits into from Jul 13, 2019

Conversation

@albins
Copy link
Contributor

commented Apr 25, 2019

This PR tracks ongoing work to extend rustc with support for generating variable use, definition, and later also drop output for the Polonius solver, the whole of which is being tracked in Polonius Issue #104.

@rust-highfive

This comment has been minimized.

Copy link
Collaborator

commented Apr 25, 2019

r? @eddyb

(rust_highfive has picked a reviewer for you, use r? to override)

@albins

This comment has been minimized.

Copy link
Contributor Author

commented Apr 25, 2019

@rust-highfive rust-highfive assigned nikomatsakis and unassigned eddyb Apr 25, 2019

@rust-highfive

This comment was marked as outdated.

Copy link
Collaborator

commented Apr 25, 2019

The job x86_64-gnu-llvm-6.0 of your PR failed on Travis (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.
travis_time:end:032b667f:start=1556203980226844455,finish=1556204068967232341,duration=88740387886
$ git checkout -qf FETCH_HEAD
travis_fold:end:git.checkout

Encrypted environment variables have been removed for security reasons.
See https://docs.travis-ci.com/user/pull-requests/#pull-requests-and-security-restrictions
$ export SCCACHE_BUCKET=rust-lang-ci-sccache2
$ export SCCACHE_REGION=us-west-1
$ export GCP_CACHE_BUCKET=rust-lang-ci-cache
$ export AWS_ACCESS_KEY_ID=AKIA46X5W6CZEJZ6XT55
---
[00:13:33]    Compiling rustc_allocator v0.0.0 (/checkout/src/librustc_allocator)
[00:13:37] error[E0107]: wrong number of type arguments: expected 3, found 4
[00:13:37]   --> src/librustc_mir/borrow_check/flows.rs:24:75
[00:13:37]    |
[00:13:37] 24 | crate type PoloniusOutput = Output<RegionVid, BorrowIndex, LocationIndex, Local>;
[00:13:37] 
[00:13:37] error[E0107]: wrong number of type arguments: expected 3, found 4
[00:13:37]   --> src/librustc_mir/borrow_check/nll/facts.rs:14:79
[00:13:37]    |
[00:13:37]    |
[00:13:37] 14 | crate type AllFacts = PoloniusAllFacts<RegionVid, BorrowIndex, LocationIndex, Local>;
[00:13:37] 
[00:13:37] error[E0107]: wrong number of type arguments: expected 3, found 4
[00:13:37]   --> src/librustc_mir/borrow_check/nll/mod.rs:85:61
[00:13:37]    |
[00:13:37]    |
[00:13:37] 85 |     Option<Rc<Output<RegionVid, BorrowIndex, LocationIndex, Local>>>,
[00:13:37] 
[00:13:37] error: aborting due to 3 previous errors
[00:13:37] 
[00:13:37] For more information about this error, try `rustc --explain E0107`.
---
travis_time:end:0f0a9c68:start=1556205055484666377,finish=1556205055489057479,duration=4391102
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:2fd5141a
$ ln -s . checkout && for CORE in obj/cores/core.*; do EXE=$(echo $CORE | sed 's|obj/cores/core\.[0-9]*\.!checkout!\(.*\)|\1|;y|!|/|'); if [ -f "$EXE" ]; then printf travis_fold":start:crashlog\n\033[31;1m%s\033[0m\n" "$CORE"; gdb --batch -q -c "$CORE" "$EXE" -iex 'set auto-load off' -iex 'dir src/' -iex 'set sysroot .' -ex bt -ex q; echo travis_fold":"end:crashlog; fi; done || true
travis_fold:end:after_failure.4
travis_fold:start:after_failure.5
travis_time:start:0d6b867c
travis_time:start:0d6b867c
$ cat ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers || true
cat: ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers: No such file or directory
travis_fold:end:after_failure.5
travis_fold:start:after_failure.6
travis_time:start:0106a454
$ dmesg | grep -i kill

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)

@nikomatsakis
Copy link
Contributor

left a comment

Looks basically correct to me!

@nikomatsakis

This comment has been minimized.

Copy link
Contributor

commented Apr 30, 2019

Marking as "waiting on author", as we're waiting on @albins to do some of the next steps.

@@ -27,14 +27,21 @@ impl LivenessFactsExtractor<'_> {
.var_used
.push((local, self.location_to_index(location)));
}

fn insert_drop(&mut self, local: Local, location: Location) {

This comment has been minimized.

Copy link
@nikomatsakis

nikomatsakis May 6, 2019

Contributor

seems correct

@albins albins force-pushed the albins:polonius-liveness branch from 06281e5 to 004b492 May 21, 2019

@rust-highfive

This comment was marked as outdated.

Copy link
Collaborator

commented May 21, 2019

The job x86_64-gnu-llvm-6.0 of your PR failed on Travis (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.
travis_time:end:00a4f380:start=1558428844441634881,finish=1558428847120595002,duration=2678960121
$ git checkout -qf FETCH_HEAD
travis_fold:end:git.checkout

Encrypted environment variables have been removed for security reasons.
See https://docs.travis-ci.com/user/pull-requests/#pull-requests-and-security-restrictions
$ export SCCACHE_BUCKET=rust-lang-ci-sccache2
$ export SCCACHE_REGION=us-west-1
$ export GCP_CACHE_BUCKET=rust-lang-ci-cache
$ export AWS_ACCESS_KEY_ID=AKIA46X5W6CZEJZ6XT55
---

[00:04:32] travis_fold:start:tidy
travis_time:start:tidy
tidy check
[00:04:32] tidy error: /checkout/src/librustc_mir/borrow_check/nll/type_check/liveness/trace.rs:277: line longer than 100 chars
[00:04:37] some tidy checks failed
[00:04:37] 
[00:04:37] 
[00:04:37] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/tidy" "/checkout/src" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "--no-vendor" "--quiet"
[00:04:37] 
[00:04:37] 
[00:04:37] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test src/tools/tidy
[00:04:37] Build completed unsuccessfully in 0:01:13
[00:04:37] Build completed unsuccessfully in 0:01:13
[00:04:37] make: *** [tidy] Error 1
[00:04:37] Makefile:67: recipe for target 'tidy' failed
The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:10e7be0c
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)
Tue May 21 08:58:55 UTC 2019
---
travis_time:end:003d3266:start=1558429136502514438,finish=1558429136507252724,duration=4738286
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:062ca294
$ ln -s . checkout && for CORE in obj/cores/core.*; do EXE=$(echo $CORE | sed 's|obj/cores/core\.[0-9]*\.!checkout!\(.*\)|\1|;y|!|/|'); if [ -f "$EXE" ]; then printf travis_fold":start:crashlog\n\033[31;1m%s\033[0m\n" "$CORE"; gdb --batch -q -c "$CORE" "$EXE" -iex 'set auto-load off' -iex 'dir src/' -iex 'set sysroot .' -ex bt -ex q; echo travis_fold":"end:crashlog; fi; done || true
travis_fold:end:after_failure.4
travis_fold:start:after_failure.5
travis_time:start:0a4af6d6
travis_time:start:0a4af6d6
$ cat ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers || true
cat: ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers: No such file or directory
travis_fold:end:after_failure.5
travis_fold:start:after_failure.6
travis_time:start:0a7cf394
$ dmesg | grep -i kill

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)

@rust-highfive

This comment was marked as outdated.

Copy link
Collaborator

commented May 21, 2019

The job x86_64-gnu-llvm-6.0 of your PR failed on Travis (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.
travis_time:end:00fdb1b6:start=1558439894289278398,finish=1558439896523587357,duration=2234308959
$ git checkout -qf FETCH_HEAD
travis_fold:end:git.checkout

Encrypted environment variables have been removed for security reasons.
See https://docs.travis-ci.com/user/pull-requests/#pull-requests-and-security-restrictions
$ export SCCACHE_BUCKET=rust-lang-ci-sccache2
$ export SCCACHE_REGION=us-west-1
$ export GCP_CACHE_BUCKET=rust-lang-ci-cache
$ export AWS_ACCESS_KEY_ID=AKIA46X5W6CZEJZ6XT55
---
[00:16:38]    Compiling rustc_allocator v0.0.0 (/checkout/src/librustc_allocator)
[00:16:42] error[E0107]: wrong number of type arguments: expected 3, found 4
[00:16:42]   --> src/librustc_mir/borrow_check/flows.rs:24:75
[00:16:42]    |
[00:16:42] 24 | crate type PoloniusOutput = Output<RegionVid, BorrowIndex, LocationIndex, Local>;
[00:16:42] 
[00:16:42] error[E0107]: wrong number of type arguments: expected 3, found 4
[00:16:42]   --> src/librustc_mir/borrow_check/nll/facts.rs:14:79
[00:16:42]    |
[00:16:42]    |
[00:16:42] 14 | crate type AllFacts = PoloniusAllFacts<RegionVid, BorrowIndex, LocationIndex, Local>;
[00:16:42] 
[00:16:42] error[E0107]: wrong number of type arguments: expected 3, found 4
[00:16:42]   --> src/librustc_mir/borrow_check/nll/mod.rs:86:61
[00:16:42]    |
[00:16:42]    |
[00:16:42] 86 |     Option<Rc<Output<RegionVid, BorrowIndex, LocationIndex, Local>>>,
[00:16:42] 
[00:16:42] error: aborting due to 3 previous errors
[00:16:42] 
[00:16:42] For more information about this error, try `rustc --explain E0107`.

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

This comment was marked as outdated.

Copy link
Contributor

commented May 25, 2019

☔️ The latest upstream changes (presumably #60441) made this pull request unmergeable. Please resolve the merge conflicts.

@albins albins force-pushed the albins:polonius-liveness branch from a9394a1 to f8ca709 May 29, 2019

@rust-highfive

This comment was marked as outdated.

Copy link
Collaborator

commented May 29, 2019

The job x86_64-gnu-llvm-6.0 of your PR failed on Travis (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.
travis_time:end:0ff26400:start=1559142905552742939,finish=1559142908307082584,duration=2754339645
$ git checkout -qf FETCH_HEAD
travis_fold:end:git.checkout

Encrypted environment variables have been removed for security reasons.
See https://docs.travis-ci.com/user/pull-requests/#pull-requests-and-security-restrictions
$ export SCCACHE_BUCKET=rust-lang-ci-sccache2
$ export SCCACHE_REGION=us-west-1
$ export GCP_CACHE_BUCKET=rust-lang-ci-cache
$ export AWS_ACCESS_KEY_ID=AKIA46X5W6CZEJZ6XT55
---
[00:14:57]    Compiling rustc_typeck v0.0.0 (/checkout/src/librustc_typeck)
[00:15:01] error[E0107]: wrong number of type arguments: expected 3, found 4
[00:15:01]   --> src/librustc_mir/borrow_check/flows.rs:24:75
[00:15:01]    |
[00:15:01] 24 | crate type PoloniusOutput = Output<RegionVid, BorrowIndex, LocationIndex, Local>;
[00:15:01] 
[00:15:01] error[E0107]: wrong number of type arguments: expected 3, found 4
[00:15:01]   --> src/librustc_mir/borrow_check/nll/facts.rs:14:79
[00:15:01]    |
[00:15:01]    |
[00:15:01] 14 | crate type AllFacts = PoloniusAllFacts<RegionVid, BorrowIndex, LocationIndex, Local>;
[00:15:01] 
[00:15:01] error[E0107]: wrong number of type arguments: expected 3, found 4
[00:15:01]   --> src/librustc_mir/borrow_check/nll/mod.rs:86:61
[00:15:01]    |
[00:15:01]    |
[00:15:01] 86 |     Option<Rc<Output<RegionVid, BorrowIndex, LocationIndex, Local>>>,
[00:15:01] 
[00:15:01] error: aborting due to 3 previous errors
[00:15:01] 
[00:15:01] For more information about this error, try `rustc --explain E0107`.
---
travis_time:end:0526f76c:start=1559143986754407863,finish=1559143986758989680,duration=4581817
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:286c066b
$ ln -s . checkout && for CORE in obj/cores/core.*; do EXE=$(echo $CORE | sed 's|obj/cores/core\.[0-9]*\.!checkout!\(.*\)|\1|;y|!|/|'); if [ -f "$EXE" ]; then printf travis_fold":start:crashlog\n\033[31;1m%s\033[0m\n" "$CORE"; gdb --batch -q -c "$CORE" "$EXE" -iex 'set auto-load off' -iex 'dir src/' -iex 'set sysroot .' -ex bt -ex q; echo travis_fold":"end:crashlog; fi; done || true
travis_fold:end:after_failure.4
travis_fold:start:after_failure.5
travis_time:start:009ded4c
travis_time:start:009ded4c
$ cat ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers || true
cat: ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers: No such file or directory
travis_fold:end:after_failure.5
travis_fold:start:after_failure.6
travis_time:start:1b633703
$ dmesg | grep -i kill

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)

@albins

This comment has been minimized.

Copy link
Contributor Author

commented May 30, 2019

Now waiting for changes to land in Polonius: rust-lang/polonius#105

@albins albins force-pushed the albins:polonius-liveness branch from f8ca709 to 541654e Jun 7, 2019

@albins albins changed the title [WIP] Fact generation for liveness calculations in Polonius Fact generation for liveness calculations in Polonius Jun 7, 2019

@albins

This comment has been minimized.

Copy link
Contributor Author

commented Jun 7, 2019

Hopefully not WIP anymore now that rust-lang/polonius#104 is merged!

@bors

This comment has been minimized.

Copy link
Contributor

commented Jun 10, 2019

☔️ The latest upstream changes (presumably #61506) made this pull request unmergeable. Please resolve the merge conflicts.

@albins

This comment has been minimized.

Copy link
Contributor Author

commented Jun 12, 2019

We have decided to do preliminary work on integrating initializiation tracking as well before merging this in order to get (hopefully) exactly the same output as rustc from Polonius, so back to WIP!

@albins albins changed the title Fact generation for liveness calculations in Polonius [WIP] Fact generation for liveness calculations in Polonius Jun 12, 2019

@albins albins force-pushed the albins:polonius-liveness branch 2 times, most recently from f62fffe to c0a7fc5 Jun 12, 2019

@albins albins force-pushed the albins:polonius-liveness branch 2 times, most recently from 9bebddb to cd0d6fe Jul 1, 2019

@albins

This comment has been minimized.

Copy link
Contributor Author

commented Jul 9, 2019

This branch now has preliminary liveness calculations that uses a hack to extract initialisation status, which is needed for correct drop-liveness calculations. When we have initialisation tracking in Polonius that hack will go away, but for now and to the best of our knowledge these inputs compute exactly the same region liveness tuples as rustc previously generated, including for tricky edge cases™.

@albins albins changed the title [WIP] Fact generation for liveness calculations in Polonius Fact generation for liveness calculations in Polonius Jul 9, 2019

@nikomatsakis

This comment has been minimized.

Copy link
Contributor

commented Jul 12, 2019

@bors r+

@lqd

This comment has been minimized.

Copy link
Contributor

commented Jul 12, 2019

Just in case bors ignores commands on S-waiting-on-author:

@bors r=nikomatsakis

@pietroalbini

This comment has been minimized.

Copy link
Member

commented Jul 12, 2019

@bors r=nikomatsakis

@bors

This comment has been minimized.

Copy link
Contributor

commented Jul 12, 2019

📌 Commit 0612a66 has been approved by nikomatsakis

@bors

This comment was marked as resolved.

Copy link
Contributor

commented Jul 12, 2019

🔒 Merge conflict

This pull request and the master branch diverged in a way that cannot be automatically merged. Please rebase on top of the latest master branch, and let the reviewer approve again.

How do I rebase?

Assuming self is your fork and upstream is this repository, you can resolve the conflict following these steps:

  1. git checkout polonius-liveness (switch to your branch)
  2. git fetch upstream master (retrieve the latest master)
  3. git rebase upstream/master -p (rebase on top of it)
  4. Follow the on-screen instruction to resolve conflicts (check git status if you got lost).
  5. git push self polonius-liveness --force-with-lease (update this PR)

You may also read Git Rebasing to Resolve Conflicts by Drew Blessing for a short tutorial.

Please avoid the "Resolve conflicts" button on GitHub. It uses git merge instead of git rebase which makes the PR commit history more difficult to read.

Sometimes step 4 will complete without asking for resolution. This is usually due to difference between how Cargo.lock conflict is handled during merge and rebase. This is normal, and you should still perform step 5 to update this PR.

Error message
warning: Cannot merge binary files: Cargo.lock (HEAD vs. heads/homu-tmp)
Auto-merging src/librustc_mir/Cargo.toml
Auto-merging src/librustc/mir/mod.rs
Auto-merging src/librustc/Cargo.toml
Auto-merging Cargo.lock
CONFLICT (content): Merge conflict in Cargo.lock
Automatic merge failed; fix conflicts and then commit the result.

@albins albins force-pushed the albins:polonius-liveness branch from 0612a66 to 955e8bc Jul 12, 2019

albins added some commits Jul 12, 2019

polonius: add generation of liveneness-related facts
Notably contains an ugly hack to generate initialization information for
variables that will go away when we have that functionality in Polonius.

@albins albins force-pushed the albins:polonius-liveness branch from 955e8bc to 9d3c59d Jul 12, 2019

@lqd

This comment has been minimized.

Copy link
Contributor

commented Jul 13, 2019

Rebase is done

@bors r=nikomatsakis

@bors

This comment has been minimized.

Copy link
Contributor

commented Jul 13, 2019

📌 Commit 9d3c59d has been approved by nikomatsakis

@bors

This comment has been minimized.

Copy link
Contributor

commented Jul 13, 2019

⌛️ Testing commit 9d3c59d with merge 6b468c6...

bors added a commit that referenced this pull request Jul 13, 2019

Auto merge of #60266 - albins:polonius-liveness, r=nikomatsakis
Fact generation for liveness calculations in Polonius

This PR tracks ongoing work to extend `rustc` with support for generating variable use, definition, and later also drop output for the Polonius solver, the whole of which is being tracked in [Polonius Issue #104](rust-lang/polonius#104).
@bors

This comment has been minimized.

Copy link
Contributor

commented Jul 13, 2019

☀️ Test successful - checks-azure, checks-travis, status-appveyor
Approved by: nikomatsakis
Pushing 6b468c6 to master...

@bors bors added the merged-by-bors label Jul 13, 2019

@bors bors merged commit 9d3c59d into rust-lang:master Jul 13, 2019

4 checks passed

homu Test successful
Details
pr Build #20190712.61 succeeded
Details
pr (Linux mingw-check) Linux mingw-check succeeded
Details
pr (Linux x86_64-gnu-llvm-6.0) Linux x86_64-gnu-llvm-6.0 succeeded
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
7 participants
You can’t perform that action at this time.