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

coverage: Rearrange the code for embedding per-function coverage metadata #134163

Merged
merged 5 commits into from
Dec 11, 2024

Conversation

Zalathar
Copy link
Contributor

@Zalathar Zalathar commented Dec 11, 2024

This is a series of refactorings to the code that prepares and embeds per-function coverage metadata records (“covfun records”) in the __llvm_covfun linker section of the final binary. The llvm-cov tool reads this metadata from the binary when preparing a coverage report.

Beyond general cleanup, a big motivation behind these changes is to pave the way for re-landing an updated version of #133418.


There should be no change in compiler output, as demonstrated by the absence of (meaningful) changes to coverage tests.

The first patch is just moving code around, so I suggest looking at the other patches to see the actual changes.


try-job: x86_64-gnu
try-job: x86_64-msvc
try-job: aarch64-apple

@Zalathar Zalathar added the A-code-coverage Area: Source-based code coverage (-Cinstrument-coverage) label Dec 11, 2024
@rustbot
Copy link
Collaborator

rustbot commented Dec 11, 2024

r? @SparrowLii

rustbot has assigned @SparrowLii.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Dec 11, 2024
@rust-log-analyzer

This comment has been minimized.

@Zalathar Zalathar force-pushed the covfun branch 2 times, most recently from e0ad6ad to ec7eb7e Compare December 11, 2024 08:04
@Zalathar
Copy link
Contributor Author

@bors try

bors added a commit to rust-lang-ci/rust that referenced this pull request Dec 11, 2024
coverage: Rearrange the code for embedding per-function coverage metadata

This is a series of refactorings to the code that prepares and embeds per-function coverage metadata records (“covfun records”) in the `__llvm_covfun` linker section of the final binary. The `llvm-cov` tool reads this metadata from the binary when preparing a coverage report.

Beyond general cleanup, a big motivation behind these changes is to pave the way for re-landing an updated version of rust-lang#133418.

---

There should be no change in compiler output, as demonstrated by the absence of (meaningful) changes to coverage tests.

---

try-job: x86_64-gnu
try-job: x86_64-msvc
try-job: aarch64-apple
@bors
Copy link
Contributor

bors commented Dec 11, 2024

⌛ Trying commit ec7eb7e with merge 4bb99ca...

Copy link
Member

@SparrowLii SparrowLii left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!
I think this PR doesn't change the functionality. Just making some comments for the code.

@bors
Copy link
Contributor

bors commented Dec 11, 2024

☀️ Try build successful - checks-actions
Build commit: 4bb99ca (4bb99ca1934dc99af504ea1693260dc0e4452999)

@Zalathar
Copy link
Contributor Author

Zalathar commented Dec 11, 2024

Added some more comments in response to feedback (diff).

This defers the call to `llvm_cov::write_function_mappings_to_buffer` until
just before its enclosing global variable is created.
@Zalathar
Copy link
Contributor Author

I had another look at that test, and changing it to use CHECK-DAG was easier than I expected, so I just fixed it.

@jieyouxu
Copy link
Member

jieyouxu commented Dec 11, 2024

No further concerns from me, feel free to r=Sparrow and me if @SparrowLii has no further concerns.

@SparrowLii
Copy link
Member

LGTM

@Zalathar
Copy link
Contributor Author

Thanks for the reviews.

@bors r=SparrowLii,jieyouxu

@bors
Copy link
Contributor

bors commented Dec 11, 2024

📌 Commit 3f3a9bf has been approved by SparrowLii,jieyouxu

It is now in the queue for this repository.

@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 Dec 11, 2024
bors added a commit to rust-lang-ci/rust that referenced this pull request Dec 11, 2024
…iaskrgr

Rollup of 6 pull requests

Successful merges:

 - rust-lang#132975 (De-duplicate and improve definition of core::ffi::c_char)
 - rust-lang#133598 (Change `GetManyMutError` to match T-libs-api decision)
 - rust-lang#134148 (add comments in check_expr_field)
 - rust-lang#134163 (coverage: Rearrange the code for embedding per-function coverage metadata)
 - rust-lang#134165 (wasm(32|64): update alignment string)
 - rust-lang#134170 (Subtree update of `rust-analyzer`)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 13c13ee into rust-lang:master Dec 11, 2024
6 checks passed
@rustbot rustbot added this to the 1.85.0 milestone Dec 11, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Dec 11, 2024
Rollup merge of rust-lang#134163 - Zalathar:covfun, r=SparrowLii,jieyouxu

coverage: Rearrange the code for embedding per-function coverage metadata

This is a series of refactorings to the code that prepares and embeds per-function coverage metadata records (“covfun records”) in the `__llvm_covfun` linker section of the final binary. The `llvm-cov` tool reads this metadata from the binary when preparing a coverage report.

Beyond general cleanup, a big motivation behind these changes is to pave the way for re-landing an updated version of rust-lang#133418.

---

There should be no change in compiler output, as demonstrated by the absence of (meaningful) changes to coverage tests.

The first patch is just moving code around, so I suggest looking at the other patches to see the actual changes.

---

try-job: x86_64-gnu
try-job: x86_64-msvc
try-job: aarch64-apple
@Zalathar Zalathar deleted the covfun branch December 11, 2024 23:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-code-coverage Area: Source-based code coverage (-Cinstrument-coverage) 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