Skip to content

Commit 9bada40

Browse files
committed
More extensive stats about generated trees
1 parent 5979e36 commit 9bada40

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

src/dotty/tools/dotc/Run.scala

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,9 @@ class Run(comp: Compiler)(implicit ctx: Context) {
8282
ctx.informTime(s"$phase ", start)
8383
}
8484
if (!ctx.reporter.hasErrors) Rewrites.writeBack()
85+
for (unit <- units)
86+
Stats.record("retained typed trees at end", unit.tpdTree.treeSize)
87+
Stats.record("total trees at end", ast.Trees.ntrees)
8588
}
8689

8790
private sealed trait PrintedTree

src/dotty/tools/dotc/typer/FrontEnd.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ class FrontEnd extends Phase {
4949
val unit = ctx.compilationUnit
5050
unit.tpdTree = ctx.typer.typedExpr(unit.untpdTree)
5151
typr.println("typed: " + unit.source)
52-
record("retainedUntypedTrees", unit.untpdTree.treeSize)
53-
record("retainedTypedTrees", unit.tpdTree.treeSize)
52+
record("retained untyped trees", unit.untpdTree.treeSize)
53+
record("retained typed trees after typer", unit.tpdTree.treeSize)
5454
}
5555

5656
private def firstTopLevelDef(trees: List[tpd.Tree])(implicit ctx: Context): Symbol = trees match {
@@ -72,7 +72,7 @@ class FrontEnd extends Phase {
7272
record("parsedTrees", ast.Trees.ntrees)
7373
unitContexts foreach (enterSyms(_))
7474
unitContexts foreach (typeCheck(_))
75-
record("totalTrees", ast.Trees.ntrees)
75+
record("total trees after typer", ast.Trees.ntrees)
7676
unitContexts.map(_.compilationUnit).filterNot(discardAfterTyper)
7777
}
7878

0 commit comments

Comments
 (0)