Attempt to reduce perf impact.
This commit is contained in:
parent
87644d85a2
commit
e33e2d6e9e
1 changed files with 17 additions and 10 deletions
|
@ -676,28 +676,35 @@ impl<K: DepKind> DepGraph<K> {
|
||||||
None => {}
|
None => {}
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut stack =
|
let mut stack = smallvec![prev_index];
|
||||||
MarkingStack { stack: vec![prev_index], sess: qcx.dep_context().sess(), graph: data };
|
let _backtrace_print =
|
||||||
|
MarkingStack { stack: &mut stack, sess: qcx.dep_context().sess(), graph: data };
|
||||||
|
|
||||||
// This DepNode and the corresponding query invocation existed
|
// This DepNode and the corresponding query invocation existed
|
||||||
// in the previous compilation session too, so we can try to
|
// in the previous compilation session too, so we can try to
|
||||||
// mark it as green by recursively marking all of its
|
// mark it as green by recursively marking all of its
|
||||||
// dependencies green.
|
// dependencies green.
|
||||||
return self
|
let ret = self
|
||||||
.try_mark_previous_green(qcx, data, prev_index, &dep_node, &mut stack.stack)
|
.try_mark_previous_green(qcx, data, prev_index, &dep_node, _backtrace_print.stack)
|
||||||
.map(|dep_node_index| (prev_index, dep_node_index));
|
.map(|dep_node_index| (prev_index, dep_node_index));
|
||||||
|
|
||||||
|
// We succeeded, no backtrace.
|
||||||
|
std::mem::forget(_backtrace_print);
|
||||||
|
return ret;
|
||||||
|
|
||||||
/// Remember the stack of queries we are forcing in the event of an incr. comp. panic.
|
/// Remember the stack of queries we are forcing in the event of an incr. comp. panic.
|
||||||
struct MarkingStack<'a, K: DepKind> {
|
struct MarkingStack<'a, 'v, K: DepKind> {
|
||||||
stack: Vec<SerializedDepNodeIndex>,
|
stack: &'v mut SmallVec<[SerializedDepNodeIndex; 8]>,
|
||||||
sess: &'a rustc_session::Session,
|
sess: &'a rustc_session::Session,
|
||||||
graph: &'a DepGraphData<K>,
|
graph: &'a DepGraphData<K>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, K: DepKind> Drop for MarkingStack<'a, K> {
|
impl<'a, 'v, K: DepKind> Drop for MarkingStack<'a, 'v, K> {
|
||||||
/// Print the forcing backtrace.
|
/// Print the forcing backtrace.
|
||||||
|
#[inline(never)]
|
||||||
|
#[cold]
|
||||||
fn drop(&mut self) {
|
fn drop(&mut self) {
|
||||||
for &frame in self.stack.iter().skip(1).rev() {
|
for &frame in self.stack.iter().rev() {
|
||||||
let node = self.graph.previous.index_to_node(frame);
|
let node = self.graph.previous.index_to_node(frame);
|
||||||
// Do not try to rely on DepNode's Debug implementation,
|
// Do not try to rely on DepNode's Debug implementation,
|
||||||
// since it may panic.
|
// since it may panic.
|
||||||
|
@ -721,7 +728,7 @@ impl<K: DepKind> DepGraph<K> {
|
||||||
data: &DepGraphData<K>,
|
data: &DepGraphData<K>,
|
||||||
parent_dep_node_index: SerializedDepNodeIndex,
|
parent_dep_node_index: SerializedDepNodeIndex,
|
||||||
dep_node: &DepNode<K>,
|
dep_node: &DepNode<K>,
|
||||||
stack: &mut Vec<SerializedDepNodeIndex>,
|
stack: &mut SmallVec<[SerializedDepNodeIndex; 8]>,
|
||||||
) -> Option<()> {
|
) -> Option<()> {
|
||||||
let dep_dep_node_color = data.colors.get(parent_dep_node_index);
|
let dep_dep_node_color = data.colors.get(parent_dep_node_index);
|
||||||
let dep_dep_node = &data.previous.index_to_node(parent_dep_node_index);
|
let dep_dep_node = &data.previous.index_to_node(parent_dep_node_index);
|
||||||
|
@ -810,7 +817,7 @@ impl<K: DepKind> DepGraph<K> {
|
||||||
data: &DepGraphData<K>,
|
data: &DepGraphData<K>,
|
||||||
prev_dep_node_index: SerializedDepNodeIndex,
|
prev_dep_node_index: SerializedDepNodeIndex,
|
||||||
dep_node: &DepNode<K>,
|
dep_node: &DepNode<K>,
|
||||||
stack: &mut Vec<SerializedDepNodeIndex>,
|
stack: &mut SmallVec<[SerializedDepNodeIndex; 8]>,
|
||||||
) -> Option<DepNodeIndex> {
|
) -> Option<DepNodeIndex> {
|
||||||
#[cfg(not(parallel_compiler))]
|
#[cfg(not(parallel_compiler))]
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue