Skip to content

Commit 44b1a9b

Browse files
committed
Get rid of superIds
1 parent d648fd1 commit 44b1a9b

File tree

2 files changed

+0
-44
lines changed

2 files changed

+0
-44
lines changed

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

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -597,26 +597,6 @@ object Contexts {
597597

598598
def nextId = { _nextId += 1; _nextId }
599599

600-
/** A map from a superclass id to the typeref of the class that has it */
601-
private[core] var classOfId = new Array[ClassSymbol](Config.InitialSuperIdsSize)
602-
603-
/** A map from a the typeref of a class to its superclass id */
604-
private[core] val superIdOfClass = new mutable.AnyRefMap[ClassSymbol, Int]
605-
606-
/** The last allocated superclass id */
607-
private[core] var lastSuperId = -1
608-
609-
/** Allocate and return next free superclass id */
610-
private[core] def nextSuperId: Int = {
611-
lastSuperId += 1
612-
if (lastSuperId >= classOfId.length) {
613-
val tmp = new Array[ClassSymbol](classOfId.length * 2)
614-
classOfId.copyToArray(tmp)
615-
classOfId = tmp
616-
}
617-
lastSuperId
618-
}
619-
620600
// Types state
621601
/** A table for hash consing unique types */
622602
private[core] val uniques = new util.HashSet[Type](Config.initialUniquesCapacity) {
@@ -682,9 +662,6 @@ object Contexts {
682662

683663
def reset() = {
684664
for ((_, set) <- uniqueSets) set.clear()
685-
for (i <- 0 until classOfId.length) classOfId(i) = null
686-
superIdOfClass.clear()
687-
lastSuperId = -1
688665
}
689666

690667
// Test that access is single threaded

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

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -562,27 +562,6 @@ object Symbols {
562562
final def classDenot(implicit ctx: Context): ClassDenotation =
563563
denot.asInstanceOf[ClassDenotation]
564564

565-
private var superIdHint: Int = -1
566-
567-
override def superId(implicit ctx: Context): Int = {
568-
val hint = superIdHint
569-
if (hint >= 0 && hint <= ctx.lastSuperId && (ctx.classOfId(hint) eq this))
570-
hint
571-
else {
572-
val id = ctx.superIdOfClass get this match {
573-
case Some(id) =>
574-
id
575-
case None =>
576-
val id = ctx.nextSuperId
577-
ctx.superIdOfClass(this) = id
578-
ctx.classOfId(id) = this
579-
id
580-
}
581-
superIdHint = id
582-
id
583-
}
584-
}
585-
586565
override protected def prefixString = "ClassSymbol"
587566
}
588567

0 commit comments

Comments
 (0)