Skip to content

Commit ddf4b16

Browse files
committed
More detailed stats
Mostly used to profile compileStdLib. Stats are about base types and mixin forwarders.
1 parent f07d964 commit ddf4b16

File tree

3 files changed

+13
-5
lines changed

3 files changed

+13
-5
lines changed

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1670,6 +1670,7 @@ object SymDenotations {
16701670
}
16711671

16721672
/*>|>*/ ctx.debugTraceIndented(s"$tp.baseType($this)") /*<|<*/ {
1673+
Stats.record("baseTypeOf")
16731674
tp match {
16741675
case tp: CachedType =>
16751676
val btrCache = baseTypeCache
@@ -1679,8 +1680,9 @@ object SymDenotations {
16791680
btrCache.put(tp, NoPrefix)
16801681
basetp = computeBaseTypeOf(tp)
16811682
if (!basetp.exists) Stats.record("base type miss")
1682-
if (isCachable(tp, baseTypeCache)) {
1683-
if (!basetp.exists) Stats.record("cached base type miss")
1683+
if (isCachable(tp, btrCache)) {
1684+
if (basetp.exists) Stats.record("cached base type hit")
1685+
else Stats.record("cached base type miss")
16841686
btrCache.put(tp, basetp)
16851687
}
16861688
else btrCache.remove(tp)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -848,7 +848,7 @@ object Types {
848848
/** The basetype TypeRef of this type with given class symbol,
849849
* but without including any type arguments
850850
*/
851-
final def baseType(base: Symbol)(implicit ctx: Context): Type = /*ctx.traceIndented(s"$this baseType $base")*/ /*>|>*/ track("baseType") /*<|<*/ {
851+
final def baseType(base: Symbol)(implicit ctx: Context): Type = /*ctx.traceIndented(s"$this baseType $base")*/ /*>|>*/ track("base type") /*<|<*/ {
852852
base.denot match {
853853
case classd: ClassDenotation => classd.baseTypeOf(this)
854854
case _ => NoType

compiler/src/dotty/tools/dotc/transform/ResolveSuper.scala

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,17 @@ class ResolveSuper extends MiniPhaseTransform with IdentityDenotTransformer { th
6262

6363
def superAccessors(mixin: ClassSymbol): List[Tree] =
6464
for (superAcc <- mixin.info.decls.filter(_.isSuperAccessor).toList)
65-
yield polyDefDef(implementation(superAcc.asTerm), forwarder(rebindSuper(cls, superAcc)))
65+
yield {
66+
util.Stats.record("super accessors")
67+
polyDefDef(implementation(superAcc.asTerm), forwarder(rebindSuper(cls, superAcc)))
68+
}
6669

6770
def methodOverrides(mixin: ClassSymbol): List[Tree] =
6871
for (meth <- mixin.info.decls.toList if needsForwarder(meth))
69-
yield polyDefDef(implementation(meth.asTerm), forwarder(meth))
72+
yield {
73+
util.Stats.record("method forwarders")
74+
polyDefDef(implementation(meth.asTerm), forwarder(meth))
75+
}
7076

7177
val overrides = mixins.flatMap(mixin => superAccessors(mixin) ::: methodOverrides(mixin))
7278

0 commit comments

Comments
 (0)