aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2021-01-27 09:16:24 +0000
committerAleksey Kladov <[email protected]>2021-01-27 09:39:19 +0000
commitb8d50a7414389a237eeaa67e575a5374da698300 (patch)
tree1a1738317ffb30cbb18c3639037a06b70ec129ad
parentfc08fdaf5a5e17af09eb6cfa098f7c3d4dc9114b (diff)
add more counts
-rw-r--r--Cargo.lock4
-rw-r--r--crates/hir_def/src/body.rs2
-rw-r--r--crates/hir_def/src/body/lower.rs2
-rw-r--r--crates/hir_expand/src/ast_id_map.rs4
-rw-r--r--crates/profile/Cargo.toml2
5 files changed, 10 insertions, 4 deletions
diff --git a/Cargo.lock b/Cargo.lock
index 45a0211ff..6fcac6177 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -284,9 +284,9 @@ checksum = "28b9d6de7f49e22cf97ad17fc4036ece69300032f45f78f30b4a4482cdc3f4a6"
284 284
285[[package]] 285[[package]]
286name = "countme" 286name = "countme"
287version = "2.0.0" 287version = "2.0.1"
288source = "registry+https://github.com/rust-lang/crates.io-index" 288source = "registry+https://github.com/rust-lang/crates.io-index"
289checksum = "4f8038ded86523aa26c1321dfe8bb432707d0a3e2608f9d0108803727546e089" 289checksum = "1aa2b26822354da8572983762d79a7ba55981b3fbbc612164a0dbbd0213df7fe"
290dependencies = [ 290dependencies = [
291 "dashmap", 291 "dashmap",
292 "once_cell", 292 "once_cell",
diff --git a/crates/hir_def/src/body.rs b/crates/hir_def/src/body.rs
index d0c84ab0b..b9ecf22fa 100644
--- a/crates/hir_def/src/body.rs
+++ b/crates/hir_def/src/body.rs
@@ -17,6 +17,7 @@ use hir_expand::{
17 HirFileId, InFile, MacroDefId, 17 HirFileId, InFile, MacroDefId,
18}; 18};
19use la_arena::{Arena, ArenaMap}; 19use la_arena::{Arena, ArenaMap};
20use profile::Count;
20use rustc_hash::FxHashMap; 21use rustc_hash::FxHashMap;
21use syntax::{ast, AstNode, AstPtr}; 22use syntax::{ast, AstNode, AstPtr};
22use test_utils::mark; 23use test_utils::mark;
@@ -237,6 +238,7 @@ pub struct Body {
237 /// The `ExprId` of the actual body expression. 238 /// The `ExprId` of the actual body expression.
238 pub body_expr: ExprId, 239 pub body_expr: ExprId,
239 pub item_scope: ItemScope, 240 pub item_scope: ItemScope,
241 _c: Count<Self>,
240} 242}
241 243
242pub type ExprPtr = AstPtr<ast::Expr>; 244pub type ExprPtr = AstPtr<ast::Expr>;
diff --git a/crates/hir_def/src/body/lower.rs b/crates/hir_def/src/body/lower.rs
index 4ce5e5b72..209965fca 100644
--- a/crates/hir_def/src/body/lower.rs
+++ b/crates/hir_def/src/body/lower.rs
@@ -10,6 +10,7 @@ use hir_expand::{
10 ExpandError, HirFileId, MacroDefId, MacroDefKind, 10 ExpandError, HirFileId, MacroDefId, MacroDefKind,
11}; 11};
12use la_arena::Arena; 12use la_arena::Arena;
13use profile::Count;
13use rustc_hash::FxHashMap; 14use rustc_hash::FxHashMap;
14use syntax::{ 15use syntax::{
15 ast::{ 16 ast::{
@@ -77,6 +78,7 @@ pub(super) fn lower(
77 params: Vec::new(), 78 params: Vec::new(),
78 body_expr: dummy_expr_id(), 79 body_expr: dummy_expr_id(),
79 item_scope: Default::default(), 80 item_scope: Default::default(),
81 _c: Count::new(),
80 }, 82 },
81 item_trees: { 83 item_trees: {
82 let mut map = FxHashMap::default(); 84 let mut map = FxHashMap::default();
diff --git a/crates/hir_expand/src/ast_id_map.rs b/crates/hir_expand/src/ast_id_map.rs
index 0991fffd8..16cf29907 100644
--- a/crates/hir_expand/src/ast_id_map.rs
+++ b/crates/hir_expand/src/ast_id_map.rs
@@ -13,6 +13,7 @@ use std::{
13}; 13};
14 14
15use la_arena::{Arena, Idx}; 15use la_arena::{Arena, Idx};
16use profile::Count;
16use syntax::{ast, match_ast, AstNode, AstPtr, SyntaxNode, SyntaxNodePtr}; 17use syntax::{ast, match_ast, AstNode, AstPtr, SyntaxNode, SyntaxNodePtr};
17 18
18/// `AstId` points to an AST node in a specific file. 19/// `AstId` points to an AST node in a specific file.
@@ -62,12 +63,13 @@ type ErasedFileAstId = Idx<SyntaxNodePtr>;
62#[derive(Debug, PartialEq, Eq, Default)] 63#[derive(Debug, PartialEq, Eq, Default)]
63pub struct AstIdMap { 64pub struct AstIdMap {
64 arena: Arena<SyntaxNodePtr>, 65 arena: Arena<SyntaxNodePtr>,
66 _c: Count<Self>,
65} 67}
66 68
67impl AstIdMap { 69impl AstIdMap {
68 pub(crate) fn from_source(node: &SyntaxNode) -> AstIdMap { 70 pub(crate) fn from_source(node: &SyntaxNode) -> AstIdMap {
69 assert!(node.parent().is_none()); 71 assert!(node.parent().is_none());
70 let mut res = AstIdMap { arena: Arena::default() }; 72 let mut res = AstIdMap::default();
71 // By walking the tree in breadth-first order we make sure that parents 73 // By walking the tree in breadth-first order we make sure that parents
72 // get lower ids then children. That is, adding a new child does not 74 // get lower ids then children. That is, adding a new child does not
73 // change parent's id. This means that, say, adding a new function to a 75 // change parent's id. This means that, say, adding a new function to a
diff --git a/crates/profile/Cargo.toml b/crates/profile/Cargo.toml
index 4dd9acc98..486f9c164 100644
--- a/crates/profile/Cargo.toml
+++ b/crates/profile/Cargo.toml
@@ -14,7 +14,7 @@ once_cell = "1.3.1"
14cfg-if = "1" 14cfg-if = "1"
15libc = "0.2.73" 15libc = "0.2.73"
16la-arena = { version = "0.2.0", path = "../../lib/arena" } 16la-arena = { version = "0.2.0", path = "../../lib/arena" }
17countme = { version = "2.0.0", features = ["enable"] } 17countme = { version = "2.0.1", features = ["enable"] }
18jemalloc-ctl = { version = "0.3.3", optional = true } 18jemalloc-ctl = { version = "0.3.3", optional = true }
19 19
20[target.'cfg(target_os = "linux")'.dependencies] 20[target.'cfg(target_os = "linux")'.dependencies]