summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2011-12-27 10:36:27 -0800
committerPaul Phillips <paulp@improving.org>2012-01-02 14:37:36 -0800
commit5618b77ca8d89b8f44db062334ac2b0663596dee (patch)
treea05a60d34754a8516548322dffc71348ed8b53a1
parent451e1dc2da16c1bb5a7a59488865df9294eeaf3e (diff)
downloadscala-5618b77ca8d89b8f44db062334ac2b0663596dee.tar.gz
scala-5618b77ca8d89b8f44db062334ac2b0663596dee.tar.bz2
scala-5618b77ca8d89b8f44db062334ac2b0663596dee.zip
Added option -Xlog-reflective-calls.
A message is emitted when a reflective call is generated. We can now be eager consumers of this since we purged all the reflective calls at some point -- but without a backstop, they have been slipping back in.
-rw-r--r--src/compiler/scala/tools/nsc/settings/ScalaSettings.scala1
-rw-r--r--src/compiler/scala/tools/nsc/transform/CleanUp.scala6
-rw-r--r--src/library/scala/collection/parallel/mutable/ParHashMap.scala5
3 files changed, 8 insertions, 4 deletions
diff --git a/src/compiler/scala/tools/nsc/settings/ScalaSettings.scala b/src/compiler/scala/tools/nsc/settings/ScalaSettings.scala
index a712f4cba2..efd5323ce2 100644
--- a/src/compiler/scala/tools/nsc/settings/ScalaSettings.scala
+++ b/src/compiler/scala/tools/nsc/settings/ScalaSettings.scala
@@ -68,6 +68,7 @@ trait ScalaSettings extends AbsScalaSettings
val genPhaseGraph = StringSetting ("-Xgenerate-phase-graph", "file", "Generate the phase graphs (outputs .dot files) to fileX.dot.", "")
val XlogImplicits = BooleanSetting ("-Xlog-implicits", "Show more detail on why some implicits are not applicable.")
val logImplicitConv = BooleanSetting ("-Xlog-implicit-conversions", "Print a message whenever an implicit conversion is inserted.")
+ val logReflectiveCalls = BooleanSetting("-Xlog-reflective-calls", "Print a message when a reflective method call is generated")
val maxClassfileName = IntSetting ("-Xmax-classfile-name", "Maximum filename length for generated classes", 255, Some((72, 255)), _ => None)
val Xmigration28 = BooleanSetting ("-Xmigration", "Warn about constructs whose behavior may have changed between 2.7 and 2.8.")
val nouescape = BooleanSetting ("-Xno-uescape", "Disable handling of \\u unicode escapes.")
diff --git a/src/compiler/scala/tools/nsc/transform/CleanUp.scala b/src/compiler/scala/tools/nsc/transform/CleanUp.scala
index 98345dd01e..575fe8f295 100644
--- a/src/compiler/scala/tools/nsc/transform/CleanUp.scala
+++ b/src/compiler/scala/tools/nsc/transform/CleanUp.scala
@@ -106,6 +106,9 @@ abstract class CleanUp extends Transform with ast.TreeDSL {
* refinement, where the refinement defines a parameter based on a
* type variable. */
case ad@ApplyDynamic(qual0, params) =>
+ if (settings.logReflectiveCalls.value)
+ unit.echo(ad.pos, "method invocation uses reflection")
+
val typedPos = typedWithPos(ad.pos) _
assert(ad.symbol.isPublic)
@@ -502,7 +505,8 @@ abstract class CleanUp extends Transform with ast.TreeDSL {
* expected to be an AnyRef. */
val t: Tree = ad.symbol.tpe match {
case MethodType(mparams, resType) =>
- assert(params.length == mparams.length)
+ assert(params.length == mparams.length, mparams)
+
typedPos {
val sym = currentOwner.newValue(ad.pos, mkTerm("qual")) setInfo qual0.tpe
qual = safeREF(sym)
diff --git a/src/library/scala/collection/parallel/mutable/ParHashMap.scala b/src/library/scala/collection/parallel/mutable/ParHashMap.scala
index 37065e32fc..31750b0b0d 100644
--- a/src/library/scala/collection/parallel/mutable/ParHashMap.scala
+++ b/src/library/scala/collection/parallel/mutable/ParHashMap.scala
@@ -190,7 +190,7 @@ extends collection.parallel.BucketCombiner[(K, V), ParHashMap[K, V], DefaultEntr
} else {
// construct a normal table and fill it sequentially
// TODO parallelize by keeping separate sizemaps and merging them
- val table = new HashTable[K, DefaultEntry[K, V]] {
+ object table extends HashTable[K, DefaultEntry[K, V]] {
def insertEntry(e: DefaultEntry[K, V]) = if (super.findEntry(e.key) eq null) super.addEntry(e)
sizeMapInit(table.length)
}
@@ -201,8 +201,7 @@ extends collection.parallel.BucketCombiner[(K, V), ParHashMap[K, V], DefaultEntr
}
i += 1
}
- val c = table.hashTableContents
- new ParHashMap(c)
+ new ParHashMap(table.hashTableContents)
}
/* classes */