summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2011-06-13 18:04:20 +0000
committerPaul Phillips <paulp@improving.org>2011-06-13 18:04:20 +0000
commit21584ed38ea6cbb8932206608ce47d975a127d8d (patch)
tree8a63b78349e3668ea21c8b6afb66a1260b40c5f6 /src/compiler/scala/tools
parentf44c01eab212e3ab518880500953f485b49a2eee (diff)
downloadscala-21584ed38ea6cbb8932206608ce47d975a127d8d.tar.gz
scala-21584ed38ea6cbb8932206608ce47d975a127d8d.tar.bz2
scala-21584ed38ea6cbb8932206608ce47d975a127d8d.zip
Marked some more by-name-argument-using methods...
Marked some more by-name-argument-using methods with final @inline to make possible and then encourage their inlining. Knocked almost 300 more classfiles and 200K off the compiler jar. No review.
Diffstat (limited to 'src/compiler/scala/tools')
-rw-r--r--src/compiler/scala/tools/nsc/Global.scala5
-rw-r--r--src/compiler/scala/tools/nsc/transform/Mixin.scala16
-rw-r--r--src/compiler/scala/tools/nsc/transform/UnCurry.scala3
3 files changed, 13 insertions, 11 deletions
diff --git a/src/compiler/scala/tools/nsc/Global.scala b/src/compiler/scala/tools/nsc/Global.scala
index 177bd8dbbd..d322ce8382 100644
--- a/src/compiler/scala/tools/nsc/Global.scala
+++ b/src/compiler/scala/tools/nsc/Global.scala
@@ -172,7 +172,10 @@ class Global(var currentSettings: Settings, var reporter: Reporter) extends Symb
def informTime(msg: String, start: Long) = informProgress(elapsedMessage(msg, start))
def logError(msg: String, t: Throwable): Unit = ()
- def log(msg: => AnyRef): Unit = if (opt.logPhase) inform("[log " + phase + "] " + msg)
+ // Over 200 closure objects are eliminated by inlining this.
+ @inline final def log(msg: => AnyRef): Unit =
+ if (settings.log containsPhase globalPhase)
+ inform("[log " + phase + "] " + msg)
def logThrowable(t: Throwable): Unit = globalError(throwableAsString(t))
def throwableAsString(t: Throwable): String =
diff --git a/src/compiler/scala/tools/nsc/transform/Mixin.scala b/src/compiler/scala/tools/nsc/transform/Mixin.scala
index ac4f19f69d..da92e80709 100644
--- a/src/compiler/scala/tools/nsc/transform/Mixin.scala
+++ b/src/compiler/scala/tools/nsc/transform/Mixin.scala
@@ -580,6 +580,14 @@ abstract class Mixin extends InfoTransform with ast.TreeDSL {
REF(sym.owner.sourceModule) DOT sym
}
+ @inline private def bitmapOperation[T](field: Symbol, transientCase: => T, privateCase: => T, rest: => T): T =
+ if (field.accessed.hasAnnotation(TransientAttr))
+ transientCase
+ else if (field.hasFlag(PRIVATE | notPRIVATE))
+ privateCase
+ else
+ rest
+
/** Add all new definitions to a non-trait class
* These fall into the following categories:
* - for a trait interface:
@@ -672,14 +680,6 @@ abstract class Mixin extends InfoTransform with ast.TreeDSL {
import lazyVals._
- def bitmapOperation[T](field: Symbol, transientCase: => T, privateCase: => T, rest: => T): T =
- if (field.accessed.hasAnnotation(TransientAttr))
- transientCase
- else if (field.hasFlag(PRIVATE) || field.hasFlag(notPRIVATE))
- privateCase
- else
- rest
-
/**
* Private or transient lazy vals use bitmaps that are private for the class context,
* unlike public or protected vals, which can use inherited bitmaps.
diff --git a/src/compiler/scala/tools/nsc/transform/UnCurry.scala b/src/compiler/scala/tools/nsc/transform/UnCurry.scala
index 04752c5fd7..b62b2aa2a8 100644
--- a/src/compiler/scala/tools/nsc/transform/UnCurry.scala
+++ b/src/compiler/scala/tools/nsc/transform/UnCurry.scala
@@ -468,8 +468,7 @@ abstract class UnCurry extends InfoTransform with TypingTransformers with ast.Tr
// ------ The tree transformers --------------------------------------------------------
def mainTransform(tree: Tree): Tree = {
-
- def withNeedLift(needLift: Boolean)(f: => Tree): Tree = {
+ @inline def withNeedLift(needLift: Boolean)(f: => Tree): Tree = {
val saved = needTryLift
needTryLift = needLift
try f