summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMiguel Garcia <miguelalfredo.garcia@epfl.ch>2012-03-02 10:55:10 +0100
committerMiguel Garcia <miguelalfredo.garcia@epfl.ch>2012-03-02 10:55:10 +0100
commitd92bcb5302be04104abe2db6cf92620c4cd7255e (patch)
treedd52fdd0c820617bc5d9efed21564a133b431e4a /src
parent105dc63121c84a45711b02f77f8e4a04074f7425 (diff)
downloadscala-d92bcb5302be04104abe2db6cf92620c4cd7255e.tar.gz
scala-d92bcb5302be04104abe2db6cf92620c4cd7255e.tar.bz2
scala-d92bcb5302be04104abe2db6cf92620c4cd7255e.zip
calling a side-effecting boolean-returning method last in condition
Diffstat (limited to 'src')
-rw-r--r--src/compiler/scala/tools/nsc/backend/opt/Inliners.scala7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/compiler/scala/tools/nsc/backend/opt/Inliners.scala b/src/compiler/scala/tools/nsc/backend/opt/Inliners.scala
index 2398f8406c..cc0c244695 100644
--- a/src/compiler/scala/tools/nsc/backend/opt/Inliners.scala
+++ b/src/compiler/scala/tools/nsc/backend/opt/Inliners.scala
@@ -707,7 +707,8 @@ abstract class Inliners extends SubComponent {
}
def isStampedForInlining(stackLength: Int) =
- !sameSymbols && inc.m.hasCode && shouldInline && isSafeToInline(stackLength) && !inc.m.symbol.hasFlag(Flags.SYNCHRONIZED)
+ !sameSymbols && inc.m.hasCode && shouldInline &&
+ isSafeToInline(stackLength) // `isSafeToInline()` must be invoked last in this AND expr bc it mutates the `knownSafe` and `knownUnsafe` maps for good.
def logFailure(stackLength: Int) = log(
"""|inline failed for %s:
@@ -764,8 +765,8 @@ abstract class Inliners extends SubComponent {
true
}
- if (!inc.m.hasCode || inc.isRecursive)
- return false
+ if (!inc.m.hasCode || inc.isRecursive) { return false }
+ if (inc.m.symbol.hasFlag(Flags.SYNCHRONIZED)) { return false }
val accessNeeded = usesNonPublics.getOrElseUpdate(inc.m, {
// Avoiding crashing the compiler if there are open blocks.