Make LinkedGraph modification order independent#151821
Make LinkedGraph modification order independent#151821zetanumbers wants to merge 6 commits intorust-lang:mainfrom
Conversation
This comment has been minimized.
This comment has been minimized.
|
Updated the issue's top comment to include detailed description of changes. |
f0938a3 to
1dd0c95
Compare
This comment has been minimized.
This comment has been minimized.
1dd0c95 to
264aa3a
Compare
|
☔ The latest upstream changes (presumably #152156) made this pull request unmergeable. Please resolve the merge conflicts. |
|
The job Click to see the possible cause of the failure (guessed by this bot) |
|
This PR contains a small functional change - supporting holes in the Neither change is required for fixing #142152, #152590 fixes it in a minimal way, but the hole support is required for actually keeping all edges in the graph and getting full debug dumps. So I suggest landing the hole support first (@zetanumbers I can do it if you want), and then landing the support for arbitrary index types in |
|
Reminder, once the PR becomes ready for a review, use |
|
We can probably make |
LinkedGraphis a graph data structure used byDepGraphQueryfor-Zquery-dep-graphand byRegionGraphfor lexical region resolution. CurrentDepGraphQueryimplementation is problematic for our parallel frontend as some edges could be added before their source or target nodes, which never happens in single-threaded mode. To solve this I've made two changes:DepGraphQuerylooks up its target node indep_index_to_indexto translate query system'sDepNodeIndexintoLinkedGraph's newtypeNodeIndexfor usize to index nodes. For bothDepGraphQueryandRegionGraphnodes correspond one-to-one toDepNodeIndex's andRegionVid's indices. Those types are defined by therustc_index::newtype_index!macro and implementIdxtrait, so instead of usingNodeIndexandVec<Node<N>>I've changed it to use a genericI: Idxtype andIndexVec<I, Node<N>>. Thus fielddep_index_to_indexis no longer required.LinkedGraphrequires its target and source nodes to already be present in the graph in order to construct a linked list of edge indices for fast iteration of edges. As such I've added code to postpone linked list construction in case source/target node was not present and countlinked_edgesup to now. Upon creation of anAdjacentEdgesiterator there's an assertion that every edge is linked.Fixes #142152