diff options
author | Jason Zaugg <jzaugg@gmail.com> | 2017-02-05 15:12:09 -0700 |
---|---|---|
committer | Jason Zaugg <jzaugg@gmail.com> | 2017-02-19 15:22:47 +1000 |
commit | 7f2d1fab225565794b41c1ea4606430acf8dd270 (patch) | |
tree | 7ff11d56abd7c3c0ead542bbd485353931e8b9a0 /src | |
parent | 37a0eb758e72af1249fa90859dc8a0e32ea42077 (diff) | |
download | scala-7f2d1fab225565794b41c1ea4606430acf8dd270.tar.gz scala-7f2d1fab225565794b41c1ea4606430acf8dd270.tar.bz2 scala-7f2d1fab225565794b41c1ea4606430acf8dd270.zip |
Avoid forcing info transforms of primitive methods
Although this is cheap, when debugging log output of info
transformer activity this was a major source of noise.
This commit avoids the info lookup for methods other
than `+`, and then for `+` uses the typer phase info
to distinguish concatentation from addition.
Diffstat (limited to 'src')
-rw-r--r-- | src/compiler/scala/tools/nsc/Global.scala | 5 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/backend/ScalaPrimitives.scala | 7 |
2 files changed, 7 insertions, 5 deletions
diff --git a/src/compiler/scala/tools/nsc/Global.scala b/src/compiler/scala/tools/nsc/Global.scala index c1b0733895..819887f959 100644 --- a/src/compiler/scala/tools/nsc/Global.scala +++ b/src/compiler/scala/tools/nsc/Global.scala @@ -953,10 +953,11 @@ class Global(var currentSettings: Settings, var reporter: Reporter) definitions.isDefinitionsInitialized && rootMirror.isMirrorInitialized ) - override def isPastTyper = ( + override def isPastTyper = isPast(currentRun.typerPhase) + def isPast(phase: Phase) = ( (curRun ne null) && isGlobalInitialized // defense against init order issues - && (globalPhase.id > currentRun.typerPhase.id) + && (globalPhase.id > phase.id) ) // TODO - trim these to the absolute minimum. diff --git a/src/compiler/scala/tools/nsc/backend/ScalaPrimitives.scala b/src/compiler/scala/tools/nsc/backend/ScalaPrimitives.scala index dfd5b07a3b..c18f220d95 100644 --- a/src/compiler/scala/tools/nsc/backend/ScalaPrimitives.scala +++ b/src/compiler/scala/tools/nsc/backend/ScalaPrimitives.scala @@ -446,9 +446,10 @@ abstract class ScalaPrimitives { inform(s"Unknown primitive method $cls.$method") else alts foreach (s => addPrimitive(s, - s.info.paramTypes match { - case tp :: _ if code == ADD && tp =:= StringTpe => CONCAT - case _ => code + if (code != ADD) code + else exitingTyper(s.info).paramTypes match { + case tp :: _ if tp =:= StringTpe => CONCAT + case _ => code } ) ) |