Skip to content

Commit 9982d19

Browse files
committed
Track time spent in resolveOverloaded
1 parent 31a4874 commit 9982d19

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1647,7 +1647,7 @@ trait Applications extends Compatibility {
16471647
* Two trials: First, without implicits or SAM conversions enabled. Then,
16481648
* if the first finds no eligible candidates, with implicits and SAM conversions enabled.
16491649
*/
1650-
def resolveOverloaded(alts: List[TermRef], pt: Type)(using Context): List[TermRef] =
1650+
def resolveOverloaded(alts: List[TermRef], pt: Type)(using Context): List[TermRef] = util.Stats.trackTime("resolveOver ms") {
16511651
record("resolveOverloaded")
16521652

16531653
/** Is `alt` a method or polytype whose result type after the first value parameter
@@ -1745,6 +1745,7 @@ trait Applications extends Compatibility {
17451745
resolve(expanded).map(retract)
17461746
}
17471747
else resolve(alts)
1748+
}
17481749
end resolveOverloaded
17491750

17501751
/** This private version of `resolveOverloaded` does the bulk of the work of

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

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,12 @@ import EtaExpansion.etaExpand
2929
import TypeComparer.CompareResult
3030
import util.Spans._
3131
import util.common._
32-
import util.{Property, SimpleIdentityMap, SrcPos}
32+
import util.{Property, SimpleIdentityMap, SrcPos, Stats}
3333
import Applications.{ExtMethodApply, IntegratedTypeArgs, productSelectorTypes, wrapDefs}
3434

3535
import collection.mutable
3636
import annotation.tailrec
3737
import Implicits._
38-
import util.Stats.record
3938
import config.Printers.{gadts, typr, debug}
4039
import config.Feature._
4140
import config.SourceVersion._
@@ -434,7 +433,7 @@ class Typer extends Namer
434433
* (3) Change pattern Idents id (but not wildcards) to id @ _
435434
*/
436435
def typedIdent(tree: untpd.Ident, pt: Type)(using Context): Tree =
437-
record("typedIdent")
436+
Stats.record("typedIdent")
438437
val name = tree.name
439438
def kind = if (name.isTermName) "" else "type "
440439
typr.println(s"typed ident $kind$name in ${ctx.owner}")
@@ -551,7 +550,7 @@ class Typer extends Namer
551550
}
552551

553552
def typedSelect(tree: untpd.Select, pt: Type)(using Context): Tree = {
554-
record("typedSelect")
553+
Stats.record("typedSelect")
555554

556555
def typeSelectOnTerm(using Context): Tree =
557556
typedSelect(tree, pt, typedExpr(tree.qualifier, selectionProto(tree.name, pt, this)))
@@ -582,7 +581,7 @@ class Typer extends Namer
582581
}
583582

584583
def typedThis(tree: untpd.This)(using Context): Tree = {
585-
record("typedThis")
584+
Stats.record("typedThis")
586585
assignType(tree)
587586
}
588587

@@ -602,7 +601,7 @@ class Typer extends Namer
602601
def typedNumber(tree: untpd.Number, pt: Type)(using Context): Tree = {
603602
import scala.util.FromDigits._
604603
import untpd.NumberKind._
605-
record("typedNumber")
604+
Stats.record("typedNumber")
606605
val digits = tree.digits
607606
val target = pt.dealias
608607
def lit(value: Any) = Literal(Constant(value)).withSpan(tree.span)
@@ -2416,7 +2415,7 @@ class Typer extends Namer
24162415
* at the present time
24172416
*/
24182417
def typedUnadapted(initTree: untpd.Tree, pt: Type, locked: TypeVars)(using Context): Tree = {
2419-
record("typedUnadapted")
2418+
Stats.record("typedUnadapted")
24202419
val xtree = expanded(initTree)
24212420
xtree.removeAttachment(TypedAhead) match {
24222421
case Some(ttree) => ttree
@@ -2578,8 +2577,8 @@ class Typer extends Namer
25782577
/** Typecheck and adapt tree, returning a typed tree. Parameters as for `typedUnadapted` */
25792578
def typed(tree: untpd.Tree, pt: Type, locked: TypeVars)(using Context): Tree =
25802579
trace(i"typing $tree, pt = $pt", typr, show = true) {
2581-
record(s"typed $getClass")
2582-
record("typed total")
2580+
Stats.record(s"typed $getClass")
2581+
Stats.record("typed total")
25832582
if ctx.phase.isTyper then
25842583
assertPositioned(tree)
25852584
if tree.source != ctx.source && tree.source.exists then
@@ -2715,11 +2714,11 @@ class Typer extends Namer
27152714
val nestedCtx = ctx.fresh.setNewTyperState()
27162715
val result = op(using nestedCtx)
27172716
if (nestedCtx.reporter.hasErrors && !nestedCtx.reporter.hasStickyErrors) {
2718-
record("tryEither.fallBack")
2717+
Stats.record("tryEither.fallBack")
27192718
fallBack(result, nestedCtx.typerState)
27202719
}
27212720
else {
2722-
record("tryEither.commit")
2721+
Stats.record("tryEither.commit")
27232722
nestedCtx.typerState.commit()
27242723
result
27252724
}
@@ -2916,7 +2915,7 @@ class Typer extends Namer
29162915
def adapt(tree: Tree, pt: Type, locked: TypeVars, tryGadtHealing: Boolean = true)(using Context): Tree =
29172916
try
29182917
trace(i"adapting $tree to $pt ${if (tryGadtHealing) "" else "(tryGadtHealing=false)" }\n", typr, show = true) {
2919-
record("adapt")
2918+
Stats.record("adapt")
29202919
adapt1(tree, pt, locked, tryGadtHealing)
29212920
}
29222921
catch case ex: TypeError => errorTree(tree, ex, tree.srcPos.focus)

compiler/src/dotty/tools/dotc/util/Stats.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import collection.mutable
99

1010
@sharable object Stats {
1111

12-
final val enabled = false
12+
inline val enabled = false
1313

1414
var monitored: Boolean = false
1515

0 commit comments

Comments
 (0)