diff options
6 files changed, 14 insertions, 18 deletions
diff --git a/src/compiler/scala/tools/nsc/backend/opt/Inliners.scala b/src/compiler/scala/tools/nsc/backend/opt/Inliners.scala index 3d7f08cebe..a3a19868e0 100644 --- a/src/compiler/scala/tools/nsc/backend/opt/Inliners.scala +++ b/src/compiler/scala/tools/nsc/backend/opt/Inliners.scala @@ -550,9 +550,9 @@ abstract class Inliners extends SubComponent { val activeHandlers = caller.handlers filter (_ covered block) /* Map 'original' blocks to the ones inlined in the caller. */ - val inlinedBlock: mutable.Map[BasicBlock, BasicBlock] = new mutable.HashMap + val inlinedBlock = mutable.Map[BasicBlock, BasicBlock]() - val varsInScope: mutable.Set[Local] = mutable.HashSet() ++= block.varsInScope + val varsInScope = mutable.HashSet[Local]() ++= block.varsInScope /** Side effects varsInScope when it sees SCOPE_ENTERs. */ def instrBeforeFilter(i: Instruction): Boolean = { diff --git a/src/compiler/scala/tools/nsc/transform/Constructors.scala b/src/compiler/scala/tools/nsc/transform/Constructors.scala index 820a8d7773..4370714fa5 100644 --- a/src/compiler/scala/tools/nsc/transform/Constructors.scala +++ b/src/compiler/scala/tools/nsc/transform/Constructors.scala @@ -24,8 +24,8 @@ abstract class Constructors extends Transform with ast.TreeDSL { protected def newTransformer(unit: CompilationUnit): Transformer = new ConstructorTransformer(unit) - private val guardedCtorStats: mutable.Map[Symbol, List[Tree]] = new mutable.HashMap[Symbol, List[Tree]] - private val ctorParams: mutable.Map[Symbol, List[Symbol]] = new mutable.HashMap[Symbol, List[Symbol]] + private val guardedCtorStats: mutable.Map[Symbol, List[Tree]] = perRunCaches.newMap[Symbol, List[Tree]] + private val ctorParams: mutable.Map[Symbol, List[Symbol]] = perRunCaches.newMap[Symbol, List[Symbol]] class ConstructorTransformer(unit: CompilationUnit) extends Transformer { diff --git a/src/compiler/scala/tools/nsc/transform/Flatten.scala b/src/compiler/scala/tools/nsc/transform/Flatten.scala index 89f1cc26e0..aa37c966e3 100644 --- a/src/compiler/scala/tools/nsc/transform/Flatten.scala +++ b/src/compiler/scala/tools/nsc/transform/Flatten.scala @@ -102,7 +102,7 @@ abstract class Flatten extends InfoTransform { class Flattener extends Transformer { /** Buffers for lifted out classes */ - private val liftedDefs = new mutable.HashMap[Symbol, ListBuffer[Tree]] + private val liftedDefs = perRunCaches.newMap[Symbol, ListBuffer[Tree]]() override def transform(tree: Tree): Tree = { tree match { diff --git a/src/compiler/scala/tools/nsc/transform/LazyVals.scala b/src/compiler/scala/tools/nsc/transform/LazyVals.scala index f8c5f5bfc6..18ab2e9326 100644 --- a/src/compiler/scala/tools/nsc/transform/LazyVals.scala +++ b/src/compiler/scala/tools/nsc/transform/LazyVals.scala @@ -50,9 +50,7 @@ abstract class LazyVals extends Transform with TypingTransformers with ast.TreeD */ class LazyValues(unit: CompilationUnit) extends TypingTransformer(unit) { /** map from method symbols to the number of lazy values it defines. */ - private val lazyVals = new mutable.HashMap[Symbol, Int] { - override def default(meth: Symbol) = 0 - } + private val lazyVals = perRunCaches.newMap[Symbol, Int]() withDefaultValue 0 import symtab.Flags._ import lazyVals._ @@ -233,9 +231,7 @@ abstract class LazyVals extends Transform with TypingTransformers with ast.TreeD private def mkSetFlag(bmp: Symbol, mask: Tree, bmpRef: Tree): Tree = bmpRef === (bmpRef INT_| mask) - val bitmaps = new mutable.HashMap[Symbol, List[Symbol]] { - override def default(meth: Symbol) = Nil - } + val bitmaps = mutable.Map[Symbol, List[Symbol]]() withDefaultValue Nil /** Return the symbol corresponding of the right bitmap int inside meth, * given offset. diff --git a/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala b/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala index bb0388e9f8..2282d04cd5 100644 --- a/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala +++ b/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala @@ -79,13 +79,13 @@ abstract class SpecializeTypes extends InfoTransform with TypingTransformers { val specializedClass: mutable.Map[(Symbol, TypeEnv), Symbol] = new mutable.LinkedHashMap /** Map a method symbol to a list of its specialized overloads in the same class. */ - private val overloads: mutable.Map[Symbol, List[Overload]] = mutable.HashMap[Symbol, List[Overload]]() withDefaultValue Nil + private val overloads = perRunCaches.newMap[Symbol, List[Overload]]() withDefaultValue Nil /** Map a symbol to additional information on specialization. */ - private val info: mutable.Map[Symbol, SpecializedInfo] = perRunCaches.newMap[Symbol, SpecializedInfo]() + private val info = perRunCaches.newMap[Symbol, SpecializedInfo]() /** Map class symbols to the type environments where they were created. */ - private val typeEnv = mutable.HashMap[Symbol, TypeEnv]() withDefaultValue emptyEnv + private val typeEnv = perRunCaches.newMap[Symbol, TypeEnv]() withDefaultValue emptyEnv // Key: a specialized class or method // Value: a map from tparams in the original class to tparams in the specialized class. @@ -97,7 +97,7 @@ abstract class SpecializeTypes extends InfoTransform with TypingTransformers { private val wasSpecializedForTypeVars = perRunCaches.newMap[Symbol, Set[Symbol]]() withDefaultValue Set() /** Concrete methods that use a specialized type, or override such methods. */ - private val concreteSpecMethods = new mutable.HashSet[Symbol]() + private val concreteSpecMethods = perRunCaches.newSet[Symbol]() private def isSpecialized(sym: Symbol) = sym hasAnnotation SpecializedClass private def hasSpecializedFlag(sym: Symbol) = sym hasFlag SPECIALIZED @@ -1223,10 +1223,10 @@ abstract class SpecializeTypes extends InfoTransform with TypingTransformers { def specializeCalls(unit: CompilationUnit) = new TypingTransformer(unit) { /** Map a specializable method to it's rhs, when not deferred. */ - val body: mutable.Map[Symbol, Tree] = new mutable.HashMap + val body = perRunCaches.newMap[Symbol, Tree]() /** Map a specializable method to its value parameter symbols. */ - val parameters = mutable.HashMap[Symbol, List[Symbol]]() + val parameters = perRunCaches.newMap[Symbol, List[Symbol]]() /** Collect method bodies that are concrete specialized methods. */ diff --git a/src/compiler/scala/tools/nsc/transform/UnCurry.scala b/src/compiler/scala/tools/nsc/transform/UnCurry.scala index 256c829db0..8b735455ba 100644 --- a/src/compiler/scala/tools/nsc/transform/UnCurry.scala +++ b/src/compiler/scala/tools/nsc/transform/UnCurry.scala @@ -129,7 +129,7 @@ abstract class UnCurry extends InfoTransform appliedType(NonLocalReturnControlClass.typeConstructor, List(argtype)) /** A hashmap from method symbols to non-local return keys */ - private val nonLocalReturnKeys = new mutable.HashMap[Symbol, Symbol] + private val nonLocalReturnKeys = perRunCaches.newMap[Symbol, Symbol]() /** Return non-local return key for given method */ private def nonLocalReturnKey(meth: Symbol) = |