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

Remove prev_index_to_index field from CurrentDepGraph #138824

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

Zoxc
Copy link
Contributor

@Zoxc Zoxc commented Mar 22, 2025

The dep graph currently has 2 ways to map a previous index into a current index. The prev_index_to_index map stores the current index equivalent of a previous index. For indices which are marked green, we also store the same information in the DepNodeColorMap. We actually only need to known the mapping for green nodes however, so this PR removes prev_index_to_index and instead makes use of the DepNodeColorMap.

To avoid racing when promoting a node from the previous session, the encoder lock is now used to ensure only one thread encodes the promoted node. This was previously done by the lock in prev_index_to_index.

This also changes nodes_newly_allocated_in_current_session used to detect duplicate dep nodes to contain both new and previous nodes, which is simpler and can better catch duplicates.

The dep node index encoding used in DepNodeColorMap is tweak to avoid subtraction / addition to optimize accessing the current equivalent of a previous index.

This is based on #138629.

r? @oli-obk

@rustbot rustbot added A-query-system Area: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html) 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 Mar 22, 2025
@rustbot
Copy link
Collaborator

rustbot commented Mar 22, 2025

Some changes occurred in compiler/rustc_codegen_ssa

cc @WaffleLapkin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-query-system Area: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html) 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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants