summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2012-09-18 00:59:00 -0700
committerPaul Phillips <paulp@improving.org>2012-09-18 02:19:12 -0700
commit0e061f420f3b6e7447658f003d00f6108fa649e0 (patch)
tree0b8593545df932f08b051441112ce2ae2f6804e3
parent66603a2c003852d39faec20a9763fb0e25049cf4 (diff)
downloadscala-0e061f420f3b6e7447658f003d00f6108fa649e0.tar.gz
scala-0e061f420f3b6e7447658f003d00f6108fa649e0.tar.bz2
scala-0e061f420f3b6e7447658f003d00f6108fa649e0.zip
Removed many @inline annotations and final modifiers.
It is my belief that these @inlines and finals landed between unhelpful and harmful. I am sure this will be disputed in some cases. It's too much and too difficult to measure except in the aggregate unless we have specific @inline sites to discuss. I don't know upon whom the burden of proof lies. I think we should err on the side given here, since there is no evidence of any consistent rationale being applied and it is easy to verify the negative impact scala compiler inlining can have on hotspot's far more sophisticated inlining.
-rw-r--r--src/compiler/scala/tools/nsc/ast/parser/Scanners.scala4
-rw-r--r--src/compiler/scala/tools/nsc/backend/icode/analysis/TypeFlowAnalysis.scala2
-rw-r--r--src/compiler/scala/tools/nsc/backend/jvm/GenASM.scala63
-rw-r--r--src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala6
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala1
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Contexts.scala2
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Infer.scala8
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/PatternMatching.scala34
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Typers.scala13
-rw-r--r--src/compiler/scala/tools/nsc/util/ClassPath.scala6
-rw-r--r--src/library/scala/Option.scala4
-rw-r--r--src/library/scala/PartialFunction.scala18
-rw-r--r--src/library/scala/collection/SeqLike.scala4
-rw-r--r--src/library/scala/collection/concurrent/TrieMap.scala87
-rw-r--r--src/library/scala/collection/immutable/Range.scala6
-rw-r--r--src/library/scala/collection/immutable/Vector.scala25
-rw-r--r--src/library/scala/collection/mutable/PriorityQueue.scala12
-rw-r--r--src/library/scala/runtime/ScalaRunTime.scala22
-rw-r--r--src/reflect/scala/reflect/internal/Chars.scala2
-rw-r--r--src/reflect/scala/reflect/internal/Symbols.scala8
-rw-r--r--src/reflect/scala/reflect/internal/Trees.scala4
-rw-r--r--src/reflect/scala/reflect/internal/Types.scala8
-rw-r--r--src/reflect/scala/reflect/internal/util/ThreeValues.scala4
23 files changed, 160 insertions, 183 deletions
diff --git a/src/compiler/scala/tools/nsc/ast/parser/Scanners.scala b/src/compiler/scala/tools/nsc/ast/parser/Scanners.scala
index ba8da3b0ec..a1785e5262 100644
--- a/src/compiler/scala/tools/nsc/ast/parser/Scanners.scala
+++ b/src/compiler/scala/tools/nsc/ast/parser/Scanners.scala
@@ -182,13 +182,13 @@ trait Scanners extends ScannersCommon {
/** Are we directly in a string interpolation expression?
*/
- @inline private def inStringInterpolation =
+ private def inStringInterpolation =
sepRegions.nonEmpty && sepRegions.head == STRINGLIT
/** Are we directly in a multiline string interpolation expression?
* @pre inStringInterpolation
*/
- @inline private def inMultiLineInterpolation =
+ private def inMultiLineInterpolation =
inStringInterpolation && sepRegions.tail.nonEmpty && sepRegions.tail.head == STRINGPART
/** read next token and return last offset
diff --git a/src/compiler/scala/tools/nsc/backend/icode/analysis/TypeFlowAnalysis.scala b/src/compiler/scala/tools/nsc/backend/icode/analysis/TypeFlowAnalysis.scala
index 31c2077097..5d81109ac9 100644
--- a/src/compiler/scala/tools/nsc/backend/icode/analysis/TypeFlowAnalysis.scala
+++ b/src/compiler/scala/tools/nsc/backend/icode/analysis/TypeFlowAnalysis.scala
@@ -480,7 +480,7 @@ abstract class TypeFlowAnalysis {
val knownUnsafe = mutable.Set.empty[Symbol]
val knownSafe = mutable.Set.empty[Symbol]
val knownNever = mutable.Set.empty[Symbol] // `knownNever` needs be cleared only at the very end of the inlining phase (unlike `knownUnsafe` and `knownSafe`)
- @inline final def blackballed(msym: Symbol): Boolean = { knownUnsafe(msym) || knownNever(msym) }
+ final def blackballed(msym: Symbol): Boolean = { knownUnsafe(msym) || knownNever(msym) }
val relevantBBs = mutable.Set.empty[BasicBlock]
diff --git a/src/compiler/scala/tools/nsc/backend/jvm/GenASM.scala b/src/compiler/scala/tools/nsc/backend/jvm/GenASM.scala
index 1653ca9c2a..a3e2a6d753 100644
--- a/src/compiler/scala/tools/nsc/backend/jvm/GenASM.scala
+++ b/src/compiler/scala/tools/nsc/backend/jvm/GenASM.scala
@@ -229,11 +229,9 @@ abstract class GenASM extends SubComponent with BytecodeWriters {
binarynme.RuntimeNull.toString() -> RuntimeNullClass
)
- private def mkFlags(args: Int*) = args.foldLeft(0)(_ | _)
-
- @inline final private def hasPublicBitSet(flags: Int) = ((flags & asm.Opcodes.ACC_PUBLIC) != 0)
-
- @inline final private def isRemote(s: Symbol) = (s hasAnnotation RemoteAttr)
+ private def mkFlags(args: Int*) = args.foldLeft(0)(_ | _)
+ private def hasPublicBitSet(flags: Int) = (flags & asm.Opcodes.ACC_PUBLIC) != 0
+ private def isRemote(s: Symbol) = s hasAnnotation RemoteAttr
/**
* Return the Java modifiers for the given symbol.
@@ -386,8 +384,7 @@ abstract class GenASM extends SubComponent with BytecodeWriters {
fcs
}
- @inline final private def jvmWiseLUB(a: Symbol, b: Symbol): Symbol = {
-
+ private def jvmWiseLUB(a: Symbol, b: Symbol): Symbol = {
assert(a.isClass)
assert(b.isClass)
@@ -1546,7 +1543,7 @@ abstract class GenASM extends SubComponent with BytecodeWriters {
var jmethod: asm.MethodVisitor = _
var jMethodName: String = _
- @inline final def emit(opc: Int) { jmethod.visitInsn(opc) }
+ final def emit(opc: Int) { jmethod.visitInsn(opc) }
def genMethod(m: IMethod, isJInterface: Boolean) {
@@ -1784,7 +1781,7 @@ abstract class GenASM extends SubComponent with BytecodeWriters {
else { jmethod.visitLdcInsn(cst) }
}
- @inline final def boolconst(b: Boolean) { iconst(if(b) 1 else 0) }
+ final def boolconst(b: Boolean) { iconst(if(b) 1 else 0) }
def iconst(cst: Int) {
if (cst >= -1 && cst <= 5) {
@@ -1850,44 +1847,44 @@ abstract class GenASM extends SubComponent with BytecodeWriters {
}
- @inline def load( idx: Int, tk: TypeKind) { emitVarInsn(Opcodes.ILOAD, idx, tk) }
- @inline def store(idx: Int, tk: TypeKind) { emitVarInsn(Opcodes.ISTORE, idx, tk) }
+ def load( idx: Int, tk: TypeKind) { emitVarInsn(Opcodes.ILOAD, idx, tk) }
+ def store(idx: Int, tk: TypeKind) { emitVarInsn(Opcodes.ISTORE, idx, tk) }
- @inline def aload( tk: TypeKind) { emitTypeBased(aloadOpcodes, tk) }
- @inline def astore(tk: TypeKind) { emitTypeBased(astoreOpcodes, tk) }
+ def aload( tk: TypeKind) { emitTypeBased(aloadOpcodes, tk) }
+ def astore(tk: TypeKind) { emitTypeBased(astoreOpcodes, tk) }
- @inline def neg(tk: TypeKind) { emitPrimitive(negOpcodes, tk) }
- @inline def add(tk: TypeKind) { emitPrimitive(addOpcodes, tk) }
- @inline def sub(tk: TypeKind) { emitPrimitive(subOpcodes, tk) }
- @inline def mul(tk: TypeKind) { emitPrimitive(mulOpcodes, tk) }
- @inline def div(tk: TypeKind) { emitPrimitive(divOpcodes, tk) }
- @inline def rem(tk: TypeKind) { emitPrimitive(remOpcodes, tk) }
+ def neg(tk: TypeKind) { emitPrimitive(negOpcodes, tk) }
+ def add(tk: TypeKind) { emitPrimitive(addOpcodes, tk) }
+ def sub(tk: TypeKind) { emitPrimitive(subOpcodes, tk) }
+ def mul(tk: TypeKind) { emitPrimitive(mulOpcodes, tk) }
+ def div(tk: TypeKind) { emitPrimitive(divOpcodes, tk) }
+ def rem(tk: TypeKind) { emitPrimitive(remOpcodes, tk) }
- @inline def invokespecial(owner: String, name: String, desc: String) {
+ def invokespecial(owner: String, name: String, desc: String) {
jmethod.visitMethodInsn(Opcodes.INVOKESPECIAL, owner, name, desc)
}
- @inline def invokestatic(owner: String, name: String, desc: String) {
+ def invokestatic(owner: String, name: String, desc: String) {
jmethod.visitMethodInsn(Opcodes.INVOKESTATIC, owner, name, desc)
}
- @inline def invokeinterface(owner: String, name: String, desc: String) {
+ def invokeinterface(owner: String, name: String, desc: String) {
jmethod.visitMethodInsn(Opcodes.INVOKEINTERFACE, owner, name, desc)
}
- @inline def invokevirtual(owner: String, name: String, desc: String) {
+ def invokevirtual(owner: String, name: String, desc: String) {
jmethod.visitMethodInsn(Opcodes.INVOKEVIRTUAL, owner, name, desc)
}
- @inline def goTo(label: asm.Label) { jmethod.visitJumpInsn(Opcodes.GOTO, label) }
- @inline def emitIF(cond: TestOp, label: asm.Label) { jmethod.visitJumpInsn(cond.opcodeIF, label) }
- @inline def emitIF_ICMP(cond: TestOp, label: asm.Label) { jmethod.visitJumpInsn(cond.opcodeIFICMP, label) }
- @inline def emitIF_ACMP(cond: TestOp, label: asm.Label) {
+ def goTo(label: asm.Label) { jmethod.visitJumpInsn(Opcodes.GOTO, label) }
+ def emitIF(cond: TestOp, label: asm.Label) { jmethod.visitJumpInsn(cond.opcodeIF, label) }
+ def emitIF_ICMP(cond: TestOp, label: asm.Label) { jmethod.visitJumpInsn(cond.opcodeIFICMP, label) }
+ def emitIF_ACMP(cond: TestOp, label: asm.Label) {
assert((cond == EQ) || (cond == NE), cond)
val opc = (if(cond == EQ) Opcodes.IF_ACMPEQ else Opcodes.IF_ACMPNE)
jmethod.visitJumpInsn(opc, label)
}
- @inline def emitIFNONNULL(label: asm.Label) { jmethod.visitJumpInsn(Opcodes.IFNONNULL, label) }
- @inline def emitIFNULL (label: asm.Label) { jmethod.visitJumpInsn(Opcodes.IFNULL, label) }
+ def emitIFNONNULL(label: asm.Label) { jmethod.visitJumpInsn(Opcodes.IFNONNULL, label) }
+ def emitIFNULL (label: asm.Label) { jmethod.visitJumpInsn(Opcodes.IFNULL, label) }
- @inline def emitRETURN(tk: TypeKind) {
+ def emitRETURN(tk: TypeKind) {
if(tk == UNIT) { jmethod.visitInsn(Opcodes.RETURN) }
else { emitTypeBased(returnOpcodes, tk) }
}
@@ -2164,8 +2161,8 @@ abstract class GenASM extends SubComponent with BytecodeWriters {
case class LocVarEntry(local: Local, start: asm.Label, end: asm.Label) // start is inclusive while end exclusive.
case class Interval(lstart: asm.Label, lend: asm.Label) {
- @inline final def start = lstart.getOffset
- @inline final def end = lend.getOffset
+ final def start = lstart.getOffset
+ final def end = lend.getOffset
def precedes(that: Interval): Boolean = { this.end < that.start }
@@ -2955,7 +2952,7 @@ abstract class GenASM extends SubComponent with BytecodeWriters {
// indexOf(local)
// }
- @inline final def indexOf(local: Local): Int = {
+ final def indexOf(local: Local): Int = {
assert(local.index >= 0, "Invalid index for: " + local + "{" + local.## + "}: ")
local.index
}
diff --git a/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala b/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala
index 903b3095de..a356b70e62 100644
--- a/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala
+++ b/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala
@@ -1273,7 +1273,7 @@ abstract class ClassfileParser {
sym.privateWithin = sym.enclosingTopLevelClass.owner
}
- @inline private def isPrivate(flags: Int) = (flags & JAVA_ACC_PRIVATE) != 0
- @inline private def isStatic(flags: Int) = (flags & JAVA_ACC_STATIC) != 0
- @inline private def hasAnnotation(flags: Int) = (flags & JAVA_ACC_ANNOTATION) != 0
+ private def isPrivate(flags: Int) = (flags & JAVA_ACC_PRIVATE) != 0
+ private def isStatic(flags: Int) = (flags & JAVA_ACC_STATIC) != 0
+ private def hasAnnotation(flags: Int) = (flags & JAVA_ACC_ANNOTATION) != 0
}
diff --git a/src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala b/src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala
index 144cc841b4..691312e49f 100644
--- a/src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala
@@ -830,7 +830,6 @@ trait ContextErrors {
}
// side-effect on the tree, break the overloaded type cycle in infer
- @inline
private def setErrorOnLastTry(lastTry: Boolean, tree: Tree) = if (lastTry) setError(tree)
def NoBestMethodAlternativeError(tree: Tree, argtpes: List[Type], pt: Type, lastTry: Boolean) = {
diff --git a/src/compiler/scala/tools/nsc/typechecker/Contexts.scala b/src/compiler/scala/tools/nsc/typechecker/Contexts.scala
index dbf769c79f..211da044e6 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Contexts.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Contexts.scala
@@ -487,7 +487,7 @@ trait Contexts { self: Analyzer =>
lastAccessCheckDetails = ""
// Console.println("isAccessible(%s, %s, %s)".format(sym, pre, superAccess))
- @inline def accessWithinLinked(ab: Symbol) = {
+ def accessWithinLinked(ab: Symbol) = {
val linked = ab.linkedClassOfClass
// don't have access if there is no linked class
// (before adding the `ne NoSymbol` check, this was a no-op when linked eq NoSymbol,
diff --git a/src/compiler/scala/tools/nsc/typechecker/Infer.scala b/src/compiler/scala/tools/nsc/typechecker/Infer.scala
index 294470d40e..22077303a4 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Infer.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Infer.scala
@@ -77,7 +77,7 @@ trait Infer {
val isUnapplySeq = unappSym.name == nme.unapplySeq
val booleanExtractor = resTp.typeSymbolDirect == BooleanClass
- @inline def seqToRepeatedChecked(tp: Type) = {
+ def seqToRepeatedChecked(tp: Type) = {
val toRepeated = seqToRepeated(tp)
if (tp eq toRepeated) throw new TypeError("(the last tuple-component of) the result type of an unapplySeq must be a Seq[_]")
else toRepeated
@@ -548,9 +548,9 @@ trait Infer {
})
}
- @inline private def toLists[A1, A2](pxs: (Iterable[A1], Iterable[A2])) = (pxs._1.toList, pxs._2.toList)
- @inline private def toLists[A1, A2, A3](pxs: (Iterable[A1], Iterable[A2], Iterable[A3])) = (pxs._1.toList, pxs._2.toList, pxs._3.toList)
- @inline private def toLists[A1, A2, A3, A4](pxs: (Iterable[A1], Iterable[A2], Iterable[A3], Iterable[A4])) = (pxs._1.toList, pxs._2.toList, pxs._3.toList, pxs._4.toList)
+ private def toLists[A1, A2](pxs: (Iterable[A1], Iterable[A2])) = (pxs._1.toList, pxs._2.toList)
+ private def toLists[A1, A2, A3](pxs: (Iterable[A1], Iterable[A2], Iterable[A3])) = (pxs._1.toList, pxs._2.toList, pxs._3.toList)
+ private def toLists[A1, A2, A3, A4](pxs: (Iterable[A1], Iterable[A2], Iterable[A3], Iterable[A4])) = (pxs._1.toList, pxs._2.toList, pxs._3.toList, pxs._4.toList)
}
/** Retract arguments that were inferred to Nothing because inference failed. Correct types for repeated params.
diff --git a/src/compiler/scala/tools/nsc/typechecker/PatternMatching.scala b/src/compiler/scala/tools/nsc/typechecker/PatternMatching.scala
index 2dc3dc3dbd..d0b715d502 100644
--- a/src/compiler/scala/tools/nsc/typechecker/PatternMatching.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/PatternMatching.scala
@@ -387,8 +387,8 @@ trait PatternMatching extends Transform with TypingTransformers with ast.TreeDSL
def translatePattern(patBinder: Symbol, patTree: Tree): List[TreeMaker] = {
// a list of TreeMakers that encode `patTree`, and a list of arguments for recursive invocations of `translatePattern` to encode its subpatterns
type TranslationStep = (List[TreeMaker], List[(Symbol, Tree)])
- @inline def withSubPats(treeMakers: List[TreeMaker], subpats: (Symbol, Tree)*): TranslationStep = (treeMakers, subpats.toList)
- @inline def noFurtherSubPats(treeMakers: TreeMaker*): TranslationStep = (treeMakers.toList, Nil)
+ def withSubPats(treeMakers: List[TreeMaker], subpats: (Symbol, Tree)*): TranslationStep = (treeMakers, subpats.toList)
+ def noFurtherSubPats(treeMakers: TreeMaker*): TranslationStep = (treeMakers.toList, Nil)
val pos = patTree.pos
@@ -860,7 +860,7 @@ trait PatternMatching extends Transform with TypingTransformers with ast.TreeDSL
// since about half of the typedSubst's end up being no-ops, the check below shaves off 5% of the time spent in typedSubst
if (!tree.exists { case i@Ident(_) => from contains i.symbol case _ => false}) tree
else (new Transformer {
- @inline private def typedIfOrigTyped(to: Tree, origTp: Type): Tree =
+ private def typedIfOrigTyped(to: Tree, origTp: Type): Tree =
if (origTp == null || origTp == NoType) to
// important: only type when actually substing and when original tree was typed
// (don't need to use origTp as the expected type, though, and can't always do this anyway due to unknown type params stemming from polymorphic extractors)
@@ -1208,7 +1208,7 @@ trait PatternMatching extends Transform with TypingTransformers with ast.TreeDSL
else typeTest(testedBinder, expectedTp)
// propagate expected type
- @inline def expTp(t: Tree): t.type = t setType expectedTp
+ def expTp(t: Tree): t.type = t setType expectedTp
// true when called to type-test the argument to an extractor
// don't do any fancy equality checking, just test the type
@@ -1694,8 +1694,8 @@ trait PatternMatching extends Transform with TypingTransformers with ast.TreeDSL
final def binderToUniqueTree(b: Symbol) =
unique(accumSubst(normalize(CODE.REF(b))), b.tpe)
- @inline def /\(conds: Iterable[Cond]) = if (conds.isEmpty) TrueCond else conds.reduceLeft(AndCond(_, _))
- @inline def \/(conds: Iterable[Cond]) = if (conds.isEmpty) FalseCond else conds.reduceLeft(OrCond(_, _))
+ def /\(conds: Iterable[Cond]) = if (conds.isEmpty) TrueCond else conds.reduceLeft(AndCond(_, _))
+ def \/(conds: Iterable[Cond]) = if (conds.isEmpty) FalseCond else conds.reduceLeft(OrCond(_, _))
// note that the sequencing of operations is important: must visit in same order as match execution
// binderToUniqueTree uses the type of the first symbol that was encountered as the type for all future binders
@@ -1903,8 +1903,8 @@ trait PatternMatching extends Transform with TypingTransformers with ast.TreeDSL
private def nextSymId = {_symId += 1; _symId}; private var _symId = 0
- @inline def /\(props: Iterable[Prop]) = if (props.isEmpty) True else props.reduceLeft(And(_, _))
- @inline def \/(props: Iterable[Prop]) = if (props.isEmpty) False else props.reduceLeft(Or(_, _))
+ def /\(props: Iterable[Prop]) = if (props.isEmpty) True else props.reduceLeft(And(_, _))
+ def \/(props: Iterable[Prop]) = if (props.isEmpty) False else props.reduceLeft(Or(_, _))
trait PropTraverser {
@@ -1980,7 +1980,7 @@ trait PatternMatching extends Transform with TypingTransformers with ast.TreeDSL
val pure = props map rewriteEqualsToProp.apply
var eqAxioms: Prop = True
- @inline def addAxiom(p: Prop) = eqAxioms = And(eqAxioms, p)
+ def addAxiom(p: Prop) = eqAxioms = And(eqAxioms, p)
patmatDebug("removeVarEq vars: "+ vars)
vars.foreach { v =>
@@ -2051,7 +2051,7 @@ trait PatternMatching extends Transform with TypingTransformers with ast.TreeDSL
// a clause is a disjunction of distinct literals
type Clause = Set[Lit]
def clause(l: Lit*): Clause = l.toSet
- @inline private def merge(a: Clause, b: Clause) = a ++ b
+ private def merge(a: Clause, b: Clause) = a ++ b
type Lit
def Lit(sym: Sym, pos: Boolean = true): Lit
@@ -2189,8 +2189,8 @@ trait PatternMatching extends Transform with TypingTransformers with ast.TreeDSL
findAllModels(f, Nil)
}
- @inline private def withLit(res: Model, l: Lit): Model = if (res eq NoModel) NoModel else res + (l.sym -> l.pos)
- @inline private def dropUnit(f: Formula, unitLit: Lit) = {
+ private def withLit(res: Model, l: Lit): Model = if (res eq NoModel) NoModel else res + (l.sym -> l.pos)
+ private def dropUnit(f: Formula, unitLit: Lit) = {
val negated = -unitLit
// drop entire clauses that are trivially true
// (i.e., disjunctions that contain the literal we're making true in the returned model),
@@ -2268,9 +2268,9 @@ trait PatternMatching extends Transform with TypingTransformers with ast.TreeDSL
private[this] val id: Int = Var.nextId
// private[this] var canModify: Option[Array[StackTraceElement]] = None
- @inline private[this] def ensureCanModify = {} //if (canModify.nonEmpty) patmatDebug("BUG!"+ this +" modified after having been observed: "+ canModify.get.mkString("\n"))
+ private[this] def ensureCanModify = {} //if (canModify.nonEmpty) patmatDebug("BUG!"+ this +" modified after having been observed: "+ canModify.get.mkString("\n"))
- @inline private[this] def observed = {} //canModify = Some(Thread.currentThread.getStackTrace)
+ private[this] def observed = {} //canModify = Some(Thread.currentThread.getStackTrace)
// don't access until all potential equalities have been registered using registerEquality
private[this] val symForEqualsTo = new scala.collection.mutable.HashMap[Const, Sym]
@@ -2735,7 +2735,7 @@ trait PatternMatching extends Transform with TypingTransformers with ast.TreeDSL
// a type is "uncheckable" (for exhaustivity) if we don't statically know its subtypes (i.e., it's unsealed)
// we consider tuple types with at least one component of a checkable type as a checkable type
def uncheckableType(tp: Type): Boolean = {
- @inline def tupleComponents(tp: Type) = tp.normalize.typeArgs
+ def tupleComponents(tp: Type) = tp.normalize.typeArgs
val checkable = (
(isTupleType(tp) && tupleComponents(tp).exists(tp => !uncheckableType(tp)))
|| enumerateSubtypes(tp).nonEmpty)
@@ -2868,7 +2868,7 @@ trait PatternMatching extends Transform with TypingTransformers with ast.TreeDSL
case object WildcardExample extends CounterExample { override def toString = "_" }
case object NoExample extends CounterExample { override def toString = "??" }
- @inline def modelToVarAssignment(model: Model): Map[Var, (Seq[Const], Seq[Const])] =
+ def modelToVarAssignment(model: Model): Map[Var, (Seq[Const], Seq[Const])] =
model.toSeq.groupBy{f => f match {case (sym, value) => sym.variable} }.mapValues{ xs =>
val (trues, falses) = xs.partition(_._2)
(trues map (_._1.const), falses map (_._1.const))
@@ -2974,7 +2974,7 @@ trait PatternMatching extends Transform with TypingTransformers with ast.TreeDSL
( uniqueEqualTo.nonEmpty
|| (fields.nonEmpty && prunedEqualTo.isEmpty && notEqualTo.isEmpty)) =>
- @inline def args(brevity: Boolean = beBrief) = {
+ def args(brevity: Boolean = beBrief) = {
// figure out the constructor arguments from the field assignment
val argLen = (caseFieldAccs.length min ctorParams.length)
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
index 089245e124..673a791524 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
@@ -91,7 +91,7 @@ trait Typers extends Modes with Adaptations with Tags {
// - we may virtualize matches (if -Xexperimental and there's a suitable __match in scope)
// - we synthesize PartialFunction implementations for `x => x match {...}` and `match {...}` when the expected type is PartialFunction
// this is disabled by: -Xoldpatmat or interactive compilation (we run it for scaladoc due to SI-5933)
- @inline private def newPatternMatching = opt.virtPatmat && !forInteractive //&& !forScaladoc && (phase.id < currentRun.uncurryPhase.id)
+ private def newPatternMatching = opt.virtPatmat && !forInteractive //&& !forScaladoc && (phase.id < currentRun.uncurryPhase.id)
abstract class Typer(context0: Context) extends TyperDiagnostics with Adaptation with Tag with TyperContextErrors {
import context0.unit
@@ -478,7 +478,6 @@ trait Typers extends Modes with Adaptations with Tags {
/** The typer for an expression, depending on where we are. If we are before a superclass
* call, this is a typer over a constructor context; otherwise it is the current typer.
*/
- @inline
final def constrTyperIf(inConstr: Boolean): Typer =
if (inConstr) {
assert(context.undetparams.isEmpty, context.undetparams)
@@ -1557,7 +1556,7 @@ trait Typers extends Modes with Adaptations with Tags {
*/
def validateParentClasses(parents: List[Tree], selfType: Type) {
val pending = ListBuffer[AbsTypeError]()
- @inline def validateDynamicParent(parent: Symbol) =
+ def validateDynamicParent(parent: Symbol) =
if (parent == DynamicClass) checkFeature(parent.pos, DynamicsFeature)
def validateParentClass(parent: Tree, superclazz: Symbol) =
@@ -3845,7 +3844,7 @@ trait Typers extends Modes with Adaptations with Tags {
case Apply(TypeApply(fun, targs), args) => (Apply(fun, args), targs)
case t => (t, Nil)
}
- @inline def hasNamedArg(as: List[Tree]) = as.collectFirst{case AssignOrNamedArg(lhs, rhs) =>}.nonEmpty
+ def hasNamedArg(as: List[Tree]) = as.collectFirst{case AssignOrNamedArg(lhs, rhs) =>}.nonEmpty
def desugaredApply = tree match {
case Select(`qual`, nme.apply) => true
@@ -3876,8 +3875,8 @@ trait Typers extends Modes with Adaptations with Tags {
}
}
- @inline final def deindentTyping() = context.typingIndentLevel -= 2
- @inline final def indentTyping() = context.typingIndentLevel += 2
+ final def deindentTyping() = context.typingIndentLevel -= 2
+ final def indentTyping() = context.typingIndentLevel += 2
@inline final def printTyping(s: => String) = {
if (printTypings)
println(context.typingIndent + s.replaceAll("\n", "\n" + context.typingIndent))
@@ -4696,12 +4695,10 @@ trait Typers extends Modes with Adaptations with Tags {
*/
def typedIdent(tree: Tree, name: Name): Tree = {
var errorContainer: AbsTypeError = null
- @inline
def ambiguousError(msg: String) = {
assert(errorContainer == null, "Cannot set ambiguous error twice for identifier")
errorContainer = AmbiguousIdentError(tree, name, msg)
}
- @inline
def identError(tree: AbsTypeError) = {
assert(errorContainer == null, "Cannot set ambiguous error twice for identifier")
errorContainer = tree
diff --git a/src/compiler/scala/tools/nsc/util/ClassPath.scala b/src/compiler/scala/tools/nsc/util/ClassPath.scala
index 1c7a723f7f..65aba2b721 100644
--- a/src/compiler/scala/tools/nsc/util/ClassPath.scala
+++ b/src/compiler/scala/tools/nsc/util/ClassPath.scala
@@ -160,9 +160,9 @@ object ClassPath {
override def isValidName(name: String) = !isTraitImplementation(name)
}
- @inline private def endsClass(s: String) = s.length > 6 && s.substring(s.length - 6) == ".class"
- @inline private def endsScala(s: String) = s.length > 6 && s.substring(s.length - 6) == ".scala"
- @inline private def endsJava(s: String) = s.length > 5 && s.substring(s.length - 5) == ".java"
+ private def endsClass(s: String) = s.length > 6 && s.substring(s.length - 6) == ".class"
+ private def endsScala(s: String) = s.length > 6 && s.substring(s.length - 6) == ".scala"
+ private def endsJava(s: String) = s.length > 5 && s.substring(s.length - 5) == ".java"
/** From the source file to its identifier.
*/
diff --git a/src/library/scala/Option.scala b/src/library/scala/Option.scala
index 945b0a0c3b..880f3f4623 100644
--- a/src/library/scala/Option.scala
+++ b/src/library/scala/Option.scala
@@ -196,7 +196,7 @@ sealed abstract class Option[+A] extends Product with Serializable {
/** Necessary to keep $option from being implicitly converted to
* [[scala.collection.Iterable]] in `for` comprehensions.
*/
- def withFilter(p: A => Boolean): WithFilter = new WithFilter(p)
+ @inline final def withFilter(p: A => Boolean): WithFilter = new WithFilter(p)
/** We need a whole WithFilter class to honor the "doesn't create a new
* collection" contract even though it seems unlikely to matter much in a
@@ -246,7 +246,7 @@ sealed abstract class Option[+A] extends Product with Serializable {
* @return the result of applying `pf` to this $option's
* value (if possible), or $none.
*/
- def collect[B](pf: PartialFunction[A, B]): Option[B] =
+ @inline final def collect[B](pf: PartialFunction[A, B]): Option[B] =
if (!isEmpty && pf.isDefinedAt(this.get)) Some(pf(this.get)) else None
/** Returns this $option if it is nonempty,
diff --git a/src/library/scala/PartialFunction.scala b/src/library/scala/PartialFunction.scala
index 7c6e2d2e3e..ce109626cc 100644
--- a/src/library/scala/PartialFunction.scala
+++ b/src/library/scala/PartialFunction.scala
@@ -156,7 +156,7 @@ trait PartialFunction[-A, +B] extends (A => B) { self =>
object PartialFunction {
/** Composite function produced by `PartialFunction#orElse` method
*/
- private final class OrElse[-A, +B] (f1: PartialFunction[A, B], f2: PartialFunction[A, B]) extends PartialFunction[A, B] {
+ private class OrElse[-A, +B] (f1: PartialFunction[A, B], f2: PartialFunction[A, B]) extends PartialFunction[A, B] {
def isDefinedAt(x: A) = f1.isDefinedAt(x) || f2.isDefinedAt(x)
def apply(x: A): B = f1.applyOrElse(x, f2)
@@ -175,7 +175,7 @@ object PartialFunction {
/** Composite function produced by `PartialFunction#andThen` method
*/
- private final class AndThen[-A, B, +C] (pf: PartialFunction[A, B], k: B => C) extends PartialFunction[A, C] {
+ private class AndThen[-A, B, +C] (pf: PartialFunction[A, B], k: B => C) extends PartialFunction[A, C] {
def isDefinedAt(x: A) = pf.isDefinedAt(x)
def apply(x: A): C = k(pf(x))
@@ -207,11 +207,11 @@ object PartialFunction {
*
* Here `fallback_pf` is used as both unique marker object and special fallback function that returns it.
*/
- private[this] final val fallback_pf: PartialFunction[Any, Any] = { case _ => fallback_pf }
- @inline private final def checkFallback[B] = fallback_pf.asInstanceOf[PartialFunction[Any, B]]
- @inline private final def fallbackOccurred[B](x: B) = (fallback_pf eq x.asInstanceOf[AnyRef])
+ private[this] val fallback_pf: PartialFunction[Any, Any] = { case _ => fallback_pf }
+ private def checkFallback[B] = fallback_pf.asInstanceOf[PartialFunction[Any, B]]
+ private def fallbackOccurred[B](x: B) = (fallback_pf eq x.asInstanceOf[AnyRef])
- private final class Lifted[-A, +B] (val pf: PartialFunction[A, B])
+ private class Lifted[-A, +B] (val pf: PartialFunction[A, B])
extends scala.runtime.AbstractFunction1[A, Option[B]] {
def apply(x: A): Option[B] = {
@@ -220,7 +220,7 @@ object PartialFunction {
}
}
- private final class Unlifted[A, B] (f: A => Option[B]) extends scala.runtime.AbstractPartialFunction[A, B] {
+ private class Unlifted[A, B] (f: A => Option[B]) extends scala.runtime.AbstractPartialFunction[A, B] {
def isDefinedAt(x: A): Boolean = f(x).isDefined
override def applyOrElse[A1 <: A, B1 >: B](x: A1, default: A1 => B1): B1 = {
@@ -241,9 +241,9 @@ object PartialFunction {
*/
def apply[A, B](f: A => B): PartialFunction[A, B] = { case x => f(x) }
- private[this] final val constFalse: Any => Boolean = { _ => false}
+ private[this] val constFalse: Any => Boolean = { _ => false}
- private[this] final val empty_pf: PartialFunction[Any, Nothing] = new PartialFunction[Any, Nothing] {
+ private[this] val empty_pf: PartialFunction[Any, Nothing] = new PartialFunction[Any, Nothing] {
def isDefinedAt(x: Any) = false
def apply(x: Any) = throw new MatchError(x)
override def orElse[A1, B1](that: PartialFunction[A1, B1]) = that
diff --git a/src/library/scala/collection/SeqLike.scala b/src/library/scala/collection/SeqLike.scala
index a3ff812024..cda8b1a0e4 100644
--- a/src/library/scala/collection/SeqLike.scala
+++ b/src/library/scala/collection/SeqLike.scala
@@ -735,8 +735,8 @@ object SeqLike {
*/
private def kmpSearch[B](S: Seq[B], m0: Int, m1: Int, W: Seq[B], n0: Int, n1: Int, forward: Boolean): Int = {
// Check for redundant case when target has single valid element
- @inline def clipR(x: Int, y: Int) = if (x<y) x else -1
- @inline def clipL(x: Int, y: Int) = if (x>y) x else -1
+ def clipR(x: Int, y: Int) = if (x < y) x else -1
+ def clipL(x: Int, y: Int) = if (x > y) x else -1
if (n1 == n0+1) {
if (forward)
diff --git a/src/library/scala/collection/concurrent/TrieMap.scala b/src/library/scala/collection/concurrent/TrieMap.scala
index 070497c19e..4f9f13c794 100644
--- a/src/library/scala/collection/concurrent/TrieMap.scala
+++ b/src/library/scala/collection/concurrent/TrieMap.scala
@@ -25,13 +25,13 @@ private[collection] final class INode[K, V](bn: MainNode[K, V], g: Gen) extends
def this(g: Gen) = this(null, g)
- @inline final def WRITE(nval: MainNode[K, V]) = INodeBase.updater.set(this, nval)
+ def WRITE(nval: MainNode[K, V]) = INodeBase.updater.set(this, nval)
- @inline final def CAS(old: MainNode[K, V], n: MainNode[K, V]) = INodeBase.updater.compareAndSet(this, old, n)
+ def CAS(old: MainNode[K, V], n: MainNode[K, V]) = INodeBase.updater.compareAndSet(this, old, n)
- final def gcasRead(ct: TrieMap[K, V]): MainNode[K, V] = GCAS_READ(ct)
+ def gcasRead(ct: TrieMap[K, V]): MainNode[K, V] = GCAS_READ(ct)
- @inline final def GCAS_READ(ct: TrieMap[K, V]): MainNode[K, V] = {
+ def GCAS_READ(ct: TrieMap[K, V]): MainNode[K, V] = {
val m = /*READ*/mainnode
val prevval = /*READ*/m.prev
if (prevval eq null) m
@@ -70,7 +70,7 @@ private[collection] final class INode[K, V](bn: MainNode[K, V], g: Gen) extends
}
}
- @inline final def GCAS(old: MainNode[K, V], n: MainNode[K, V], ct: TrieMap[K, V]): Boolean = {
+ def GCAS(old: MainNode[K, V], n: MainNode[K, V], ct: TrieMap[K, V]): Boolean = {
n.WRITE_PREV(old)
if (CAS(old, n)) {
GCAS_Complete(n, ct)
@@ -78,16 +78,15 @@ private[collection] final class INode[K, V](bn: MainNode[K, V], g: Gen) extends
} else false
}
- @inline
private def equal(k1: K, k2: K, ct: TrieMap[K, V]) = ct.equality.equiv(k1, k2)
- @inline private def inode(cn: MainNode[K, V]) = {
+ private def inode(cn: MainNode[K, V]) = {
val nin = new INode[K, V](gen)
nin.WRITE(cn)
nin
}
- final def copyToGen(ngen: Gen, ct: TrieMap[K, V]) = {
+ def copyToGen(ngen: Gen, ct: TrieMap[K, V]) = {
val nin = new INode[K, V](ngen)
val main = GCAS_READ(ct)
nin.WRITE(main)
@@ -98,7 +97,7 @@ private[collection] final class INode[K, V](bn: MainNode[K, V], g: Gen) extends
*
* @return true if successful, false otherwise
*/
- @tailrec final def rec_insert(k: K, v: V, hc: Int, lev: Int, parent: INode[K, V], startgen: Gen, ct: TrieMap[K, V]): Boolean = {
+ @tailrec def rec_insert(k: K, v: V, hc: Int, lev: Int, parent: INode[K, V], startgen: Gen, ct: TrieMap[K, V]): Boolean = {
val m = GCAS_READ(ct) // use -Yinline!
m match {
@@ -144,7 +143,7 @@ private[collection] final class INode[K, V](bn: MainNode[K, V], g: Gen) extends
* @param cond null - don't care if the key was there; KEY_ABSENT - key wasn't there; KEY_PRESENT - key was there; other value `v` - key must be bound to `v`
* @return null if unsuccessful, Option[V] otherwise (indicating previous value bound to the key)
*/
- @tailrec final def rec_insertif(k: K, v: V, hc: Int, cond: AnyRef, lev: Int, parent: INode[K, V], startgen: Gen, ct: TrieMap[K, V]): Option[V] = {
+ @tailrec def rec_insertif(k: K, v: V, hc: Int, cond: AnyRef, lev: Int, parent: INode[K, V], startgen: Gen, ct: TrieMap[K, V]): Option[V] = {
val m = GCAS_READ(ct) // use -Yinline!
m match {
@@ -203,7 +202,7 @@ private[collection] final class INode[K, V](bn: MainNode[K, V], g: Gen) extends
clean(parent, ct, lev - 5)
null
case ln: LNode[K, V] => // 3) an l-node
- @inline def insertln() = {
+ def insertln() = {
val nn = ln.inserted(k, v)
GCAS(ln, nn, ct)
}
@@ -234,7 +233,7 @@ private[collection] final class INode[K, V](bn: MainNode[K, V], g: Gen) extends
*
* @return null if no value has been found, RESTART if the operation wasn't successful, or any other value otherwise
*/
- @tailrec final def rec_lookup(k: K, hc: Int, lev: Int, parent: INode[K, V], startgen: Gen, ct: TrieMap[K, V]): AnyRef = {
+ @tailrec def rec_lookup(k: K, hc: Int, lev: Int, parent: INode[K, V], startgen: Gen, ct: TrieMap[K, V]): AnyRef = {
val m = GCAS_READ(ct) // use -Yinline!
m match {
@@ -277,7 +276,7 @@ private[collection] final class INode[K, V](bn: MainNode[K, V], g: Gen) extends
* @param v if null, will remove the key irregardless of the value; otherwise removes only if binding contains that exact key and value
* @return null if not successful, an Option[V] indicating the previous value otherwise
*/
- final def rec_remove(k: K, v: V, hc: Int, lev: Int, parent: INode[K, V], startgen: Gen, ct: TrieMap[K, V]): Option[V] = {
+ def rec_remove(k: K, v: V, hc: Int, lev: Int, parent: INode[K, V], startgen: Gen, ct: TrieMap[K, V]): Option[V] = {
val m = GCAS_READ(ct) // use -Yinline!
m match {
@@ -361,9 +360,9 @@ private[collection] final class INode[K, V](bn: MainNode[K, V], g: Gen) extends
}
}
- final def isNullInode(ct: TrieMap[K, V]) = GCAS_READ(ct) eq null
+ def isNullInode(ct: TrieMap[K, V]) = GCAS_READ(ct) eq null
- final def cachedSize(ct: TrieMap[K, V]): Int = {
+ def cachedSize(ct: TrieMap[K, V]): Int = {
val m = GCAS_READ(ct)
m.cachedSize(ct)
}
@@ -448,11 +447,9 @@ extends MainNode[K, V] {
}
-private[collection] final class CNode[K, V](final val bitmap: Int, final val array: Array[BasicNode], final val gen: Gen)
-extends CNodeBase[K, V] {
-
+private[collection] final class CNode[K, V](val bitmap: Int, val array: Array[BasicNode], val gen: Gen) extends CNodeBase[K, V] {
// this should only be called from within read-only snapshots
- final def cachedSize(ct: AnyRef) = {
+ def cachedSize(ct: AnyRef) = {
val currsz = READ_SIZE()
if (currsz != -1) currsz
else {
@@ -486,7 +483,7 @@ extends CNodeBase[K, V] {
sz
}
- final def updatedAt(pos: Int, nn: BasicNode, gen: Gen) = {
+ def updatedAt(pos: Int, nn: BasicNode, gen: Gen) = {
val len = array.length
val narr = new Array[BasicNode](len)
Array.copy(array, 0, narr, 0, len)
@@ -494,7 +491,7 @@ extends CNodeBase[K, V] {
new CNode[K, V](bitmap, narr, gen)
}
- final def removedAt(pos: Int, flag: Int, gen: Gen) = {
+ def removedAt(pos: Int, flag: Int, gen: Gen) = {
val arr = array
val len = arr.length
val narr = new Array[BasicNode](len - 1)
@@ -503,7 +500,7 @@ extends CNodeBase[K, V] {
new CNode[K, V](bitmap ^ flag, narr, gen)
}
- final def insertedAt(pos: Int, flag: Int, nn: BasicNode, gen: Gen) = {
+ def insertedAt(pos: Int, flag: Int, nn: BasicNode, gen: Gen) = {
val len = array.length
val bmp = bitmap
val narr = new Array[BasicNode](len + 1)
@@ -516,7 +513,7 @@ extends CNodeBase[K, V] {
/** Returns a copy of this cnode such that all the i-nodes below it are copied
* to the specified generation `ngen`.
*/
- final def renewed(ngen: Gen, ct: TrieMap[K, V]) = {
+ def renewed(ngen: Gen, ct: TrieMap[K, V]) = {
var i = 0
val arr = array
val len = arr.length
@@ -536,7 +533,7 @@ extends CNodeBase[K, V] {
case _ => inode
}
- final def toContracted(lev: Int): MainNode[K, V] = if (array.length == 1 && lev > 0) array(0) match {
+ def toContracted(lev: Int): MainNode[K, V] = if (array.length == 1 && lev > 0) array(0) match {
case sn: SNode[K, V] => sn.copyTombed
case _ => this
} else this
@@ -547,7 +544,7 @@ extends CNodeBase[K, V] {
// returns the version of this node with at least some null-inodes
// removed (those existing when the op began)
// - if there are only null-i-nodes below, returns null
- final def toCompressed(ct: TrieMap[K, V], lev: Int, gen: Gen) = {
+ def toCompressed(ct: TrieMap[K, V], lev: Int, gen: Gen) = {
var bmp = bitmap
var i = 0
val arr = array
@@ -571,7 +568,7 @@ extends CNodeBase[K, V] {
private[concurrent] def string(lev: Int): String = "CNode %x\n%s".format(bitmap, array.map(_.string(lev + 1)).mkString("\n"))
/* quiescently consistent - don't call concurrently to anything involving a GCAS!! */
- protected def collectElems: Seq[(K, V)] = array flatMap {
+ private def collectElems: Seq[(K, V)] = array flatMap {
case sn: SNode[K, V] => Some(sn.kvPair)
case in: INode[K, V] => in.mainnode match {
case tn: TNode[K, V] => Some(tn.kvPair)
@@ -580,7 +577,7 @@ extends CNodeBase[K, V] {
}
}
- protected def collectLocalElems: Seq[String] = array flatMap {
+ private def collectLocalElems: Seq[String] = array flatMap {
case sn: SNode[K, V] => Some(sn.kvPair._2.toString)
case in: INode[K, V] => Some(in.toString.drop(14) + "(" + in.gen + ")")
}
@@ -687,11 +684,11 @@ extends scala.collection.concurrent.Map[K, V]
} while (obj != TrieMapSerializationEnd)
}
- @inline final def CAS_ROOT(ov: AnyRef, nv: AnyRef) = rootupdater.compareAndSet(this, ov, nv)
+ def CAS_ROOT(ov: AnyRef, nv: AnyRef) = rootupdater.compareAndSet(this, ov, nv)
- final def readRoot(abort: Boolean = false): INode[K, V] = RDCSS_READ_ROOT(abort)
+ def readRoot(abort: Boolean = false): INode[K, V] = RDCSS_READ_ROOT(abort)
- @inline final def RDCSS_READ_ROOT(abort: Boolean = false): INode[K, V] = {
+ def RDCSS_READ_ROOT(abort: Boolean = false): INode[K, V] = {
val r = /*READ*/root
r match {
case in: INode[K, V] => in
@@ -781,9 +778,9 @@ extends scala.collection.concurrent.Map[K, V]
override def empty: TrieMap[K, V] = new TrieMap[K, V]
- final def isReadOnly = rootupdater eq null
+ def isReadOnly = rootupdater eq null
- final def nonReadOnly = rootupdater ne null
+ def nonReadOnly = rootupdater ne null
/** Returns a snapshot of this TrieMap.
* This operation is lock-free and linearizable.
@@ -794,7 +791,7 @@ extends scala.collection.concurrent.Map[K, V]
* TrieMap is distributed across all the threads doing updates or accesses
* subsequent to the snapshot creation.
*/
- @tailrec final def snapshot(): TrieMap[K, V] = {
+ @tailrec def snapshot(): TrieMap[K, V] = {
val r = RDCSS_READ_ROOT()
val expmain = r.gcasRead(this)
if (RDCSS_ROOT(r, expmain, r.copyToGen(new Gen, this))) new TrieMap(r.copyToGen(new Gen, this), rootupdater, hashing, equality)
@@ -813,34 +810,34 @@ extends scala.collection.concurrent.Map[K, V]
*
* This method is used by other methods such as `size` and `iterator`.
*/
- @tailrec final def readOnlySnapshot(): scala.collection.Map[K, V] = {
+ @tailrec def readOnlySnapshot(): scala.collection.Map[K, V] = {
val r = RDCSS_READ_ROOT()
val expmain = r.gcasRead(this)
if (RDCSS_ROOT(r, expmain, r.copyToGen(new Gen, this))) new TrieMap(r, null, hashing, equality)
else readOnlySnapshot()
}
- @tailrec final override def clear() {
+ @tailrec override def clear() {
val r = RDCSS_READ_ROOT()
if (!RDCSS_ROOT(r, r.gcasRead(this), INode.newRootNode[K, V])) clear()
}
- @inline
+
def computeHash(k: K) = hashingobj.hash(k)
- final def lookup(k: K): V = {
+ def lookup(k: K): V = {
val hc = computeHash(k)
lookuphc(k, hc).asInstanceOf[V]
}
- final override def apply(k: K): V = {
+ override def apply(k: K): V = {
val hc = computeHash(k)
val res = lookuphc(k, hc)
if (res eq null) throw new NoSuchElementException
else res.asInstanceOf[V]
}
- final def get(k: K): Option[V] = {
+ def get(k: K): Option[V] = {
val hc = computeHash(k)
Option(lookuphc(k, hc)).asInstanceOf[Option[V]]
}
@@ -850,22 +847,22 @@ extends scala.collection.concurrent.Map[K, V]
insertifhc(key, hc, value, null)
}
- final override def update(k: K, v: V) {
+ override def update(k: K, v: V) {
val hc = computeHash(k)
inserthc(k, hc, v)
}
- final def +=(kv: (K, V)) = {
+ def +=(kv: (K, V)) = {
update(kv._1, kv._2)
this
}
- final override def remove(k: K): Option[V] = {
+ override def remove(k: K): Option[V] = {
val hc = computeHash(k)
removehc(k, null.asInstanceOf[V], hc)
}
- final def -=(k: K) = {
+ def -=(k: K) = {
remove(k)
this
}
@@ -960,12 +957,12 @@ private[collection] class TrieMapIterator[K, V](var level: Int, private var ct:
current = null
}
- @inline private def checkSubiter() = if (!subiter.hasNext) {
+ private def checkSubiter() = if (!subiter.hasNext) {
subiter = null
advance()
}
- @inline private def initialize() {
+ private def initialize() {
assert(ct.isReadOnly)
val r = ct.RDCSS_READ_ROOT()
diff --git a/src/library/scala/collection/immutable/Range.scala b/src/library/scala/collection/immutable/Range.scala
index a2875ec3fb..92ea5d3f04 100644
--- a/src/library/scala/collection/immutable/Range.scala
+++ b/src/library/scala/collection/immutable/Range.scala
@@ -127,7 +127,7 @@ extends scala.collection.AbstractSeq[Int]
}
}
- @inline final def apply(idx: Int): Int = {
+ final def apply(idx: Int): Int = {
validateMaxLength()
if (idx < 0 || idx >= numRangeElements) throw new IndexOutOfBoundsException(idx.toString)
else start + (step * idx)
@@ -346,11 +346,11 @@ object Range {
/** Make an inclusive range from `start` to `end` with given step value.
* @note step != 0
*/
- @inline def inclusive(start: Int, end: Int, step: Int): Range.Inclusive = new Inclusive(start, end, step)
+ def inclusive(start: Int, end: Int, step: Int): Range.Inclusive = new Inclusive(start, end, step)
/** Make an inclusive range from `start` to `end` with step value 1.
*/
- @inline def inclusive(start: Int, end: Int): Range.Inclusive = new Inclusive(start, end, 1)
+ def inclusive(start: Int, end: Int): Range.Inclusive = new Inclusive(start, end, 1)
// BigInt and Long are straightforward generic ranges.
object BigInt {
diff --git a/src/library/scala/collection/immutable/Vector.scala b/src/library/scala/collection/immutable/Vector.scala
index 98b5aa6d9f..a33bf2c9c5 100644
--- a/src/library/scala/collection/immutable/Vector.scala
+++ b/src/library/scala/collection/immutable/Vector.scala
@@ -25,11 +25,11 @@ object Vector extends SeqFactory[Vector] {
private val VectorReusableCBF: GenericCanBuildFrom[Nothing] = new VectorReusableCBF
- @inline implicit def canBuildFrom[A]: CanBuildFrom[Coll, A, Vector[A]] =
+ implicit def canBuildFrom[A]: CanBuildFrom[Coll, A, Vector[A]] =
VectorReusableCBF.asInstanceOf[CanBuildFrom[Coll, A, Vector[A]]]
def newBuilder[A]: Builder[A, Vector[A]] = new VectorBuilder[A]
private[immutable] val NIL = new Vector[Nothing](0, 0, 0)
- @inline override def empty[A]: Vector[A] = NIL
+ override def empty[A]: Vector[A] = NIL
}
// in principle, most members should be private. however, access privileges must
@@ -94,7 +94,7 @@ override def companion: GenericCompanion[Vector] = Vector
if (s.depth > 1) s.gotoPos(startIndex, startIndex ^ focus)
}
- @inline override def iterator: VectorIterator[A] = {
+ override def iterator: VectorIterator[A] = {
val s = new VectorIterator[A](startIndex, endIndex)
initIterator(s)
s
@@ -120,16 +120,6 @@ override def companion: GenericCompanion[Vector] = Vector
// In principle, escape analysis could even remove the iterator/builder allocations and do it
// with local variables exclusively. But we're not quite there yet ...
- @deprecated("this method is experimental and will be removed in a future release", "2.8.0")
- @inline def foreachFast[U](f: A => U): Unit = iterator.foreachFast(f)
- @deprecated("this method is experimental and will be removed in a future release", "2.8.0")
- @inline def mapFast[B, That](f: A => B)(implicit bf: CanBuildFrom[Vector[A], B, That]): That = {
- val b = bf(repr)
- foreachFast(x => b += f(x))
- b.result
- }
-
-
def apply(index: Int): A = {
val idx = checkRangeConvert(index)
//println("get elem: "+index + "/"+idx + "(focus:" +focus+" xor:"+(idx^focus)+" depth:"+depth+")")
@@ -147,17 +137,17 @@ override def companion: GenericCompanion[Vector] = Vector
// SeqLike api
- @inline override def updated[B >: A, That](index: Int, elem: B)(implicit bf: CanBuildFrom[Vector[A], B, That]): That = bf match {
+ override def updated[B >: A, That](index: Int, elem: B)(implicit bf: CanBuildFrom[Vector[A], B, That]): That = bf match {
case _: Vector.VectorReusableCBF => updateAt(index, elem).asInstanceOf[That] // just ignore bf
case _ => super.updated(index, elem)(bf)
}
- @inline override def +:[B >: A, That](elem: B)(implicit bf: CanBuildFrom[Vector[A], B, That]): That = bf match {
+ override def +:[B >: A, That](elem: B)(implicit bf: CanBuildFrom[Vector[A], B, That]): That = bf match {
case _: Vector.VectorReusableCBF => appendFront(elem).asInstanceOf[That] // just ignore bf
case _ => super.+:(elem)(bf)
}
- @inline override def :+[B >: A, That](elem: B)(implicit bf: CanBuildFrom[Vector[A], B, That]): That = bf match {
+ override def :+[B >: A, That](elem: B)(implicit bf: CanBuildFrom[Vector[A], B, That]): That = bf match {
case _: Vector.VectorReusableCBF => appendBack(elem).asInstanceOf[That] // just ignore bf
case _ => super.:+(elem)(bf)
}
@@ -696,9 +686,6 @@ extends AbstractIterator[A]
v.initFrom(this)
v
}
-
- @deprecated("this method is experimental and will be removed in a future release", "2.8.0")
- @inline def foreachFast[U](f: A => U) { while (hasNext) f(next()) }
}
diff --git a/src/library/scala/collection/mutable/PriorityQueue.scala b/src/library/scala/collection/mutable/PriorityQueue.scala
index abd8c1cdff..1fc3928531 100644
--- a/src/library/scala/collection/mutable/PriorityQueue.scala
+++ b/src/library/scala/collection/mutable/PriorityQueue.scala
@@ -43,12 +43,12 @@ class PriorityQueue[A](implicit val ord: Ordering[A])
{
import ord._
- private final class ResizableArrayAccess[A] extends AbstractSeq[A] with ResizableArray[A] {
- @inline def p_size0 = size0
- @inline def p_size0_=(s: Int) = size0 = s
- @inline def p_array = array
- @inline def p_ensureSize(n: Int) = super.ensureSize(n)
- @inline def p_swap(a: Int, b: Int) = super.swap(a, b)
+ private class ResizableArrayAccess[A] extends AbstractSeq[A] with ResizableArray[A] {
+ def p_size0 = size0
+ def p_size0_=(s: Int) = size0 = s
+ def p_array = array
+ def p_ensureSize(n: Int) = super.ensureSize(n)
+ def p_swap(a: Int, b: Int) = super.swap(a, b)
}
protected[this] override def newBuilder = new PriorityQueue[A]
diff --git a/src/library/scala/runtime/ScalaRunTime.scala b/src/library/scala/runtime/ScalaRunTime.scala
index c7f1d2fcac..5c9e36450b 100644
--- a/src/library/scala/runtime/ScalaRunTime.scala
+++ b/src/library/scala/runtime/ScalaRunTime.scala
@@ -208,12 +208,12 @@ object ScalaRunTime {
// Note that these are the implementations called by ##, so they
// must not call ## themselves.
- @inline def hash(x: Any): Int =
+ def hash(x: Any): Int =
if (x == null) 0
else if (x.isInstanceOf[java.lang.Number]) BoxesRunTime.hashFromNumber(x.asInstanceOf[java.lang.Number])
else x.hashCode
- @inline def hash(dv: Double): Int = {
+ def hash(dv: Double): Int = {
val iv = dv.toInt
if (iv == dv) return iv
@@ -223,7 +223,7 @@ object ScalaRunTime {
val fv = dv.toFloat
if (fv == dv) fv.hashCode else dv.hashCode
}
- @inline def hash(fv: Float): Int = {
+ def hash(fv: Float): Int = {
val iv = fv.toInt
if (iv == fv) return iv
@@ -231,22 +231,22 @@ object ScalaRunTime {
if (lv == fv) return hash(lv)
else fv.hashCode
}
- @inline def hash(lv: Long): Int = {
+ def hash(lv: Long): Int = {
val low = lv.toInt
val lowSign = low >>> 31
val high = (lv >>> 32).toInt
low ^ (high + lowSign)
}
- @inline def hash(x: Number): Int = runtime.BoxesRunTime.hashFromNumber(x)
+ def hash(x: Number): Int = runtime.BoxesRunTime.hashFromNumber(x)
// The remaining overloads are here for completeness, but the compiler
// inlines these definitions directly so they're not generally used.
- @inline def hash(x: Int): Int = x
- @inline def hash(x: Short): Int = x.toInt
- @inline def hash(x: Byte): Int = x.toInt
- @inline def hash(x: Char): Int = x.toInt
- @inline def hash(x: Boolean): Int = if (x) true.hashCode else false.hashCode
- @inline def hash(x: Unit): Int = 0
+ def hash(x: Int): Int = x
+ def hash(x: Short): Int = x.toInt
+ def hash(x: Byte): Int = x.toInt
+ def hash(x: Char): Int = x.toInt
+ def hash(x: Boolean): Int = if (x) true.hashCode else false.hashCode
+ def hash(x: Unit): Int = 0
/** A helper method for constructing case class equality methods,
* because existential types get in the way of a clean outcome and
diff --git a/src/reflect/scala/reflect/internal/Chars.scala b/src/reflect/scala/reflect/internal/Chars.scala
index e5e5325b93..b1ae105e56 100644
--- a/src/reflect/scala/reflect/internal/Chars.scala
+++ b/src/reflect/scala/reflect/internal/Chars.scala
@@ -51,7 +51,7 @@ trait Chars {
}
/** Is character a line break? */
- @inline def isLineBreakChar(c: Char) = (c: @switch) match {
+ def isLineBreakChar(c: Char) = (c: @switch) match {
case LF|FF|CR|SU => true
case _ => false
}
diff --git a/src/reflect/scala/reflect/internal/Symbols.scala b/src/reflect/scala/reflect/internal/Symbols.scala
index b04cf4ff9f..fce1a78c02 100644
--- a/src/reflect/scala/reflect/internal/Symbols.scala
+++ b/src/reflect/scala/reflect/internal/Symbols.scala
@@ -346,7 +346,7 @@ trait Symbols extends api.Symbols { self: SymbolTable =>
// don't test directly -- use isGADTSkolem
// used to single out a gadt skolem symbol in deskolemizeGADT
// gadtskolems are created in adaptConstrPattern and removed at the end of typedCase
- @inline final protected[Symbols] def GADT_SKOLEM_FLAGS = CASEACCESSOR | SYNTHETIC
+ final protected[Symbols] def GADT_SKOLEM_FLAGS = CASEACCESSOR | SYNTHETIC
// flags set up to maintain TypeSkolem's invariant: origin.isInstanceOf[Symbol] == !hasFlag(EXISTENTIAL)
// GADT_SKOLEM_FLAGS (== CASEACCESSOR | SYNTHETIC) used to single this symbol out in deskolemizeGADT
@@ -586,11 +586,11 @@ trait Symbols extends api.Symbols { self: SymbolTable =>
&& owner.isPackageClass
&& nme.isReplWrapperName(name)
)
- @inline final def getFlag(mask: Long): Long = flags & mask
+ final def getFlag(mask: Long): Long = flags & mask
/** Does symbol have ANY flag in `mask` set? */
- @inline final def hasFlag(mask: Long): Boolean = (flags & mask) != 0
+ final def hasFlag(mask: Long): Boolean = (flags & mask) != 0
/** Does symbol have ALL the flags in `mask` set? */
- @inline final def hasAllFlags(mask: Long): Boolean = (flags & mask) == mask
+ final def hasAllFlags(mask: Long): Boolean = (flags & mask) == mask
def setFlag(mask: Long): this.type = { _rawflags |= mask ; this }
def resetFlag(mask: Long): this.type = { _rawflags &= ~mask ; this }
diff --git a/src/reflect/scala/reflect/internal/Trees.scala b/src/reflect/scala/reflect/internal/Trees.scala
index 5a6d6ce7c7..6540d4a7c1 100644
--- a/src/reflect/scala/reflect/internal/Trees.scala
+++ b/src/reflect/scala/reflect/internal/Trees.scala
@@ -21,10 +21,10 @@ trait Trees extends api.Trees { self: SymbolTable =>
if (Statistics.canEnable) Statistics.incCounter(TreesStats.nodeByType, getClass)
- @inline final override def pos: Position = rawatt.pos
+ final override def pos: Position = rawatt.pos
private[this] var rawtpe: Type = _
- @inline final def tpe = rawtpe
+ final def tpe = rawtpe
def tpe_=(t: Type) = rawtpe = t
def setType(tp: Type): this.type = { rawtpe = tp; this }
def defineType(tp: Type): this.type = setType(tp)
diff --git a/src/reflect/scala/reflect/internal/Types.scala b/src/reflect/scala/reflect/internal/Types.scala
index cda8a382de..ee488c9d18 100644
--- a/src/reflect/scala/reflect/internal/Types.scala
+++ b/src/reflect/scala/reflect/internal/Types.scala
@@ -4429,7 +4429,7 @@ trait Types extends api.Types { self: SymbolTable =>
var capturedSkolems: List[Symbol] = List()
var capturedParams: List[Symbol] = List()
- @inline private def skipPrefixOf(pre: Type, clazz: Symbol) = (
+ private def skipPrefixOf(pre: Type, clazz: Symbol) = (
(pre eq NoType) || (pre eq NoPrefix) || !isPossiblePrefix(clazz)
)
override def mapOver(tree: Tree, giveup: ()=>Nothing): Tree = {
@@ -5117,9 +5117,9 @@ trait Types extends api.Types { self: SymbolTable =>
// in addition to making subtyping "more correct" for type vars,
// it should avoid the stackoverflow that's been plaguing us (https://groups.google.com/d/topic/scala-internals/2gHzNjtB4xA/discussion)
// this method is only called when subtyping hits a recursion threshold (subsametypeRecursions >= LogPendingSubTypesThreshold)
- @inline def suspend(tp: Type) =
+ def suspend(tp: Type) =
if (tp.isGround) null else suspendTypeVarsInType(tp)
- @inline def revive(suspension: List[TypeVar]) =
+ def revive(suspension: List[TypeVar]) =
if (suspension ne null) suspension foreach (_.suspended = false)
val suspensions = Array(tp1, stp.tp1, tp2, stp.tp2) map suspend
@@ -5621,7 +5621,7 @@ trait Types extends api.Types { self: SymbolTable =>
case _: SingletonType =>
tp2 match {
case _: SingletonType =>
- @inline def chaseDealiasedUnderlying(tp: Type): Type = {
+ def chaseDealiasedUnderlying(tp: Type): Type = {
var origin = tp
var next = origin.underlying.dealias
while (next.isInstanceOf[SingletonType]) {
diff --git a/src/reflect/scala/reflect/internal/util/ThreeValues.scala b/src/reflect/scala/reflect/internal/util/ThreeValues.scala
index d89f11c407..f89bd9e199 100644
--- a/src/reflect/scala/reflect/internal/util/ThreeValues.scala
+++ b/src/reflect/scala/reflect/internal/util/ThreeValues.scala
@@ -9,6 +9,6 @@ object ThreeValues {
final val NO = -1
final val UNKNOWN = 0
- @inline def fromBoolean(b: Boolean): ThreeValue = if (b) YES else NO
- @inline def toBoolean(x: ThreeValue): Boolean = x == YES
+ def fromBoolean(b: Boolean): ThreeValue = if (b) YES else NO
+ def toBoolean(x: ThreeValue): Boolean = x == YES
}