diff options
Diffstat (limited to 'src')
3 files changed, 4 insertions, 68 deletions
diff --git a/src/compiler/scala/tools/nsc/symtab/classfile/Pickler.scala b/src/compiler/scala/tools/nsc/symtab/classfile/Pickler.scala index a44270468b..9cd9e9529d 100644 --- a/src/compiler/scala/tools/nsc/symtab/classfile/Pickler.scala +++ b/src/compiler/scala/tools/nsc/symtab/classfile/Pickler.scala @@ -70,7 +70,7 @@ abstract class Pickler extends SubComponent { import scala.collection.mutable.LinkedHashMap private var entries = new Array[AnyRef](256) private var ep = 0 - private val index = new LinkedHashMap[AnyRef, (Int, Int)] + private val index = new LinkedHashMap[AnyRef, Int] /** Is symbol an existentially bound variable with a package as owner? * Such symbols should be treated as if they were local. @@ -113,12 +113,7 @@ abstract class Pickler extends SubComponent { entries = entries1 } entries(ep) = entry - index(entry) = (ep, entry.hashCode()) // debug NoSuchElementException - // debug NoSuchElementException - if (index.get(entry) == None) { - println("could not add entry: "+ entry) - index.printHashTable(entry.hashCode()) - } + index(entry) = ep ep = ep + 1 true } @@ -480,16 +475,7 @@ abstract class Pickler extends SubComponent { * * @param ref ... */ - private def writeRef(ref: AnyRef) { - try { - writeNat(index(ref)._1) // debug NoSuchElementException - } catch { - case e: java.util.NoSuchElementException => - println("entry not found: "+ ref) - index.printHashTable(ref.hashCode()) - throw e - } - } + private def writeRef(ref: AnyRef) { writeNat(index(ref)) } private def writeRefs(refs: List[AnyRef]) { refs foreach writeRef } /** Write name, owner, flags, and info of a symbol. diff --git a/src/library/scala/collection/mutable/HashTable.scala b/src/library/scala/collection/mutable/HashTable.scala index 56843013ad..77211f41b4 100644 --- a/src/library/scala/collection/mutable/HashTable.scala +++ b/src/library/scala/collection/mutable/HashTable.scala @@ -146,7 +146,7 @@ trait HashTable[A] extends AnyRef { private def newThreshold(size: Int) = ((size.toLong * loadFactor)/loadFactorDenum).toInt - /* debug NoSuchElementException private*/ protected def resize(newSize: Int) = { + private def resize(newSize: Int) = { val oldTable = table table = new Array(newSize) var i = oldTable.length - 1 diff --git a/src/library/scala/collection/mutable/LinkedHashMap.scala b/src/library/scala/collection/mutable/LinkedHashMap.scala index c43a3ee2f4..fb19a7e84e 100644 --- a/src/library/scala/collection/mutable/LinkedHashMap.scala +++ b/src/library/scala/collection/mutable/LinkedHashMap.scala @@ -111,54 +111,4 @@ class LinkedHashMap[A, B] extends Map[A, B] super[HashTable].clear() firstEntry = null } - - // debug NoSuchElementException in Pickler - var previousTables: List[(String, Int)] = Nil - - override protected def resize(newSize: Int) { - previousTables = (tableString(table), table.length) :: previousTables - super.resize(newSize) - // check consistency - for (i <- 0 until table.length) { - var e = table(i) - while (e != null) { - if (index(e.key.hashCode()) != i) { - println("INCONSISTENT entry at "+ i +" after resize. before:") - println("index before: "+ indx(e.key.hashCode(), previousTables.head._2)) - println(previousTables.head._1) - println("AFTER:") - println("index after: "+ index(e.key.hashCode())) - println(tableString(table)) - } - e = e.next - } - } - } - - def tableString(table: Array[HashEntry[A, Entry]]): String = { - val sb = new StringBuilder - for (i <- 0 until table.length) { - sb.append(""+ i +": ") - var e = table(i).asInstanceOf[Entry] - while (e != null) { - sb.append("("+ (try { e.key.toString } catch { case _ => "<..>"}) +" -> "+ e.value +"), ") - e = e.next - } - sb.append("\n") - } - sb.toString - } - - def indx(hash: Int, length: Int) = improve(hash) & (length - 1) - def printHashTable(notFoundHash: Int) { - println("Hash not found: "+ notFoundHash) - println("hashtables") - for (tb <- previousTables.reverse) { - println("with index: "+ indx(notFoundHash, tb._2)) - println(tb._1) - println(" ==> RESIZE, then:") - } - println("with index: "+ index(notFoundHash)) - println(tableString(table)) - } } |