File tree 4 files changed +15
-3
lines changed
compiler/src/dotty/tools/dotc 4 files changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -433,7 +433,10 @@ object Contexts {
433
433
}
434
434
435
435
/** A fresh clone of this context. */
436
- def fresh : FreshContext = clone.asInstanceOf [FreshContext ].init(this )
436
+ def fresh : FreshContext = {
437
+ util.Stats .record(" Context.fresh" )
438
+ clone.asInstanceOf [FreshContext ].init(this )
439
+ }
437
440
438
441
final def withOwner (owner : Symbol ): Context =
439
442
if (owner ne this .owner) fresh.setOwner(owner) else this
Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ import reporting._
9
9
import config .Config
10
10
import collection .mutable
11
11
import java .lang .ref .WeakReference
12
+ import util .Stats
12
13
13
14
import scala .annotation .internal .sharable
14
15
@@ -18,6 +19,8 @@ object TyperState {
18
19
19
20
class TyperState (previous : TyperState /* | Null */ ) {
20
21
22
+ Stats .record(" typerState" )
23
+
21
24
val id : Int = TyperState .nextId
22
25
TyperState .nextId += 1
23
26
@@ -138,6 +141,7 @@ class TyperState(previous: TyperState /* | Null */) {
138
141
* many parts of dotty itself.
139
142
*/
140
143
def commit ()(implicit ctx : Context ): Unit = {
144
+ Stats .record(" typerState.commit" )
141
145
val targetState = ctx.typerState
142
146
assert(isCommittable)
143
147
targetState.constraint =
Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ package typer
5
5
import core ._
6
6
import ast .{Trees , tpd , untpd }
7
7
import util .Spans ._
8
- import util .Stats .track
8
+ import util .Stats .{ track , record }
9
9
import util .{SourcePosition , NoSourcePosition , SourceFile }
10
10
import Trees .Untyped
11
11
import Contexts ._
@@ -758,6 +758,7 @@ trait Applications extends Compatibility { self: Typer with Dynamic =>
758
758
759
759
def realApply (implicit ctx : Context ): Tree = track(" realApply" ) {
760
760
val originalProto = new FunProto (tree.args, IgnoredProto (pt))(this , tree.isContextual)(argCtx(tree))
761
+ record(" typedApply" )
761
762
val fun1 = typedExpr(tree.fun, originalProto)
762
763
763
764
// Warning: The following lines are dirty and fragile. We record that auto-tupling was demanded as
@@ -892,6 +893,7 @@ trait Applications extends Compatibility { self: Typer with Dynamic =>
892
893
def typedTypeApply (tree : untpd.TypeApply , pt : Type )(implicit ctx : Context ): Tree = track(" typedTypeApply" ) {
893
894
val isNamed = hasNamedArg(tree.args)
894
895
val typedArgs = if (isNamed) typedNamedArgs(tree.args) else tree.args.mapconserve(typedType(_))
896
+ record(" typedTypeApply" )
895
897
typedExpr(tree.fun, PolyProto (typedArgs, pt)) match {
896
898
case ExtMethodApply (app) =>
897
899
app
Original file line number Diff line number Diff line change @@ -2153,9 +2153,12 @@ class Typer extends Namer
2153
2153
def tryEither [T ](op : Context => T )(fallBack : (T , TyperState ) => T )(implicit ctx : Context ): T = {
2154
2154
val nestedCtx = ctx.fresh.setNewTyperState()
2155
2155
val result = op(nestedCtx)
2156
- if (nestedCtx.reporter.hasErrors)
2156
+ if (nestedCtx.reporter.hasErrors) {
2157
+ record(" tryEither.fallBack" )
2157
2158
fallBack(result, nestedCtx.typerState)
2159
+ }
2158
2160
else {
2161
+ record(" tryEither.commit" )
2159
2162
nestedCtx.typerState.commit()
2160
2163
result
2161
2164
}
You can’t perform that action at this time.
0 commit comments