Skip to content

Commit 698577e

Browse files
committed
Add counters for some Symbol and Denotation operations and types
1 parent 58d7aeb commit 698577e

File tree

4 files changed

+14
-2
lines changed

4 files changed

+14
-2
lines changed

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import printing.Printer
2121
import io.AbstractFile
2222
import config.Config
2323
import util.common._
24+
import util.Stats
2425
import collection.mutable.ListBuffer
2526
import Decorators.SymbolIteratorDecorator
2627

@@ -174,6 +175,7 @@ object Denotations {
174175
abstract class Denotation(val symbol: Symbol) extends PreDenotation with printing.Showable {
175176

176177
type AsSeenFromResult <: Denotation
178+
Stats.record("Denotation")
177179

178180
/** The type info of the denotation, exists only for non-overloaded denotations */
179181
def info(implicit ctx: Context): Type
@@ -1159,6 +1161,8 @@ object Denotations {
11591161
def denot1: PreDenotation
11601162
def denot2: PreDenotation
11611163

1164+
Stats.record("MultiPreDenotation")
1165+
11621166
assert(denot1.exists && denot2.exists, s"Union of non-existing denotations ($denot1) and ($denot2)")
11631167
def first = denot1.first
11641168
def last = denot2.last
@@ -1310,7 +1314,7 @@ object Denotations {
13101314

13111315
/** An exception for accessing symbols that are no longer valid in current run */
13121316
class StaleSymbol(msg: => String) extends Exception {
1313-
util.Stats.record("stale symbol")
1317+
Stats.record("stale symbol")
13141318
override def getMessage() = msg
13151319
}
13161320
}

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,8 @@ object SymDenotations {
131131

132132
//assert(symbol.id != 4940, name)
133133

134+
Stats.record("SymDenotation")
135+
134136
override def hasUniqueSym: Boolean = exists
135137

136138
/** Debug only

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import Denotations.{ Denotation, SingleDenotation, MultiDenotation }
2929
import collection.mutable
3030
import io.AbstractFile
3131
import language.implicitConversions
32-
import util.{NoSource, DotClass, Property}
32+
import util.{NoSource, DotClass, Property, Stats}
3333
import scala.collection.JavaConverters._
3434
import config.Printers.typr
3535

@@ -416,6 +416,8 @@ object Symbols {
416416

417417
//assert(id != 723)
418418

419+
Stats.record("Symbol")
420+
419421
def coord: Coord = myCoord
420422
/** Set the coordinate of this class, this is only useful when the coordinate is
421423
* not known at symbol creation. This is the case for root symbols
@@ -442,19 +444,22 @@ object Symbols {
442444

443445
/** The current denotation of this symbol */
444446
final def denot(implicit ctx: Context): SymDenotation = {
447+
Stats.record("Symbol.denot")
445448
val lastd = lastDenot
446449
if (checkedPeriod == ctx.period) lastd
447450
else computeDenot(lastd)
448451
}
449452

450453
private def computeDenot(lastd: SymDenotation)(implicit ctx: Context): SymDenotation = {
454+
Stats.record("Symbol.computeDenot")
451455
val now = ctx.period
452456
checkedPeriod = now
453457
if (lastd.validFor contains now) lastd else recomputeDenot(lastd)
454458
}
455459

456460
/** Overridden in NoSymbol */
457461
protected def recomputeDenot(lastd: SymDenotation)(implicit ctx: Context) = {
462+
Stats.record("Symbol.recomputeDenot")
458463
val newd = lastd.current.asInstanceOf[SymDenotation]
459464
lastDenot = newd
460465
newd

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1694,6 +1694,7 @@ object Types {
16941694

16951695
/** The denotation currently denoted by this type */
16961696
final def denot(implicit ctx: Context): Denotation = {
1697+
record("NamedType.denot")
16971698
val now = ctx.period
16981699
// Even if checkedPeriod == now we still need to recheck lastDenotation.validFor
16991700
// as it may have been mutated by SymDenotation#installAfter

0 commit comments

Comments
 (0)