Skip to content

Adds RmetaLinkCache a per-link cache that uses path as the key of dec…#158194

Open
mehdiakiki wants to merge 1 commit into
rust-lang:mainfrom
mehdiakiki:rlib-link-meta-cache
Open

Adds RmetaLinkCache a per-link cache that uses path as the key of dec…#158194
mehdiakiki wants to merge 1 commit into
rust-lang:mainfrom
mehdiakiki:rlib-link-meta-cache

Conversation

@mehdiakiki

@mehdiakiki mehdiakiki commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

Adds RmetaLinkCache a per link and path keyed cache of decoded lib.rmeta-link archive members and routes the add_archive read through it so that each rlib link metadata is decoded only one per link at most.

This is a request that originated from the discussion in #156735 and we split it out as its own PR. It gives that PR a decode once path to read instead of reparsing each rlib per crate, and this will be in effect once native_lib_filenames moves to a link-time read.

Part of #138243

@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 Jun 20, 2026
@rustbot

rustbot commented Jun 20, 2026

Copy link
Copy Markdown
Collaborator

r? @wesleywiser

rustbot has assigned @wesleywiser.
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

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: codegen, compiler
  • codegen, compiler expanded to 73 candidates
  • Random selection from 19 candidates

@rustbot

This comment has been minimized.

@mehdiakiki

Copy link
Copy Markdown
Contributor Author

r? @petrochenkov

@rustbot rustbot assigned petrochenkov and unassigned wesleywiser Jun 20, 2026
Comment thread compiler/rustc_codegen_ssa/src/back/rmeta_link.rs Outdated
Comment thread compiler/rustc_codegen_ssa/src/back/rmeta_link.rs Outdated
Comment thread compiler/rustc_codegen_ssa/src/back/rmeta_link.rs Outdated
Comment thread compiler/rustc_codegen_ssa/src/back/link.rs Outdated
Comment thread compiler/rustc_codegen_ssa/src/back/archive.rs Outdated
@petrochenkov

Copy link
Copy Markdown
Contributor

I thought about using CrateNum as a key, but this is good too.
@rustbot author

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jun 22, 2026
@rustbot

rustbot commented Jun 22, 2026

Copy link
Copy Markdown
Collaborator

Reminder, once the PR becomes ready for a review, use @rustbot ready.

@mehdiakiki

Copy link
Copy Markdown
Contributor Author

Ok will address the comments above!

@mehdiakiki mehdiakiki force-pushed the rlib-link-meta-cache branch from 1fb7884 to b3150f3 Compare June 27, 2026 15:39
@rustbot

This comment has been minimized.

…oded lib.rmeta-link archive members, and routes add_archive read through it so each rlib link metadata is decoded at most once per link. This is a demand from a previous discussion and we split it out as its own PR. It gives that PR a decode once path tp read instead of reparsing each rlib per crate once native_lib_filenames moves to a link time read.
@mehdiakiki mehdiakiki force-pushed the rlib-link-meta-cache branch from b3150f3 to 18c10cd Compare June 27, 2026 16:13
@mehdiakiki

Copy link
Copy Markdown
Contributor Author

@rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jun 27, 2026
@petrochenkov

Copy link
Copy Markdown
Contributor

This shouldn't noticeably affect performance before #156735.
@bors r+

@rust-bors

rust-bors Bot commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 18c10cd has been approved by petrochenkov

It is now in the queue for this repository.

🌲 The tree is currently closed for pull requests below priority 1. This pull request will be tested once the tree is reopened.

@rust-bors rust-bors Bot 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 Jun 27, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Jun 27, 2026
…=petrochenkov

Adds RmetaLinkCache a per-link cache that uses path as the key of dec…

Adds `RmetaLinkCache` a per link and path  keyed cache of decoded `lib.rmeta-link` archive members and routes the add_archive read through it so that each rlib link metadata is decoded only one per link at most.

This is a request that originated from the discussion in rust-lang#156735 and we split it out as its own PR. It gives that PR a decode once path to read instead of reparsing each `rlib` per crate, and this will be in effect once `native_lib_filenames` moves to a link-time read.

Part of rust-lang#138243
rust-bors Bot pushed a commit that referenced this pull request Jun 27, 2026
…uwer

Rollup of 6 pull requests

