summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2014-09-30 23:12:48 +1000
committerJason Zaugg <jzaugg@gmail.com>2014-09-30 23:12:48 +1000
commitc048e192f063516580eb170aa0322354f6a518ea (patch)
treec5a7a60166589e92a8a388ae929ef23d511bae31 /src
parenta52db7f1639c6d48eaa64ae609385a60467fd566 (diff)
downloadscala-c048e192f063516580eb170aa0322354f6a518ea.tar.gz
scala-c048e192f063516580eb170aa0322354f6a518ea.tar.bz2
scala-c048e192f063516580eb170aa0322354f6a518ea.zip
Don't remove elements from a map during iteration.
Doing so relies on implementation details which might change. See #3911 / SI-8774.
Diffstat (limited to 'src')
-rw-r--r--src/compiler/scala/tools/nsc/backend/jvm/GenASM.scala6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/compiler/scala/tools/nsc/backend/jvm/GenASM.scala b/src/compiler/scala/tools/nsc/backend/jvm/GenASM.scala
index 2593903b9d..7c4c02c2d3 100644
--- a/src/compiler/scala/tools/nsc/backend/jvm/GenASM.scala
+++ b/src/compiler/scala/tools/nsc/backend/jvm/GenASM.scala
@@ -104,12 +104,14 @@ abstract class GenASM extends SubComponent with BytecodeWriters with GenJVMASM {
if (settings.debug)
inform("[running phase " + name + " on icode]")
- if (settings.Xdce)
- for ((sym, cls) <- icodes.classes if inliner.isClosureClass(sym) && !deadCode.liveClosures(sym)) {
+ if (settings.Xdce) {
+ val classes = icodes.classes.keys.toList // copy to avoid mutating the map while iterating
+ for (sym <- classes if inliner.isClosureClass(sym) && !deadCode.liveClosures(sym)) {
log(s"Optimizer eliminated ${sym.fullNameString}")
deadCode.elidedClosures += sym
icodes.classes -= sym
}
+ }
// For predictably ordered error messages.
var sortedClasses = classes.values.toList sortBy (_.symbol.fullName)