3
3
//! manage the caches, and so forth.
4
4
5
5
use std:: cell:: Cell ;
6
- use std:: collections:: hash_map:: Entry ;
7
6
use std:: fmt:: Debug ;
8
7
use std:: hash:: Hash ;
9
8
use std:: mem;
10
9
11
10
use rustc_data_structures:: fingerprint:: Fingerprint ;
12
- use rustc_data_structures:: fx:: FxHashMap ;
11
+ use rustc_data_structures:: fx:: { FxIndexMap , IndexEntry } ;
13
12
use rustc_data_structures:: sharded:: Sharded ;
14
13
use rustc_data_structures:: stack:: ensure_sufficient_stack;
15
14
use rustc_data_structures:: sync:: Lock ;
@@ -33,7 +32,7 @@ use crate::query::{
33
32
} ;
34
33
35
34
pub struct QueryState < K > {
36
- active : Sharded < FxHashMap < K , QueryResult > > ,
35
+ active : Sharded < FxIndexMap < K , QueryResult > > ,
37
36
}
38
37
39
38
/// Indicates the state of a query for a given key in a query map.
@@ -187,7 +186,7 @@ where
187
186
// since unwinding also wants to look at this map, this can also prevent a double
188
187
// panic.
189
188
let mut lock = state. active . lock_shard_by_value ( & key) ;
190
- lock. remove ( & key)
189
+ lock. shift_remove ( & key)
191
190
} ;
192
191
val. unwrap ( ) . expect_job ( )
193
192
} ;
@@ -207,7 +206,7 @@ where
207
206
let state = self . state ;
208
207
let job = {
209
208
let mut shard = state. active . lock_shard_by_value ( & self . key ) ;
210
- let job = shard. remove ( & self . key ) . unwrap ( ) . expect_job ( ) ;
209
+ let job = shard. shift_remove ( & self . key ) . unwrap ( ) . expect_job ( ) ;
211
210
212
211
shard. insert ( self . key , QueryResult :: Poisoned ) ;
213
212
job
@@ -344,7 +343,7 @@ where
344
343
let current_job_id = qcx. current_query_job ( ) ;
345
344
346
345
match state_lock. entry ( key) {
347
- Entry :: Vacant ( entry) => {
346
+ IndexEntry :: Vacant ( entry) => {
348
347
// Nothing has computed or is computing the query, so we start a new job and insert it in the
349
348
// state map.
350
349
let id = qcx. next_job_id ( ) ;
@@ -356,7 +355,7 @@ where
356
355
357
356
execute_job :: < _ , _ , INCR > ( query, qcx, state, key, id, dep_node)
358
357
}
359
- Entry :: Occupied ( mut entry) => {
358
+ IndexEntry :: Occupied ( mut entry) => {
360
359
match entry. get_mut ( ) {
361
360
QueryResult :: Started ( job) => {
362
361
#[ cfg( parallel_compiler) ]
0 commit comments