refactor: Add an alias for the SmallVec in dep_graph
This commit is contained in:
parent
c6f1215d92
commit
4168c25b0f
1 changed files with 8 additions and 10 deletions
|
@ -350,12 +350,7 @@ impl DepGraph {
|
||||||
{
|
{
|
||||||
if let Some(ref data) = self.data {
|
if let Some(ref data) = self.data {
|
||||||
let (result, task_deps) = ty::tls::with_context(|icx| {
|
let (result, task_deps) = ty::tls::with_context(|icx| {
|
||||||
let task_deps = Lock::new(TaskDeps {
|
let task_deps = Lock::new(TaskDeps::default());
|
||||||
#[cfg(debug_assertions)]
|
|
||||||
node: None,
|
|
||||||
reads: SmallVec::new(),
|
|
||||||
read_set: Default::default(),
|
|
||||||
});
|
|
||||||
|
|
||||||
let r = {
|
let r = {
|
||||||
let icx = ty::tls::ImplicitCtxt { task_deps: Some(&task_deps), ..icx.clone() };
|
let icx = ty::tls::ImplicitCtxt { task_deps: Some(&task_deps), ..icx.clone() };
|
||||||
|
@ -968,7 +963,7 @@ pub enum WorkProductFileKind {
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
struct DepNodeData {
|
struct DepNodeData {
|
||||||
node: DepNode,
|
node: DepNode,
|
||||||
edges: SmallVec<[DepNodeIndex; 8]>,
|
edges: EdgesVec,
|
||||||
fingerprint: Fingerprint,
|
fingerprint: Fingerprint,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1093,7 +1088,7 @@ impl CurrentDepGraph {
|
||||||
fn alloc_node(
|
fn alloc_node(
|
||||||
&self,
|
&self,
|
||||||
dep_node: DepNode,
|
dep_node: DepNode,
|
||||||
edges: SmallVec<[DepNodeIndex; 8]>,
|
edges: EdgesVec,
|
||||||
fingerprint: Fingerprint,
|
fingerprint: Fingerprint,
|
||||||
) -> DepNodeIndex {
|
) -> DepNodeIndex {
|
||||||
debug_assert!(
|
debug_assert!(
|
||||||
|
@ -1105,7 +1100,7 @@ impl CurrentDepGraph {
|
||||||
fn intern_node(
|
fn intern_node(
|
||||||
&self,
|
&self,
|
||||||
dep_node: DepNode,
|
dep_node: DepNode,
|
||||||
edges: SmallVec<[DepNodeIndex; 8]>,
|
edges: EdgesVec,
|
||||||
fingerprint: Fingerprint,
|
fingerprint: Fingerprint,
|
||||||
) -> DepNodeIndex {
|
) -> DepNodeIndex {
|
||||||
match self.node_to_node_index.get_shard_by_value(&dep_node).lock().entry(dep_node) {
|
match self.node_to_node_index.get_shard_by_value(&dep_node).lock().entry(dep_node) {
|
||||||
|
@ -1168,11 +1163,14 @@ impl DepGraphData {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// The capacity of the `reads` field `SmallVec`
|
||||||
const TASK_DEPS_READS_CAP: usize = 8;
|
const TASK_DEPS_READS_CAP: usize = 8;
|
||||||
|
type EdgesVec = SmallVec<[DepNodeIndex; TASK_DEPS_READS_CAP]>;
|
||||||
|
#[derive(Default)]
|
||||||
pub struct TaskDeps {
|
pub struct TaskDeps {
|
||||||
#[cfg(debug_assertions)]
|
#[cfg(debug_assertions)]
|
||||||
node: Option<DepNode>,
|
node: Option<DepNode>,
|
||||||
reads: SmallVec<[DepNodeIndex; TASK_DEPS_READS_CAP]>,
|
reads: EdgesVec,
|
||||||
read_set: FxHashSet<DepNodeIndex>,
|
read_set: FxHashSet<DepNodeIndex>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue