Skip to content

Commit f27cd43

Browse files
committed
More extensive stats
1 parent ed5eb24 commit f27cd43

File tree

4 files changed

+14
-2
lines changed

4 files changed

+14
-2
lines changed

compiler/src/dotty/tools/dotc/ast/Trees.scala

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1114,6 +1114,8 @@ object Trees {
11141114
abstract class TreeMap(val cpy: TreeCopier = inst.cpy) {
11151115

11161116
def transform(tree: Tree)(implicit ctx: Context): Tree = {
1117+
Stats.record(s"TreeMap.transform $getClass")
1118+
Stats.record("TreeMap.transform total")
11171119
def localCtx =
11181120
if (tree.hasType && tree.symbol.exists) ctx.withOwner(tree.symbol) else ctx
11191121

@@ -1228,6 +1230,8 @@ object Trees {
12281230

12291231
def apply(x: X, trees: Traversable[Tree])(implicit ctx: Context): X = (x /: trees)(apply)
12301232
def foldOver(x: X, tree: Tree)(implicit ctx: Context): X = {
1233+
Stats.record(s"TreeAccumulator.foldOver $getClass")
1234+
Stats.record("TreeAccumulator.foldOver total")
12311235
def localCtx =
12321236
if (tree.hasType && tree.symbol.exists) ctx.withOwner(tree.symbol) else ctx
12331237
tree match {

compiler/src/dotty/tools/dotc/core/Types.scala

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3720,6 +3720,8 @@ object Types {
37203720

37213721
/** Map this function over given type */
37223722
def mapOver(tp: Type): Type = {
3723+
record(s"mapOver ${getClass}")
3724+
record("mapOver total")
37233725
implicit val ctx = this.ctx
37243726
tp match {
37253727
case tp: NamedType =>
@@ -4095,7 +4097,10 @@ object Types {
40954097
protected final def applyToPrefix(x: T, tp: NamedType) =
40964098
atVariance(variance max 0)(this(x, tp.prefix)) // see remark on NamedType case in TypeMap
40974099

4098-
def foldOver(x: T, tp: Type): T = tp match {
4100+
def foldOver(x: T, tp: Type): T = {
4101+
record(s"foldOver $getClass")
4102+
record(s"foldOver total")
4103+
tp match {
40994104
case tp: TypeRef =>
41004105
if (stopAtStatic && tp.symbol.isStatic) x
41014106
else {
@@ -4184,7 +4189,7 @@ object Types {
41844189
tp.fold(x, this)
41854190

41864191
case _ => x
4187-
}
4192+
}}
41884193

41894194
@tailrec final def foldOver(x: T, ts: List[Type]): T = ts match {
41904195
case t :: ts1 => foldOver(apply(x, t), ts1)

compiler/src/dotty/tools/dotc/transform/TreeTransform.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1183,6 +1183,7 @@ object TreeTransforms {
11831183
def transform(tree: Tree, info: TransformerInfo, cur: Int)(implicit ctx: Context): Tree = ctx.traceIndented(s"transforming ${tree.show} at ${ctx.phase}", transforms, show = true) {
11841184
try
11851185
if (cur < info.transformers.length) {
1186+
util.Stats.record("TreeTransform.transform")
11861187
// if cur > 0 then some of the symbols can be created by already performed transformations
11871188
// this means that their denotations could not exists in previous period
11881189
val pctx = ctx.withPhase(info.transformers(cur).treeTransformPhase)

compiler/src/dotty/tools/dotc/typer/Typer.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1687,6 +1687,8 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
16871687
}
16881688

16891689
def typed(tree: untpd.Tree, pt: Type = WildcardType)(implicit ctx: Context): Tree = /*>|>*/ ctx.traceIndented (i"typing $tree", typr, show = true) /*<|<*/ {
1690+
record(s"typed $getClass")
1691+
record("typed total")
16901692
assertPositioned(tree)
16911693
try adapt(typedUnadapted(tree, pt), pt)
16921694
catch {

0 commit comments

Comments
 (0)