Successful merges:

 - #158194 (Adds RmetaLinkCache a per-link cache that uses path as the key of dec…)
 - #137858 (Add new `unused_footnote_definition` rustdoc lint)
 - #158163 (Fix too-short variance slice in `variances_of` cycle recovery)
 - #158233 (Allow the unstable attribute on foreign type)
 - #158470 (Upgrade `jsonsocck` and `jsondoclint` to edition 2024.)
 - #158488 (Upgrade `rustdoc-json-types` to 2024 edition.)
rust-bors Bot pushed a commit that referenced this pull request Jun 27, 2026
…uwer

Rollup of 6 pull requests

Successful merges:

 - #158194 (Adds RmetaLinkCache a per-link cache that uses path as the key of dec…)
 - #137858 (Add new `unused_footnote_definition` rustdoc lint)
 - #158163 (Fix too-short variance slice in `variances_of` cycle recovery)
 - #158233 (Allow the unstable attribute on foreign type)
 - #158470 (Upgrade `jsonsocck` and `jsondoclint` to edition 2024.)
 - #158488 (Upgrade `rustdoc-json-types` to 2024 edition.)
rust-bors Bot pushed a commit that referenced this pull request Jun 27, 2026
…uwer

Rollup of 6 pull requests

Successful merges:

 - #158194 (Adds RmetaLinkCache a per-link cache that uses path as the key of dec…)
 - #137858 (Add new `unused_footnote_definition` rustdoc lint)
 - #158163 (Fix too-short variance slice in `variances_of` cycle recovery)
 - #158233 (Allow the unstable attribute on foreign type)
 - #158470 (Upgrade `jsonsocck` and `jsondoclint` to edition 2024.)
 - #158488 (Upgrade `rustdoc-json-types` to 2024 edition.)
rust-bors Bot pushed a commit that referenced this pull request Jun 27, 2026
…uwer

Rollup of 6 pull requests

Successful merges:

 - #158194 (Adds RmetaLinkCache a per-link cache that uses path as the key of dec…)
 - #137858 (Add new `unused_footnote_definition` rustdoc lint)
 - #158163 (Fix too-short variance slice in `variances_of` cycle recovery)
 - #158233 (Allow the unstable attribute on foreign type)
 - #158470 (Upgrade `jsonsocck` and `jsondoclint` to edition 2024.)
 - #158488 (Upgrade `rustdoc-json-types` to 2024 edition.)
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Jun 27, 2026
…=petrochenkov

Adds RmetaLinkCache a per-link cache that uses path as the key of dec…

Adds `RmetaLinkCache` a per link and path  keyed cache of decoded `lib.rmeta-link` archive members and routes the add_archive read through it so that each rlib link metadata is decoded only one per link at most.

This is a request that originated from the discussion in rust-lang#156735 and we split it out as its own PR. It gives that PR a decode once path to read instead of reparsing each `rlib` per crate, and this will be in effect once `native_lib_filenames` moves to a link-time read.

Part of rust-lang#138243
rust-bors Bot pushed a commit that referenced this pull request Jun 27, 2026
…uwer

Rollup of 10 pull requests

Successful merges:

 - #158502 (Revert "LLVM 23: Adapt codegen test to moved assume")
 - #152225 (Add supertrait item shadowing for type-level path resolution)
 - #158194 (Adds RmetaLinkCache a per-link cache that uses path as the key of dec…)
 - #158466 (rustdoc: show impl Trait<Box<Local>> for Foreign, etc on Local's docs)
 - #158501 (miri subtree update)
 - #153097 (Expand `OptionFlatten`'s iterator methods)
 - #158163 (Fix too-short variance slice in `variances_of` cycle recovery)
 - #158233 (Allow the unstable attribute on foreign type)
 - #158470 (Upgrade `jsonsocck` and `jsondoclint` to edition 2024.)
 - #158488 (Upgrade `rustdoc-json-types` to 2024 edition.)
rust-bors Bot pushed a commit that referenced this pull request Jun 27, 2026
…uwer

Rollup of 10 pull requests

Successful merges:

 - #158502 (Revert "LLVM 23: Adapt codegen test to moved assume")
 - #152225 (Add supertrait item shadowing for type-level path resolution)
 - #158194 (Adds RmetaLinkCache a per-link cache that uses path as the key of dec…)
 - #158466 (rustdoc: show impl Trait<Box<Local>> for Foreign, etc on Local's docs)
 - #158501 (miri subtree update)
 - #153097 (Expand `OptionFlatten`'s iterator methods)
 - #158163 (Fix too-short variance slice in `variances_of` cycle recovery)
 - #158233 (Allow the unstable attribute on foreign type)
 - #158470 (Upgrade `jsonsocck` and `jsondoclint` to edition 2024.)
 - #158488 (Upgrade `rustdoc-json-types` to 2024 edition.)
rust-bors Bot pushed a commit that referenced this pull request Jun 27, 2026
…uwer

Rollup of 10 pull requests

Successful merges:

 - #158502 (Revert "LLVM 23: Adapt codegen test to moved assume")
 - #152225 (Add supertrait item shadowing for type-level path resolution)
 - #158194 (Adds RmetaLinkCache a per-link cache that uses path as the key of dec…)
 - #158466 (rustdoc: show impl Trait<Box<Local>> for Foreign, etc on Local's docs)
 - #158501 (miri subtree update)
 - #153097 (Expand `OptionFlatten`'s iterator methods)
 - #158163 (Fix too-short variance slice in `variances_of` cycle recovery)
 - #158233 (Allow the unstable attribute on foreign type)
 - #158470 (Upgrade `jsonsocck` and `jsondoclint` to edition 2024.)
 - #158488 (Upgrade `rustdoc-json-types` to 2024 edition.)
rust-bors Bot pushed a commit that referenced this pull request Jun 27, 2026
…uwer

Rollup of 10 pull requests

Successful merges:

 - #158502 (Revert "LLVM 23: Adapt codegen test to moved assume")
 - #152225 (Add supertrait item shadowing for type-level path resolution)
 - #158194 (Adds RmetaLinkCache a per-link cache that uses path as the key of dec…)
 - #158466 (rustdoc: show impl Trait<Box<Local>> for Foreign, etc on Local's docs)
 - #158501 (miri subtree update)
 - #153097 (Expand `OptionFlatten`'s iterator methods)
 - #158163 (Fix too-short variance slice in `variances_of` cycle recovery)
 - #158233 (Allow the unstable attribute on foreign type)
 - #158470 (Upgrade `jsonsocck` and `jsondoclint` to edition 2024.)
 - #158488 (Upgrade `rustdoc-json-types` to 2024 edition.)
jhpratt added a commit to jhpratt/rust that referenced this pull request Jun 28, 2026
…=petrochenkov

Adds RmetaLinkCache a per-link cache that uses path as the key of dec…

Adds `RmetaLinkCache` a per link and path  keyed cache of decoded `lib.rmeta-link` archive members and routes the add_archive read through it so that each rlib link metadata is decoded only one per link at most.

This is a request that originated from the discussion in rust-lang#156735 and we split it out as its own PR. It gives that PR a decode once path to read instead of reparsing each `rlib` per crate, and this will be in effect once `native_lib_filenames` moves to a link-time read.

Part of rust-lang#138243
jhpratt added a commit to jhpratt/rust that referenced this pull request Jun 28, 2026
…=petrochenkov

Adds RmetaLinkCache a per-link cache that uses path as the key of dec…

Adds `RmetaLinkCache` a per link and path  keyed cache of decoded `lib.rmeta-link` archive members and routes the add_archive read through it so that each rlib link metadata is decoded only one per link at most.

This is a request that originated from the discussion in rust-lang#156735 and we split it out as its own PR. It gives that PR a decode once path to read instead of reparsing each `rlib` per crate, and this will be in effect once `native_lib_filenames` moves to a link-time read.

Part of rust-lang#138243
rust-bors Bot pushed a commit that referenced this pull request Jun 28, 2026
Rollup of 15 pull requests

Successful merges:

 - #158497 (stdarch subtree update)
 - #152225 (Add supertrait item shadowing for type-level path resolution)
 - #158194 (Adds RmetaLinkCache a per-link cache that uses path as the key of dec…)
 - #158466 (rustdoc: show impl Trait<Box<Local>> for Foreign, etc on Local's docs)
 - #158501 (miri subtree update)
 - #153097 (Expand `OptionFlatten`'s iterator methods)
 - #157614 (Move tests drop)
 - #157996 (perf: drop the full-crate AST walk in check_unused)
 - #158163 (Fix too-short variance slice in `variances_of` cycle recovery)
 - #158233 (Allow the unstable attribute on foreign type)
 - #158433 (Fix inconsistent safety requirement in VecDeque::nonoverlapping_ranges)
 - #158464 (Reorganize `tests/ui/issues` [15/N])
 - #158470 (Upgrade `jsonsocck` and `jsondoclint` to edition 2024.)
 - #158485 (Reorganize `tests/ui/issues` [16/N])
 - #158488 (Upgrade `rustdoc-json-types` to 2024 edition.)
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.

4 participants