Avoid code generation for ThinVec<Diagnostic>'s destructor in the query system
This commit is contained in:
parent
6ae4cfbbb0
commit
862011e1ca
4 changed files with 10 additions and 8 deletions
|
@ -93,10 +93,13 @@ pub struct QuerySideEffects {
|
|||
}
|
||||
|
||||
impl QuerySideEffects {
|
||||
/// Returns true if there might be side effects.
|
||||
#[inline]
|
||||
pub fn is_empty(&self) -> bool {
|
||||
pub fn maybe_any(&self) -> bool {
|
||||
let QuerySideEffects { diagnostics } = self;
|
||||
diagnostics.is_empty()
|
||||
// Use `has_capacity` so that the destructor for `self.diagnostics` can be skipped
|
||||
// if `maybe_any` is known to be false.
|
||||
diagnostics.has_capacity()
|
||||
}
|
||||
pub fn append(&mut self, other: QuerySideEffects) {
|
||||
let QuerySideEffects { diagnostics } = self;
|
||||
|
|
|
@ -538,10 +538,9 @@ where
|
|||
|
||||
prof_timer.finish_with_query_invocation_id(dep_node_index.into());
|
||||
|
||||
let diagnostics = diagnostics.into_inner();
|
||||
let side_effects = QuerySideEffects { diagnostics };
|
||||
let side_effects = QuerySideEffects { diagnostics: diagnostics.into_inner() };
|
||||
|
||||
if std::intrinsics::unlikely(!side_effects.is_empty()) {
|
||||
if std::intrinsics::unlikely(side_effects.maybe_any()) {
|
||||
if query.anon() {
|
||||
qcx.store_side_effects_for_anon_node(dep_node_index, side_effects);
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue