From 9f53cec1da6ae9ed8735e28fca09837a0cef7667 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Wed, 25 Mar 2020 18:41:46 +0100 Subject: [PATCH] Cleanup memory usage stats --- crates/ra_hir/src/db.rs | 7 ++++--- crates/ra_hir_def/src/db.rs | 7 +------ crates/ra_hir_ty/src/db.rs | 1 + crates/ra_ide_db/src/change.rs | 12 ++++++++++-- 4 files changed, 16 insertions(+), 11 deletions(-) diff --git a/crates/ra_hir/src/db.rs b/crates/ra_hir/src/db.rs index fcba950911a..ec931b34fe8 100644 --- a/crates/ra_hir/src/db.rs +++ b/crates/ra_hir/src/db.rs @@ -10,15 +10,16 @@ TraitDataQuery, TypeAliasDataQuery, UnionDataQuery, }; pub use hir_expand::db::{ - AstDatabase, AstDatabaseStorage, AstIdMapQuery, InternMacroQuery, MacroArgQuery, MacroDefQuery, - MacroExpandQuery, ParseMacroQuery, + AstDatabase, AstDatabaseStorage, AstIdMapQuery, InternEagerExpansionQuery, InternMacroQuery, + MacroArgQuery, MacroDefQuery, MacroExpandQuery, ParseMacroQuery, }; pub use hir_ty::db::{ AssociatedTyDataQuery, AssociatedTyValueQuery, CallableItemSignatureQuery, FieldTypesQuery, GenericDefaultsQuery, GenericPredicatesForParamQuery, GenericPredicatesQuery, HirDatabase, HirDatabaseStorage, ImplDatumQuery, ImplSelfTyQuery, ImplTraitQuery, ImplsForTraitQuery, ImplsInCrateQuery, InferQueryQuery, InternAssocTyValueQuery, InternChalkImplQuery, - InternTypeCtorQuery, StructDatumQuery, TraitDatumQuery, TraitSolveQuery, TyQuery, ValueTyQuery, + InternTypeCtorQuery, InternTypeParamIdQuery, StructDatumQuery, TraitDatumQuery, + TraitSolveQuery, TyQuery, ValueTyQuery, }; #[test] diff --git a/crates/ra_hir_def/src/db.rs b/crates/ra_hir_def/src/db.rs index 7f8c1ea2189..5dc7395f5e8 100644 --- a/crates/ra_hir_def/src/db.rs +++ b/crates/ra_hir_def/src/db.rs @@ -48,6 +48,7 @@ pub trait DefDatabase: InternDatabase + AstDatabase + Upcast { fn raw_items(&self, file_id: HirFileId) -> Arc; #[salsa::invoke(crate_def_map_wait)] + #[salsa::transparent] fn crate_def_map(&self, krate: CrateId) -> Arc; #[salsa::invoke(CrateDefMap::crate_def_map_query)] @@ -109,12 +110,6 @@ pub trait DefDatabase: InternDatabase + AstDatabase + Upcast { fn documentation(&self, def: AttrDefId) -> Option; } -// impl Upcast for T { -// fn upcast(&self) -> &dyn AstDatabase { -// &*self -// } -// } - fn crate_def_map_wait(db: &impl DefDatabase, krate: CrateId) -> Arc { let _p = profile("crate_def_map:wait"); db.crate_def_map_query(krate) diff --git a/crates/ra_hir_ty/src/db.rs b/crates/ra_hir_ty/src/db.rs index 11fc2ac3d19..1462b053f0c 100644 --- a/crates/ra_hir_ty/src/db.rs +++ b/crates/ra_hir_ty/src/db.rs @@ -22,6 +22,7 @@ #[salsa::requires(salsa::Database)] pub trait HirDatabase: DefDatabase + Upcast { #[salsa::invoke(infer_wait)] + #[salsa::transparent] fn infer(&self, def: DefWithBodyId) -> Arc; #[salsa::invoke(crate::infer::infer_query)] diff --git a/crates/ra_ide_db/src/change.rs b/crates/ra_ide_db/src/change.rs index 628cf6416a9..8446ef88e8c 100644 --- a/crates/ra_ide_db/src/change.rs +++ b/crates/ra_ide_db/src/change.rs @@ -311,6 +311,7 @@ macro_rules! sweep_each_query { hir::db::MacroDefQuery hir::db::ParseMacroQuery hir::db::MacroExpandQuery + hir::db::InternEagerExpansionQuery // DefDatabase hir::db::RawItemsQuery @@ -359,14 +360,21 @@ macro_rules! sweep_each_query { hir::db::ImplsInCrateQuery hir::db::ImplsForTraitQuery hir::db::InternTypeCtorQuery + hir::db::InternTypeParamIdQuery hir::db::InternChalkImplQuery hir::db::InternAssocTyValueQuery hir::db::AssociatedTyDataQuery - hir::db::AssociatedTyValueQuery - hir::db::TraitSolveQuery hir::db::TraitDatumQuery hir::db::StructDatumQuery hir::db::ImplDatumQuery + hir::db::AssociatedTyValueQuery + hir::db::TraitSolveQuery + + // SymbolsDatabase + crate::symbol_index::FileSymbolsQuery + + // LineIndexDatabase + crate::LineIndexQuery ]; acc.sort_by_key(|it| std::cmp::Reverse(it.1)); acc