summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAdriaan Moors <adriaan.moors@typesafe.com>2013-11-14 10:45:08 -0800
committerAdriaan Moors <adriaan.moors@typesafe.com>2013-11-14 10:45:08 -0800
commit05e6322f79009e775ab96e000582321fff43de1c (patch)
tree212bf651097caca5239c7b2a89596627f5a3cfd9 /src
parent62ebd713ad5f3589911966ddeceae1aa0d5383f1 (diff)
parentb701c1703295b01f4ab2db912441c8a891cfa33c (diff)
downloadscala-05e6322f79009e775ab96e000582321fff43de1c.tar.gz
scala-05e6322f79009e775ab96e000582321fff43de1c.tar.bz2
scala-05e6322f79009e775ab96e000582321fff43de1c.zip
Merge pull request #3133 from adriaanm/merge-2.10
Merge 2.10
Diffstat (limited to 'src')
-rw-r--r--src/compiler/scala/tools/ant/templates/tool-windows.tmpl17
-rw-r--r--src/compiler/scala/tools/nsc/backend/jvm/GenASM.scala4
-rw-r--r--src/compiler/scala/tools/nsc/backend/opt/DeadCodeElimination.scala8
-rw-r--r--src/interactive/scala/tools/nsc/interactive/Global.scala10
4 files changed, 28 insertions, 11 deletions
diff --git a/src/compiler/scala/tools/ant/templates/tool-windows.tmpl b/src/compiler/scala/tools/ant/templates/tool-windows.tmpl
index 1288eb0b7c..8441f3af23 100644
--- a/src/compiler/scala/tools/ant/templates/tool-windows.tmpl
+++ b/src/compiler/scala/tools/ant/templates/tool-windows.tmpl
@@ -12,15 +12,18 @@ setlocal enableextensions enabledelayedexpansion
set _LINE_TOOLCP=
-:another_param
-
rem Use "%~1" to handle spaces in paths. See http://ss64.com/nt/syntax-args.html
-if "%~1"=="-toolcp" (
- set _LINE_TOOLCP=%~2
- shift
- shift
- goto another_param
+rem SI-7295 The goto here is needed to avoid problems with `scala Script.cmd "arg(with)paren"`,
+rem we must not evaluate %~2 eagerly, but delayed expansion doesn't seem to allow
+rem removal of quotation marks.
+if not [%~1]==[-toolcp] (
+ goto :notoolcp
)
+shift
+set _LINE_TOOLCP=%~1
+shift
+
+:notoolcp
rem We keep in _JAVA_PARAMS all -J-prefixed and -D-prefixed arguments
set _JAVA_PARAMS=
diff --git a/src/compiler/scala/tools/nsc/backend/jvm/GenASM.scala b/src/compiler/scala/tools/nsc/backend/jvm/GenASM.scala
index 8bbc382251..5e885fdd04 100644
--- a/src/compiler/scala/tools/nsc/backend/jvm/GenASM.scala
+++ b/src/compiler/scala/tools/nsc/backend/jvm/GenASM.scala
@@ -104,6 +104,7 @@ abstract class GenASM extends SubComponent with BytecodeWriters with GenJVMASM {
if (settings.Xdce)
for ((sym, cls) <- icodes.classes if inliner.isClosureClass(sym) && !deadCode.liveClosures(sym)) {
log(s"Optimizer eliminated ${sym.fullNameString}")
+ deadCode.elidedClosures += sym
icodes.classes -= sym
}
@@ -639,7 +640,8 @@ abstract class GenASM extends SubComponent with BytecodeWriters with GenJVMASM {
innerClassBuffer += m
}
- val allInners: List[Symbol] = innerClassBuffer.toList
+ val allInners: List[Symbol] = innerClassBuffer.toList filterNot deadCode.elidedClosures
+
if (allInners.nonEmpty) {
debuglog(csym.fullName('.') + " contains " + allInners.size + " inner classes.")
diff --git a/src/compiler/scala/tools/nsc/backend/opt/DeadCodeElimination.scala b/src/compiler/scala/tools/nsc/backend/opt/DeadCodeElimination.scala
index 193aae37b6..0cfcea87f8 100644
--- a/src/compiler/scala/tools/nsc/backend/opt/DeadCodeElimination.scala
+++ b/src/compiler/scala/tools/nsc/backend/opt/DeadCodeElimination.scala
@@ -41,7 +41,13 @@ abstract class DeadCodeElimination extends SubComponent {
}
/** closures that are instantiated at least once, after dead code elimination */
- val liveClosures: mutable.Set[Symbol] = new mutable.HashSet()
+ val liveClosures = perRunCaches.newSet[Symbol]()
+
+ /** closures that are eliminated, populated by GenASM.AsmPhase.run()
+ * these class symbols won't have a .class physical file, thus shouldn't be included in InnerClasses JVM attribute,
+ * otherwise some tools get confused or slow (SI-6546)
+ * */
+ val elidedClosures = perRunCaches.newSet[Symbol]()
/** Remove dead code.
*/
diff --git a/src/interactive/scala/tools/nsc/interactive/Global.scala b/src/interactive/scala/tools/nsc/interactive/Global.scala
index 94f9aef38b..da838e0f83 100644
--- a/src/interactive/scala/tools/nsc/interactive/Global.scala
+++ b/src/interactive/scala/tools/nsc/interactive/Global.scala
@@ -1056,8 +1056,15 @@ class Global(settings: Settings, _reporter: Reporter, projectName: String = "")
case t => t
}
val context = doLocateContext(pos)
+
+ val shouldTypeQualifier = tree0.tpe match {
+ case null => true
+ case mt: MethodType => mt.isImplicit
+ case _ => false
+ }
+
// TODO: guard with try/catch to deal with ill-typed qualifiers.
- val tree = if (tree0.tpe eq null) analyzer newTyper context typedQualifier tree0 else tree0
+ val tree = if (shouldTypeQualifier) analyzer newTyper context typedQualifier tree0 else tree0
debugLog("typeMembers at "+tree+" "+tree.tpe)
val superAccess = tree.isInstanceOf[Super]
@@ -1231,4 +1238,3 @@ class Global(settings: Settings, _reporter: Reporter, projectName: String = "")
}
object CancelException extends Exception
-