diff options
author | Paul Phillips <paulp@improving.org> | 2011-05-21 15:03:20 +0000 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2011-05-21 15:03:20 +0000 |
commit | 83703d1e446b77899bbf45d77c213fee0aa69ab7 (patch) | |
tree | 360a370b4994054ef5e84c88211c8748dea89bb0 | |
parent | 2beeb23cc71273a2b6a262317a95a06df3491fbf (diff) | |
download | scala-83703d1e446b77899bbf45d77c213fee0aa69ab7.tar.gz scala-83703d1e446b77899bbf45d77c213fee0aa69ab7.tar.bz2 scala-83703d1e446b77899bbf45d77c213fee0aa69ab7.zip |
Uglified an unpickler method based on profiler ...
Uglified an unpickler method based on profiler input, no review.
-rw-r--r-- | src/compiler/scala/reflect/internal/pickling/UnPickler.scala | 43 |
1 files changed, 28 insertions, 15 deletions
diff --git a/src/compiler/scala/reflect/internal/pickling/UnPickler.scala b/src/compiler/scala/reflect/internal/pickling/UnPickler.scala index 67a5639b76..6c9ef4d545 100644 --- a/src/compiler/scala/reflect/internal/pickling/UnPickler.scala +++ b/src/compiler/scala/reflect/internal/pickling/UnPickler.scala @@ -61,24 +61,37 @@ abstract class UnPickler /*extends reflect.generic.UnPickler*/ { //println("unpickled " + classRoot + ":" + classRoot.rawInfo + ", " + moduleRoot + ":" + moduleRoot.rawInfo);//debug + // Laboriously unrolled for performance. def run() { - // read children last, fix for #3951 - val queue = new collection.mutable.ListBuffer[() => Unit]() - def delay(i: Int, action: => Unit) { - queue += (() => at(i, {() => action; null})) + var i = 0 + while (i < index.length) { + if (entries(i) == null && isSymbolEntry(i)) { + val savedIndex = readIndex + readIndex = index(i) + entries(i) = readSymbol() + readIndex = savedIndex + } + i += 1 } - - for (i <- 0 until index.length) { - if (isSymbolEntry(i)) - at(i, readSymbol) - else if (isSymbolAnnotationEntry(i)) - delay(i, readSymbolAnnotation()) - else if (isChildrenEntry(i)) - delay(i, readChildren()) + // read children last, fix for #3951 + i = 0 + while (i < index.length) { + if (entries(i) == null) { + if (isSymbolAnnotationEntry(i)) { + val savedIndex = readIndex + readIndex = index(i) + readSymbolAnnotation() + readIndex = savedIndex + } + else if (isChildrenEntry(i)) { + val savedIndex = readIndex + readIndex = index(i) + readChildren() + readIndex = savedIndex + } + } + i += 1 } - - for (action <- queue) - action() } private def checkVersion() { |