summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/backend/jvm/opt/Inliner.scala
diff options
context:
space:
mode:
authorLukas Rytz <lukas.rytz@gmail.com>2015-03-30 16:19:25 +0200
committerLukas Rytz <lukas.rytz@gmail.com>2015-04-01 08:35:32 +0200
commit638ed9108f10bcbebb69f2fefe05c7423c8bdfd7 (patch)
tree5d5f091be9e720df20ba18df87090ca4a95de19c /src/compiler/scala/tools/nsc/backend/jvm/opt/Inliner.scala
parenteb43d62b4e0665b6b509a04d4ec2edae53c9256b (diff)
downloadscala-638ed9108f10bcbebb69f2fefe05c7423c8bdfd7.tar.gz
scala-638ed9108f10bcbebb69f2fefe05c7423c8bdfd7.tar.bz2
scala-638ed9108f10bcbebb69f2fefe05c7423c8bdfd7.zip
Clean up the way compiler settings are accessed in the backend.
Many backend components don't have access to the compiler instance holding the settings. Before this change, individual settings required in these parts of the backend were made available as members of trait BTypes, implemented in the subclass BTypesFromSymbols (which has access to global). This change exposes a single value of type ScalaSettings in the super trait BTypes, which gives access to all compiler settings.
Diffstat (limited to 'src/compiler/scala/tools/nsc/backend/jvm/opt/Inliner.scala')
-rw-r--r--src/compiler/scala/tools/nsc/backend/jvm/opt/Inliner.scala12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/compiler/scala/tools/nsc/backend/jvm/opt/Inliner.scala b/src/compiler/scala/tools/nsc/backend/jvm/opt/Inliner.scala
index 538b02cdbb..c827a097ea 100644
--- a/src/compiler/scala/tools/nsc/backend/jvm/opt/Inliner.scala
+++ b/src/compiler/scala/tools/nsc/backend/jvm/opt/Inliner.scala
@@ -16,7 +16,7 @@ import scala.collection.convert.decorateAsJava._
import AsmUtils._
import BytecodeUtils._
import collection.mutable
-import scala.tools.asm.tree.analysis.{SourceInterpreter, Analyzer}
+import scala.tools.asm.tree.analysis.SourceInterpreter
import BackendReporting._
import scala.tools.nsc.backend.jvm.BTypes.InternalName
@@ -52,7 +52,7 @@ class Inliner[BT <: BTypes](val btypes: BT) {
receiverKnownNotNull = false, keepLineNumbers = false)
for (warning <- r) {
- if ((callee.annotatedInline && btypes.warnSettings.atInlineFailed) || warning.emitWarning(warnSettings)) {
+ if ((callee.annotatedInline && btypes.compilerSettings.YoptWarningEmitAtInlineFailed) || warning.emitWarning(compilerSettings)) {
val annotWarn = if (callee.annotatedInline) " is annotated @inline but" else ""
val msg = s"${BackendReporting.methodSignature(callee.calleeDeclarationClass.internalName, callee.callee)}$annotWarn could not be inlined:\n$warning"
backendReporting.inlinerWarning(request.callsitePosition, msg)
@@ -93,7 +93,7 @@ class Inliner[BT <: BTypes](val btypes: BT) {
val res = doInlineCallsite(callsite)
if (!res) {
- if (annotatedInline && btypes.warnSettings.atInlineFailed) {
+ if (annotatedInline && btypes.compilerSettings.YoptWarningEmitAtInlineFailed) {
// if the callsite is annotated @inline, we report an inline warning even if the underlying
// reason is, for example, mixed compilation (which has a separate -Yopt-warning flag).
def initMsg = s"${BackendReporting.methodSignature(calleeDeclClass.internalName, callee)} is annotated @inline but cannot be inlined"
@@ -104,7 +104,7 @@ class Inliner[BT <: BTypes](val btypes: BT) {
backendReporting.inlinerWarning(pos, s"$initMsg: the method is not final and may be overridden." + warnMsg)
else
backendReporting.inlinerWarning(pos, s"$initMsg." + warnMsg)
- } else if (warning.isDefined && warning.get.emitWarning(warnSettings)) {
+ } else if (warning.isDefined && warning.get.emitWarning(compilerSettings)) {
// when annotatedInline is false, and there is some warning, the callsite metadata is possibly incomplete.
backendReporting.inlinerWarning(pos, s"there was a problem determining if method ${callee.name} can be inlined: \n"+ warning.get)
}
@@ -113,7 +113,7 @@ class Inliner[BT <: BTypes](val btypes: BT) {
res
case Callsite(ins, _, _, Left(warning), _, _, pos) =>
- if (warning.emitWarning(warnSettings))
+ if (warning.emitWarning(compilerSettings))
backendReporting.inlinerWarning(pos, s"failed to determine if ${ins.name} should be inlined:\n$warning")
false
}).toList
@@ -124,7 +124,7 @@ class Inliner[BT <: BTypes](val btypes: BT) {
*/
def doInlineCallsite(callsite: Callsite): Boolean = callsite match {
case Callsite(_, _, _, Right(Callee(callee, calleeDeclClass, safeToInline, _, annotatedInline, _, warning)), _, _, pos) =>
- if (inliningHeuristics == "everything") safeToInline
+ if (compilerSettings.YoptInlineHeuristics.value == "everything") safeToInline
else annotatedInline && safeToInline
case _ => false