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

incr: cache dwarf objects in work products #98901

Merged
merged 3 commits into from
Jul 7, 2022

Conversation

davidtwco
Copy link
Member

Cache DWARF objects alongside object files in work products when those exist so that DWARF object files are available for thorin in packed mode in incremental scenarios.

r? @michaelwoerister

@rustbot
Copy link
Collaborator

rustbot commented Jul 4, 2022

Some changes occurred in compiler/rustc_codegen_cranelift

cc @bjorn3

@rustbot rustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Jul 4, 2022
@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jul 4, 2022
@davidtwco davidtwco force-pushed the split-dwarf-incr-workproduct branch from 7563854 to 2d4f865 Compare July 5, 2022 12:10
@michaelwoerister
Copy link
Member

Looks good, @davidtwco! Now we just need a regression test. Compiling twice with -Zsplit-dwarf-kind=split -Csplit-debuginfo=packed and no changes in between triggered bug for me.

@davidtwco
Copy link
Member Author

davidtwco commented Jul 5, 2022

Looks good, @davidtwco! Now we just need a regression test. Compiling twice with -Zsplit-dwarf-kind=split -Csplit-debuginfo=packed and no changes in between triggered bug for me.

I'm struggling to reproduce the issue with these instructions - using a simple case and compiling twice with those flags doesn't cause an issue for me. I've been trying with the following test case:

// Check that compiling with packed Split DWARF twice succeeds. This should confirm that DWARF
// objects are cached as work products and available to the incremental compilation for `thorin` to
// pack into a DWARF package.

// ignore-tidy-linelength
// only-x86_64-unknown-linux-gnu
// revisions:rpass1 rpass2

// [rpass1]compile-flags: -Zquery-dep-graph -Zunstable-options -Csplit-debuginfo=packed -Zsplit-dwarf-kind=split
// [rpass2]compile-flags: -Zquery-dep-graph -Zunstable-options -Csplit-debuginfo=packed -Zsplit-dwarf-kind=split

#![feature(rustc_attrs)]
// For `rpass2`, nothing has changed so everything should re-used.
#![rustc_partition_reused(module = "split_debuginfo_cached", cfg = "rpass2")]
#![rustc_partition_reused(module = "split_debuginfo_cached-another_module", cfg = "rpass2")]

mod another_module {
    pub fn foo() -> &'static str {
        "hello world"
    }
}

pub fn main() {
    println!("{}", another_module::foo());
}

Can't reproduce outside of the test suite either (without this patch obviously).

Nevermind, figured it out, just being stupid - will have a commit up shortly.

Cache DWARF objects alongside object files in work products when those
exist so that DWARF object files are available for thorin in packed mode
in incremental scenarios.

Signed-off-by: David Wood <david.wood@huawei.com>
Compiling with `-Csplit-debuginfo=packed` was leaving behind `.dwo`
files because either the metadata or allocator module contained a DWARF
object which was not being removed by the
`maybe_remove_temps_from_module` closure.
This should have been here from the start... oops. When `thorin` fails
to package a DWARF package, that should fail compilation.
@davidtwco davidtwco force-pushed the split-dwarf-incr-workproduct branch from 2d4f865 to e106523 Compare July 6, 2022 10:15
@davidtwco
Copy link
Member Author

Looks good, @davidtwco! Now we just need a regression test. Compiling twice with -Zsplit-dwarf-kind=split -Csplit-debuginfo=packed and no changes in between triggered bug for me.

Okay, added a test now. I lost some time to a missing -g flag in the test I wrote, which was a little frustrating, and then it turned out that link_dwarf_object wasn't calling abort_if_errors so tests wouldn't fail when thorin had.

I also noticed that we weren't deleting all the DWARF object temporaries in some cases, so I fixed that - we weren't deleting module.dwarf_object for allocator or metadata modules.

@michaelwoerister
Copy link
Member

Great, thanks a lot, @davidtwco!

@bors r+

@bors
Copy link
Contributor

bors commented Jul 6, 2022

📌 Commit e106523 has been approved by michaelwoerister

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jul 6, 2022
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this pull request Jul 7, 2022
…uct, r=michaelwoerister

incr: cache dwarf objects in work products

Cache DWARF objects alongside object files in work products when those exist so that DWARF object files are available for thorin in packed mode in incremental scenarios.

r? `@michaelwoerister`
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this pull request Jul 7, 2022
…uct, r=michaelwoerister

incr: cache dwarf objects in work products

Cache DWARF objects alongside object files in work products when those exist so that DWARF object files are available for thorin in packed mode in incremental scenarios.

r? ``@michaelwoerister``
bors added a commit to rust-lang-ci/rust that referenced this pull request Jul 7, 2022
Rollup of 8 pull requests

Successful merges:

 - rust-lang#96856 (Fix ProjectionElem validation)
 - rust-lang#97711 (Improve soundness of rustc_arena)
 - rust-lang#98507 (Finishing touches for `#[expect]` (RFC 2383))
 - rust-lang#98692 (rustdoc: Cleanup more FIXMEs)
 - rust-lang#98901 (incr: cache dwarf objects in work products)
 - rust-lang#98930 (Make MIR basic blocks field public)
 - rust-lang#98973 (Remove (unused) inherent impl anchors)
 - rust-lang#98981 ( Edit `rustc_mir_dataflow::framework` documentation )

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit ade6d2c into rust-lang:master Jul 7, 2022
@rustbot rustbot added this to the 1.64.0 milestone Jul 7, 2022
@davidtwco davidtwco deleted the split-dwarf-incr-workproduct branch July 8, 2022 08:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants