-
Notifications
You must be signed in to change notification settings - Fork 13k
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: Dismantle map_data.rs
by moving its responsibilities elsewhere
#134323
Conversation
rustbot has assigned @petrochenkov. Use |
26a06f0
to
eb1a93c
Compare
One of the big enablers for this was #134029, which made |
r? jieyouxu |
I don't remember exactly why I reversed the order in the first place, but I think it had something to do with wanting to change the relative order of some other bits of code that happened to be intertwined with the construction of the file table. Those intertwinings have been dissolved by other changes, so now there's no particular reason to avoid the more “natural” ordering of steps. |
eb1a93c
to
855ebdf
Compare
I noticed that |
@Zalathar could you elaborate on
So what is the deterministic order? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, this LGTM overall, I just have some nits.
And also would be very cool if you could include a brief comment on the table order.
855ebdf
to
fc2b407
Compare
Addressed review feedback (diff). |
My argument for the global file table being deterministic relies on MIR traversal during codegen (within a single CGU) also being deterministic. I believe that's the case, but I've created a Zulip thread to see if anyone disagrees. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. All other changes LGTM, just waiting on confirmation if we can rely on the traversal order (or whatever order) to be deterministic.
r=me if that is indeed the case -- that we can rely on the traversal order being guaranteed deterministic, unless it only happens to currently be that way, but is subject to changes.
The checks in `is_eligible_for_coverage` include `is_fn_like`, but will also exclude various function-like things that cannot possibly have coverage instrumentation.
fc2b407
to
9df0034
Compare
This patch dismantles what was left of `FunctionCoverage` in `map_data.rs`, replaces `function_coverage_map` with a set, and overhauls how we prepare covfun records for unused functions.
9df0034
to
541d4e8
Compare
OK, even though I'm confident that the traversal order is deterministic, I ended up adding a layer of sorting (by symbol name) so that changes to stable-hashing won't influence the order of the global file table, which can be observed by coverage test snapshots (diff). (Redacting this detail in the tests themselves would be annoying, because it's embedded in the bytes of each individual covfun record.) |
@rustbot ready |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, the changes LGTM.
@bors r+ |
…youxu coverage: Dismantle `map_data.rs` by moving its responsibilities elsewhere This is a series of incremental changes that combine to let us get rid of `coverageinfo/map_data.rs`, by moving all of its responsibilities into more appropriate places. Some of the notable consequences are: - We once again build the per-CGU file table on the fly while preparing individual covfun records, instead of building the whole table up-front. The up-front approach was introduced by rust-lang#117042 to work around various other problems in generating the covmap/covfun records, but subsequent cleanups have made that approach no longer necessary. - Expression conversion and mapping-region conversion are now performed directly in `mapgen::covfun`, which should make future changes easier. - We no longer insert unused function instances into the same map that is also used to track used function instances. This helps to decouple the handling of used vs unused functions. --- There should be no meaningful change to compiler output. The file table is no longer sorted, because reordering it would invalidate the file indices stored in individual covfun records, but the table order should still be deterministic (albeit arbitrary). There are some subsequent cleanups that I intend to investigate, but this is enough change for one PR.
…youxu coverage: Dismantle `map_data.rs` by moving its responsibilities elsewhere This is a series of incremental changes that combine to let us get rid of `coverageinfo/map_data.rs`, by moving all of its responsibilities into more appropriate places. Some of the notable consequences are: - We once again build the per-CGU file table on the fly while preparing individual covfun records, instead of building the whole table up-front. The up-front approach was introduced by rust-lang#117042 to work around various other problems in generating the covmap/covfun records, but subsequent cleanups have made that approach no longer necessary. - Expression conversion and mapping-region conversion are now performed directly in `mapgen::covfun`, which should make future changes easier. - We no longer insert unused function instances into the same map that is also used to track used function instances. This helps to decouple the handling of used vs unused functions. --- There should be no meaningful change to compiler output. The file table is no longer sorted, because reordering it would invalidate the file indices stored in individual covfun records, but the table order should still be deterministic (albeit arbitrary). There are some subsequent cleanups that I intend to investigate, but this is enough change for one PR.
…iaskrgr Rollup of 7 pull requests Successful merges: - rust-lang#133265 (Add a range argument to vec.extract_if) - rust-lang#133801 (Promote powerpc64le-unknown-linux-musl to tier 2 with host tools) - rust-lang#134323 (coverage: Dismantle `map_data.rs` by moving its responsibilities elsewhere) - rust-lang#134378 (An octuple of polonius fact generation cleanups) - rust-lang#134408 (Regression test for RPIT inheriting lifetime from projection) - rust-lang#134423 (bootstrap: use specific-purpose ui test path for `test_valid` self-test) - rust-lang#134426 (Fix typo in uint_macros.rs) Failed merges: - rust-lang#133103 (Pass FnAbi to find_mir_or_eval_fn) r? `@ghost` `@rustbot` modify labels: rollup
@Zalathar
|
This is a series of incremental changes that combine to let us get rid of
coverageinfo/map_data.rs
, by moving all of its responsibilities into more appropriate places.Some of the notable consequences are:
mapgen::covfun
, which should make future changes easier.There should be no meaningful change to compiler output. The file table is no longer sorted, because reordering it would invalidate the file indices stored in individual covfun records, but the table order should still be deterministic (albeit arbitrary).
There are some subsequent cleanups that I intend to investigate, but this is enough change for one PR.