diff options
Diffstat (limited to 'src/compiler/scala/tools/nsc/backend')
9 files changed, 34 insertions, 33 deletions
diff --git a/src/compiler/scala/tools/nsc/backend/icode/ExceptionHandlers.scala b/src/compiler/scala/tools/nsc/backend/icode/ExceptionHandlers.scala index 89c5ca18a9..e38d14c10b 100644 --- a/src/compiler/scala/tools/nsc/backend/icode/ExceptionHandlers.scala +++ b/src/compiler/scala/tools/nsc/backend/icode/ExceptionHandlers.scala @@ -75,8 +75,8 @@ trait ExceptionHandlers { } object NoFinalizer extends Finalizer(null, "<no finalizer>", NoPosition) { - override def startBlock: BasicBlock = error("NoFinalizer cannot have a start block."); - override def setStartBlock(b: BasicBlock): Unit = error("NoFinalizer cannot have a start block."); + override def startBlock: BasicBlock = system.error("NoFinalizer cannot have a start block."); + override def setStartBlock(b: BasicBlock): Unit = system.error("NoFinalizer cannot have a start block."); override def dup = this } } diff --git a/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala b/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala index 7744a57547..0e2c39aeee 100644 --- a/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala +++ b/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala @@ -122,7 +122,7 @@ abstract class GenICode extends SubComponent { case Block(_, Return(_)) => () case Return(_) => () case EmptyTree => - error("Concrete method has no definition: " + tree) + globalError("Concrete method has no definition: " + tree) case _ => if (ctx1.bb.isEmpty) ctx1.bb.closeWith(RETURN(m.returnType), rhs.pos) else diff --git a/src/compiler/scala/tools/nsc/backend/icode/ICodeCheckers.scala b/src/compiler/scala/tools/nsc/backend/icode/ICodeCheckers.scala index 8e92beebc3..3beab98237 100644 --- a/src/compiler/scala/tools/nsc/backend/icode/ICodeCheckers.scala +++ b/src/compiler/scala/tools/nsc/backend/icode/ICodeCheckers.scala @@ -7,7 +7,8 @@ package scala.tools.nsc package backend package icode -import scala.collection.mutable.{Buffer, ListBuffer, Map, HashMap} +import scala.collection.mutable +import scala.collection.mutable.ListBuffer import scala.tools.nsc.symtab._ abstract class ICodeCheckers { @@ -59,8 +60,8 @@ abstract class ICodeCheckers { var method: IMethod = _ var code: Code = _ - val in: Map[BasicBlock, TypeStack] = new HashMap() - val out: Map[BasicBlock, TypeStack] = new HashMap() + val in: mutable.Map[BasicBlock, TypeStack] = new mutable.HashMap() + val out: mutable.Map[BasicBlock, TypeStack] = new mutable.HashMap() val emptyStack = new TypeStack() { override def toString = "<empty>" } @@ -113,11 +114,11 @@ abstract class ICodeCheckers { for (f1 <- cls.fields ; f2 <- cls.fields ; if f1 < f2) if (isConfict(f1, f2, false)) - ICodeCheckers.this.global.error("Repetitive field name: " + f1.symbol.fullName) + icodeError("Repetitive field name: " + f1.symbol.fullName) for (m1 <- cls.methods ; m2 <- cls.methods ; if m1 < m2) if (isConfict(m1, m2, true)) - ICodeCheckers.this.global.error("Repetitive method: " + m1.symbol.fullName) + icodeError("Repetitive method: " + m1.symbol.fullName) clasz.methods foreach check } @@ -130,7 +131,7 @@ abstract class ICodeCheckers { } def check(c: Code) { - val worklist: Buffer[BasicBlock] = new ListBuffer() + val worklist = new ListBuffer[BasicBlock] def append(elems: List[BasicBlock]) = worklist ++= (elems filterNot (worklist contains _)) @@ -284,7 +285,7 @@ abstract class ICodeCheckers { var stack = new TypeStack(initial) def checkStack(len: Int) { if (stack.length < len) - ICodeChecker.this.error("Expected at least " + len + " elements on the stack", stack) + ICodeChecker.this.icodeError("Expected at least " + len + " elements on the stack", stack) } def sizeString(push: Boolean) = { @@ -301,7 +302,7 @@ abstract class ICodeCheckers { } def _popStack: TypeKind = { if (stack.isEmpty) { - error("Popped empty stack in " + b.fullString + ", throwing a Unit") + icodeError("Popped empty stack in " + b.fullString + ", throwing a Unit") return UNIT } stack.pop @@ -337,7 +338,7 @@ abstract class ICodeCheckers { } def typeError(k1: TypeKind, k2: TypeKind) { - error("\n expected: " + k1 + "\n found: " + k2) + icodeError("\n expected: " + k1 + "\n found: " + k2) } def isSubtype(k1: TypeKind, k2: TypeKind) = (k1 <:< k2) || { import platform.isMaybeBoxed @@ -368,21 +369,21 @@ abstract class ICodeCheckers { def checkLocal(local: Local): Unit = { method lookupLocal local.sym.name getOrElse { - error(" " + local + " is not defined in method " + method) + icodeError(" " + local + " is not defined in method " + method) } } def checkField(obj: TypeKind, field: Symbol): Unit = obj match { case REFERENCE(sym) => if (sym.info.member(field.name) == NoSymbol) - error(" " + field + " is not defined in class " + clasz); + icodeError(" " + field + " is not defined in class " + clasz); case _ => - error(" expected reference type, but " + obj + " found"); + icodeError(" expected reference type, but " + obj + " found"); } /** Checks that tpe is a subtype of one of the allowed types */ def checkType(tpe: TypeKind, allowed: TypeKind*) = ( if (allowed exists (k => isSubtype(tpe, k))) () - else error(tpe + " is not one of: " + allowed.mkString("{ ", ", ", " }")) + else icodeError(tpe + " is not one of: " + allowed.mkString("{ ", ", ", " }")) ) def checkNumeric(tpe: TypeKind) = checkType(tpe, BYTE, CHAR, SHORT, INT, LONG, FLOAT, DOUBLE) @@ -437,11 +438,11 @@ abstract class ICodeCheckers { "Method " + method + " does not exist in " + receiver) case t => - error("Not a reference type: " + t) + icodeError("Not a reference type: " + t) } def checkBool(cond: Boolean, msg: String) = - if (!cond) error(msg) + if (!cond) icodeError(msg) if (settings.debug.value) { log("PC: " + instr) @@ -461,7 +462,7 @@ abstract class ICodeCheckers { subtypeTest(elem, kind) pushStack(elem) case (a, b) => - error(" expected and INT and a array reference, but " + + icodeError(" expected and INT and a array reference, but " + a + ", " + b + " found"); } @@ -486,7 +487,7 @@ abstract class ICodeCheckers { case STORE_THIS(kind) => val actualType = popStack if (actualType.isReferenceType) subtypeTest(actualType, kind) - else error("Expected this reference but found: " + actualType) + else icodeError("Expected this reference but found: " + actualType) case STORE_ARRAY_ITEM(kind) => popStack3 match { @@ -494,7 +495,7 @@ abstract class ICodeCheckers { subtypeTest(k, kind) subtypeTest(k, elem) case (a, b, c) => - error(" expected and array reference, and int and " + kind + + icodeError(" expected and array reference, and int and " + kind + " but " + a + ", " + b + ", " + c + " found"); } @@ -564,7 +565,7 @@ abstract class ICodeCheckers { case ArrayLength(kind) => popStack match { case ARRAY(elem) => checkType(elem, kind) - case arr => error(" array reference expected, but " + arr + " found") + case arr => icodeError(" array reference expected, but " + arr + " found") } pushStack(INT) @@ -695,16 +696,16 @@ abstract class ICodeCheckers { //////////////// Error reporting ///////////////////////// - def error(msg: String) { - ICodeCheckers.this.global.error( + def icodeError(msg: String) { + ICodeCheckers.this.global.globalError( "!! ICode checker fatality in " + method + "\n at: " + basicBlock.fullString + "\n error message: " + msg ) } - def error(msg: String, stack: TypeStack) { - error(msg + "\n type stack: " + stack) + def icodeError(msg: String, stack: TypeStack) { + icodeError(msg + "\n type stack: " + stack) } } } diff --git a/src/compiler/scala/tools/nsc/backend/icode/Linearizers.scala b/src/compiler/scala/tools/nsc/backend/icode/Linearizers.scala index 9bb704f8b7..05259772f4 100644 --- a/src/compiler/scala/tools/nsc/backend/icode/Linearizers.scala +++ b/src/compiler/scala/tools/nsc/backend/icode/Linearizers.scala @@ -196,7 +196,7 @@ trait Linearizers { self: ICodes => m.code.blocks.toList; def linearizeAt(m: IMethod, start: BasicBlock): List[BasicBlock] = { - error("not implemented") + system.error("not implemented") } } @@ -335,7 +335,7 @@ trait Linearizers { self: ICodes => } def linearizeAt(m: IMethod, start: BasicBlock): List[BasicBlock] = { - error("not implemented") + system.error("not implemented") } } } diff --git a/src/compiler/scala/tools/nsc/backend/icode/Opcodes.scala b/src/compiler/scala/tools/nsc/backend/icode/Opcodes.scala index 5ee4245e35..6da0279ffe 100644 --- a/src/compiler/scala/tools/nsc/backend/icode/Opcodes.scala +++ b/src/compiler/scala/tools/nsc/backend/icode/Opcodes.scala @@ -578,7 +578,7 @@ trait Opcodes { self: ICodes => * then pushes one exception instance. */ case class LOAD_EXCEPTION(clasz: Symbol) extends Instruction { - override def consumed = error("LOAD_EXCEPTION does clean the whole stack, no idea how many things it consumes!") + override def consumed = system.error("LOAD_EXCEPTION does clean the whole stack, no idea how many things it consumes!") override def produced = 1 override def producedTypes = REFERENCE(clasz) :: Nil } diff --git a/src/compiler/scala/tools/nsc/backend/icode/analysis/CopyPropagation.scala b/src/compiler/scala/tools/nsc/backend/icode/analysis/CopyPropagation.scala index 5ac44380f2..3d7219923d 100644 --- a/src/compiler/scala/tools/nsc/backend/icode/analysis/CopyPropagation.scala +++ b/src/compiler/scala/tools/nsc/backend/icode/analysis/CopyPropagation.scala @@ -301,7 +301,7 @@ abstract class CopyPropagation { out.bindings += (LocalVar(local) -> v) } case Nil => - Predef.error("Incorrect icode in " + method + ". Expecting something on the stack.") + system.error("Incorrect icode in " + method + ". Expecting something on the stack.") } out.stack = out.stack drop 1; diff --git a/src/compiler/scala/tools/nsc/backend/icode/analysis/DataFlowAnalysis.scala b/src/compiler/scala/tools/nsc/backend/icode/analysis/DataFlowAnalysis.scala index 98d9081624..be50640d9c 100644 --- a/src/compiler/scala/tools/nsc/backend/icode/analysis/DataFlowAnalysis.scala +++ b/src/compiler/scala/tools/nsc/backend/icode/analysis/DataFlowAnalysis.scala @@ -83,7 +83,7 @@ trait DataFlowAnalysis[L <: SemiLattice] { Console.println("in: " + in.mkString("", "\n", "")) Console.println("out: " + out.mkString("", "\n", "")) e.printStackTrace - Predef.error("Could not find element " + e.getMessage) + system.error("Could not find element " + e.getMessage) } /** ... 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 ec36e50205..03bb2bae3f 100644 --- a/src/compiler/scala/tools/nsc/backend/icode/analysis/TypeFlowAnalysis.scala +++ b/src/compiler/scala/tools/nsc/backend/icode/analysis/TypeFlowAnalysis.scala @@ -46,7 +46,7 @@ abstract class TypeFlowAnalysis { def lub2(exceptional: Boolean)(s1: TypeStack, s2: TypeStack) = { if (s1 eq bottom) s2 else if (s2 eq bottom) s1 - else if ((s1 eq exceptionHandlerStack) || (s2 eq exceptionHandlerStack)) Predef.error("merging with exhan stack") + else if ((s1 eq exceptionHandlerStack) || (s2 eq exceptionHandlerStack)) system.error("merging with exhan stack") else { // if (s1.length != s2.length) // throw new CheckerException("Incompatible stacks: " + s1 + " and " + s2); diff --git a/src/compiler/scala/tools/nsc/backend/opt/Inliners.scala b/src/compiler/scala/tools/nsc/backend/opt/Inliners.scala index 4005b4e5c9..9b7bb3444a 100644 --- a/src/compiler/scala/tools/nsc/backend/opt/Inliners.scala +++ b/src/compiler/scala/tools/nsc/backend/opt/Inliners.scala @@ -300,7 +300,7 @@ abstract class Inliners extends SubComponent { def isMonadic = isMonadicMethod(sym) def handlers = m.exh - def blocks = if (m.code eq null) Predef.error("blocks = null + " + m) else m.code.blocks + def blocks = if (m.code eq null) system.error("blocks = null + " + m) else m.code.blocks def locals = m.locals def length = blocks.length def openBlocks = blocks filterNot (_.closed) |