File tree Expand file tree Collapse file tree 4 files changed +20
-3
lines changed Expand file tree Collapse file tree 4 files changed +20
-3
lines changed Original file line number Diff line number Diff line change @@ -297,6 +297,18 @@ object Trees {
297
297
def orElse [U >: Untyped <: T ](that : => Tree [U ]): Tree [U ] =
298
298
if (this eq genericEmptyTree) that else this
299
299
300
+ /** The number of nodes in this tree */
301
+ def treeSize : Int = {
302
+ var s = 1
303
+ def addSize (elem : Any ): Unit = elem match {
304
+ case t : Tree [_] => s += t.treeSize
305
+ case ts : List [_] => ts foreach addSize
306
+ case _ =>
307
+ }
308
+ productIterator foreach addSize
309
+ s
310
+ }
311
+
300
312
override def toText (printer : Printer ) = printer.toText(this )
301
313
302
314
override def hashCode (): Int = System .identityHashCode(this )
Original file line number Diff line number Diff line change @@ -195,7 +195,7 @@ class TypeComparer(initctx: Context) extends DotClass {
195
195
val saved = constraint
196
196
val savedSuccessCount = successCount
197
197
val savedTotalCount = totalCount
198
- if (Stats .monitored) Stats .record(s " isSubType ${tp1.show} <:< ${tp2.show}" )
198
+ // if (Stats.monitored) Stats.record(s"isSubType ${tp1.show} <:< ${tp2.show}")
199
199
try {
200
200
recCount += 1
201
201
/* !!! DEBUG
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ import Phases._
6
6
import Contexts ._
7
7
import parsing .Parsers .Parser
8
8
import config .Printers ._
9
+ import util .Stats ._
9
10
10
11
class FrontEnd extends Phase {
11
12
@@ -35,13 +36,17 @@ class FrontEnd extends Phase {
35
36
val unit = ctx.compilationUnit
36
37
unit.tpdTree = ctx.typer.typedExpr(unit.untpdTree)
37
38
typr.println(" typed: " + unit.source)
39
+ record(" retainedUntypedTrees" , unit.untpdTree.treeSize)
40
+ record(" retainedTypedTrees" , unit.tpdTree.treeSize)
38
41
}
39
42
40
43
override def runOn (units : List [CompilationUnit ])(implicit ctx : Context ): Unit = {
41
44
val unitContexts = units map (unit => ctx.fresh.withCompilationUnit(unit))
42
45
unitContexts foreach (parse(_))
46
+ record(" parsedTrees" , ast.Trees .ntrees)
43
47
unitContexts foreach (enterSyms(_))
44
48
unitContexts foreach (typeCheck(_))
49
+ record(" totalTrees" , ast.Trees .ntrees)
45
50
}
46
51
47
52
override def run (implicit ctx : Context ): Unit = {
Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ import util.SourcePosition
28
28
import collection .mutable
29
29
import annotation .tailrec
30
30
import Implicits ._
31
- import util .Stats .track
31
+ import util .Stats .{ track , record }
32
32
import config .Printers ._
33
33
import language .implicitConversions
34
34
@@ -959,7 +959,7 @@ class Typer extends Namer with Applications with Implicits {
959
959
}
960
960
961
961
def typedUnadapted (initTree : untpd.Tree , pt : Type = WildcardType )(implicit ctx : Context ): Tree = {
962
-
962
+ record( " typedUnadapted " )
963
963
val xtree = expanded(initTree)
964
964
xtree.removeAttachment(TypedAhead ) match {
965
965
case Some (ttree) => ttree
You can’t perform that action at this time.
0 commit comments