8000 Make -Ystatistics work without recompiling · retronym/scala@7fbd80f · GitHub
[go: up one dir, main page]

Skip to content

Commit 7fbd80f

Browse files
committed
Make -Ystatistics work without recompiling
1 parent 5ad4c88 commit 7fbd80f

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

src/reflect/scala/reflect/internal/Types.scala

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3828,7 +3828,10 @@ trait Types
38283828
// as a) this is now a weak set, and b) it is discarded completely before the next run.
38293829
uniqueRunId = currentRunId
38303830
}
3831-
(uniques findEntryOrUpdate tp).asInstanceOf[T]
3831+
val result = (uniques findEntryOrUpdate tp).asInstanceOf[T]
3832+
3833+
if (Statistics.canEnable && (result eq tp)) Statistics.incCounter(rawTypeNewEntries)
3834+
result
38323835
}
38333836

38343837
// Helper Classes ---------------------------------------------------------
@@ -4836,6 +4839,7 @@ object TypeConstants {
48364839
object TypesStats {
48374840
import BaseTypeSeqsStats._
48384841
val rawTypeCount = Statistics.newCounter ("#raw type creations")
4842+
val rawTypeNewEntries = Statistics.newSubCounter(" of which are new entries", rawTypeCount)
48394843
val subtypeCount = Statistics.newCounter ("#subtype ops")
48404844
val sametypeCount = Statistics.newCounter ("#sametype ops")
48414845
val lubCount = Statistics.newCounter ("#toplevel lubs/glbs")
@@ -4856,7 +4860,6 @@ object TypesStats {
48564860
val typerefBaseTypeSeqCount = Statistics.newSubCounter(" of which for typerefs", baseTypeSeqCount)
48574861
val singletonBaseTypeSeqCount = Statistics.newSubCounter(" of which for singletons", baseTypeSeqCount)
48584862
val typeOpsStack = Statistics.newTimerStack()
4859-
48604863
/* Commented out, because right now this does not inline, so creates a closure which will distort statistics
48614864
@inline final def timedTypeOp[T](c: Statistics.StackableTimer)(op: => T): T = {
48624865
val start = Statistics.pushTimer(typeOpsStack, c)

src/reflect/scala/reflect/internal/util/Statistics.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ quant)
256256
*
257257
* to remove all Statistics code from build
258258
*/
259-
final val canEnable = _enabled
259+
final val canEnable = true
260260

261261
/** replace with
262262
*

0 commit comments

Comments
 (0)
0