diff options
7 files changed, 66 insertions, 106 deletions
diff --git a/src/compiler/scala/reflect/internal/Types.scala b/src/compiler/scala/reflect/internal/Types.scala index 3395787d08..358258390f 100644 --- a/src/compiler/scala/reflect/internal/Types.scala +++ b/src/compiler/scala/reflect/internal/Types.scala @@ -5940,7 +5940,7 @@ A type's typeSymbol should never be inspected directly. } val errors = new ListBuffer[(Type, Symbol, List[(Symbol, Symbol)], List[(Symbol, Symbol)], List[(Symbol, Symbol)])] - if (tparams.nonEmpty || targs.nonEmpty) + if (settings.debug.value &&(tparams.nonEmpty || targs.nonEmpty)) log("checkKindBounds0(" + tparams + ", " + targs + ", " + pre + ", " + owner + ", " + explainErrors + ")") for { diff --git a/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala b/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala index 2c10df1c05..4d997b44fd 100644 --- a/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala +++ b/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala @@ -76,7 +76,7 @@ abstract class GenICode extends SubComponent { gen(stats, ctx setPackage pid.name) case ClassDef(mods, name, _, impl) => - log("Generating class: " + tree.symbol.fullName) + debuglog("Generating class: " + tree.symbol.fullName) val outerClass = ctx.clazz ctx setClass (new IClass(tree.symbol) setCompilationUnit unit) addClassFields(ctx, tree.symbol); @@ -95,8 +95,7 @@ abstract class GenICode extends SubComponent { ctx // we use the symbol to add fields case DefDef(mods, name, tparams, vparamss, tpt, rhs) => - if (settings.debug.value) - log("Entering method " + name) + debuglog("Entering method " + name) val m = new IMethod(tree.symbol) m.sourceFile = unit.source.toString() m.returnType = if (tree.symbol.isConstructor) UNIT @@ -506,8 +505,7 @@ abstract class GenICode extends SubComponent { private def msil_genLoadAddressOf(tree: Tree, ctx: Context, expectedType: TypeKind, butRawValueIsAlsoGoodEnough: Boolean): Context = { var generatedType = expectedType var addressTaken = false - if (settings.debug.value) - log("at line: " + (if (tree.pos.isDefined) tree.pos.line else tree.pos)) + debuglog("at line: " + (if (tree.pos.isDefined) tree.pos.line else tree.pos)) var resCtx: Context = tree match { @@ -609,8 +607,7 @@ abstract class GenICode extends SubComponent { */ private def genLoad(tree: Tree, ctx: Context, expectedType: TypeKind): Context = { var generatedType = expectedType - if (settings.debug.value) - log("at line: " + (if (tree.pos.isDefined) tree.pos.line else tree.pos)) + debuglog("at line: " + (if (tree.pos.isDefined) tree.pos.line else tree.pos)) val resCtx: Context = tree match { case LabelDef(name, params, rhs) => @@ -620,13 +617,13 @@ abstract class GenICode extends SubComponent { ctx1.labels.get(tree.symbol) match { case Some(label) => - log("Found existing label for " + tree.symbol) + debuglog("Found existing label for " + tree.symbol.fullLocationString) label.anchor(ctx1.bb) label.patch(ctx.method.code) case None => val pair = (tree.symbol -> (new Label(tree.symbol) anchor ctx1.bb setParams (params map (_.symbol)))) - log("Adding label " + tree.symbol + " in genLoad.") + debuglog("Adding label " + tree.symbol.fullLocationString + " in genLoad.") ctx1.labels += pair ctx.method.addLocals(params map (p => new Local(p.symbol, toTypeKind(p.symbol.info), false))); } @@ -635,7 +632,7 @@ abstract class GenICode extends SubComponent { genLoad(rhs, ctx1, expectedType /*toTypeKind(tree.symbol.info.resultType)*/) case ValDef(_, nme.THIS, _, _) => - if (settings.debug.value) log("skipping trivial assign to _$this: " + tree) + debuglog("skipping trivial assign to _$this: " + tree) ctx case ValDef(_, _, _, rhs) => @@ -643,8 +640,7 @@ abstract class GenICode extends SubComponent { val local = ctx.method.addLocal(new Local(sym, toTypeKind(sym.info), false)) if (rhs == EmptyTree) { - if (settings.debug.value) - log("Uninitialized variable " + tree + " at: " + (tree.pos)); + debuglog("Uninitialized variable " + tree + " at: " + (tree.pos)); ctx.bb.emit(getZeroOf(local.kind)) } @@ -665,7 +661,7 @@ abstract class GenICode extends SubComponent { case Return(expr) => val returnedKind = toTypeKind(expr.tpe) - log("Return(" + expr + ") with returnedKind = " + returnedKind) + debuglog("Return(" + expr + ") with returnedKind = " + returnedKind) var ctx1 = genLoad(expr, ctx, returnedKind) lazy val tmp = ctx1.makeLocal(tree.pos, expr.tpe, "tmp") @@ -673,14 +669,12 @@ abstract class GenICode extends SubComponent { var saved = false ctx1.cleanups foreach { case MonitorRelease(m) => - if (settings.debug.value) - log("removing " + m + " from cleanups: " + ctx1.cleanups) + debuglog("removing " + m + " from cleanups: " + ctx1.cleanups) ctx1.bb.emit(Seq(LOAD_LOCAL(m), MONITOR_EXIT())) ctx1.exitSynchronized(m) case Finalizer(f, finalizerCtx) => - if (settings.debug.value) - log("removing " + f + " from cleanups: " + ctx1.cleanups) + debuglog("removing " + f + " from cleanups: " + ctx1.cleanups) if (returnedKind != UNIT && mayCleanStack(f)) { log("Emitting STORE_LOCAL for " + tmp + " to save finalizer.") @@ -765,8 +759,7 @@ abstract class GenICode extends SubComponent { // therefore, we can ignore this fact, and generate code that leaves nothing // on the stack (contrary to what the type in the AST says). case Apply(fun @ Select(Super(_, mix), _), args) => - if (settings.debug.value) - log("Call to super: " + tree); + debuglog("Call to super: " + tree); val invokeStyle = SuperCall(mix) // if (fun.symbol.isConstructor) Static(true) else SuperCall(mix); @@ -842,8 +835,7 @@ abstract class GenICode extends SubComponent { } case Apply(fun @ _, List(expr)) if (definitions.isBox(fun.symbol)) => - if (settings.debug.value) - log("BOX : " + fun.symbol.fullName); + debuglog("BOX : " + fun.symbol.fullName); val ctx1 = genLoad(expr, ctx, toTypeKind(expr.tpe)) val nativeKind = toTypeKind(expr.tpe) if (settings.Xdce.value) { @@ -859,8 +851,7 @@ abstract class GenICode extends SubComponent { ctx1 case Apply(fun @ _, List(expr)) if (definitions.isUnbox(fun.symbol)) => - if (settings.debug.value) - log("UNBOX : " + fun.symbol.fullName) + debuglog("UNBOX : " + fun.symbol.fullName) val ctx1 = genLoad(expr, ctx, toTypeKind(expr.tpe)) val boxType = toTypeKind(fun.symbol.owner.linkedClassOfClass.tpe) generatedType = boxType @@ -868,8 +859,7 @@ abstract class GenICode extends SubComponent { ctx1 case Apply(fun @ _, List(expr)) if (forMSIL && loaders.clrTypes.isAddressOf(fun.symbol)) => - if (settings.debug.value) - log("ADDRESSOF : " + fun.symbol.fullName); + debuglog("ADDRESSOF : " + fun.symbol.fullName); val ctx1 = msil_genLoadAddressOf(expr, ctx, toTypeKind(expr.tpe), butRawValueIsAlsoGoodEnough = false) generatedType = toTypeKind(fun.symbol.tpe.resultType) ctx1 @@ -880,15 +870,13 @@ abstract class GenICode extends SubComponent { if (sym.isLabel) { // jump to a label val label = ctx.labels.getOrElse(sym, { // it is a forward jump, scan for labels - log("Performing scan for label because of forward jump.") scanForLabels(ctx.defdef, ctx) ctx.labels.get(sym) match { case Some(l) => - log("Found label: " + l) + log("Forward jump for " + sym.fullLocationString + ": scan found label " + l) l case _ => - abort("Unknown label target: " + sym + - " at: " + (fun.pos) + ": ctx: " + ctx) + abort("Unknown label target: " + sym + " at: " + (fun.pos) + ": ctx: " + ctx) } }) val ctx1 = genLoadLabelArguments(args, label, ctx) @@ -900,8 +888,7 @@ abstract class GenICode extends SubComponent { generatedType = resKind newCtx } else { // normal method call - if (settings.debug.value) - log("Gen CALL_METHOD with sym: " + sym + " isStaticSymbol: " + sym.isStaticMember); + debuglog("Gen CALL_METHOD with sym: " + sym + " isStaticSymbol: " + sym.isStaticMember); val invokeStyle = if (sym.isStaticMember) Static(false) @@ -930,7 +917,7 @@ abstract class GenICode extends SubComponent { if (qualSym == ArrayClass) cm setTargetTypeKind toTypeKind(qual.tpe) else cm setHostClass qualSym - if (settings.debug.value) log( + debuglog( if (qualSym == ArrayClass) "Stored target type kind " + toTypeKind(qual.tpe) + " for " + sym.fullName else "Set more precise host class for " + sym.fullName + " host: " + qualSym ) @@ -960,8 +947,7 @@ abstract class GenICode extends SubComponent { "Trying to access the this of another class: " + "tree.symbol = " + tree.symbol + ", ctx.clazz.symbol = " + ctx.clazz.symbol + " compilation unit:"+unit) if (tree.symbol.isModuleClass && tree.symbol != ctx.clazz.symbol) { - if (settings.debug.value) - log("LOAD_MODULE from 'This': " + tree.symbol); + debuglog("LOAD_MODULE from 'This': " + tree.symbol); assert(!tree.symbol.isPackageClass, "Cannot use package as value: " + tree) genLoadModule(ctx, tree.symbol, tree.pos) generatedType = REFERENCE(tree.symbol) @@ -991,8 +977,7 @@ abstract class GenICode extends SubComponent { val hostClass = qualifier.tpe.typeSymbol.orElse(sym.owner) if (sym.isModule) { - if (settings.debug.value) - log("LOAD_MODULE from Select(qualifier, selector): " + sym) + debuglog("LOAD_MODULE from Select(qualifier, selector): " + sym) assert(!tree.symbol.isPackageClass, "Cannot use package as value: " + tree) genLoadModule(ctx, sym, tree.pos) ctx @@ -1009,8 +994,7 @@ abstract class GenICode extends SubComponent { val sym = tree.symbol if (!sym.isPackage) { if (sym.isModule) { - if (settings.debug.value) - log("LOAD_MODULE from Ident(name): " + sym) + debuglog("LOAD_MODULE from Ident(name): " + sym) assert(!sym.isPackageClass, "Cannot use package as value: " + tree) genLoadModule(ctx, sym, tree.pos) generatedType = toTypeKind(sym.info) @@ -1081,8 +1065,7 @@ abstract class GenICode extends SubComponent { ctx1 case Match(selector, cases) => - if (settings.debug.value) - log("Generating SWITCH statement."); + debuglog("Generating SWITCH statement."); var ctx1 = genLoad(selector, ctx, INT) val afterCtx = ctx1.newBlock var caseCtx: Context = null @@ -1135,8 +1118,7 @@ abstract class GenICode extends SubComponent { to match { case UNIT => ctx.bb.emit(DROP(from), pos) - if (settings.debug.value) - log("Dropped an " + from); + debuglog("Dropped an " + from); case _ => if (settings.debug.value) { @@ -1362,12 +1344,12 @@ abstract class GenICode extends SubComponent { liftStringConcat(tree) match { // Optimization for expressions of the form "" + x. We can avoid the StringBuilder. case List(Literal(Constant("")), arg) if !forMSIL => - if (settings.debug.value) log("Rewriting \"\" + x as String.valueOf(x) for: " + arg) + debuglog("Rewriting \"\" + x as String.valueOf(x) for: " + arg) val ctx1 = genLoad(arg, ctx, ObjectReference) ctx1.bb.emit(CALL_METHOD(String_valueOf, Static(false)), arg.pos) ctx1 case concatenations => - if (settings.debug.value) log("Lifted string concatenations for " + tree + "\n to: " + concatenations) + debuglog("Lifted string concatenations for " + tree + "\n to: " + concatenations) var ctx1 = ctx ctx1.bb.emit(CALL_PRIMITIVE(StartConcat), tree.pos) for (elem <- concatenations) { @@ -1482,8 +1464,7 @@ abstract class GenICode extends SubComponent { } } - if (settings.debug.value) - log("Entering genCond with tree: " + tree); + debuglog("Entering genCond with tree: " + tree); // the default emission def default() = { @@ -1704,13 +1685,12 @@ abstract class GenICode extends SubComponent { if (block.size == 1 && optCont.isDefined) { val Some(cont) = optCont; val pred = block.predecessors; - log("Preds: " + pred + " of " + block + " (" + optCont + ")"); + debuglog("Preds: " + pred + " of " + block + " (" + optCont + ")"); pred foreach { p => changed = true p.lastInstruction match { case CJUMP(succ, fail, cond, kind) if (succ == block || fail == block) => - if (settings.debug.value) - log("Pruning empty if branch."); + debuglog("Pruning empty if branch."); p.replaceInstruction(p.lastInstruction, if (block == succ) if (block == fail) @@ -1723,8 +1703,7 @@ abstract class GenICode extends SubComponent { abort("Could not find block in preds: " + method + " " + block + " " + pred + " " + p)) case CZJUMP(succ, fail, cond, kind) if (succ == block || fail == block) => - if (settings.debug.value) - log("Pruning empty ifz branch."); + debuglog("Pruning empty ifz branch."); p.replaceInstruction(p.lastInstruction, if (block == succ) if (block == fail) @@ -1737,15 +1716,13 @@ abstract class GenICode extends SubComponent { abort("Could not find block in preds")) case JUMP(b) if (b == block) => - if (settings.debug.value) - log("Pruning empty JMP branch."); + debuglog("Pruning empty JMP branch."); val replaced = p.replaceInstruction(p.lastInstruction, JUMP(cont)) if (settings.debug.value) assert(replaced, "Didn't find p.lastInstruction") case SWITCH(tags, labels) if (labels contains block) => - if (settings.debug.value) - log("Pruning empty SWITCH branch."); + debuglog("Pruning empty SWITCH branch."); p.replaceInstruction(p.lastInstruction, SWITCH(tags, labels map (l => if (l == block) cont else l))) @@ -1755,7 +1732,7 @@ abstract class GenICode extends SubComponent { } } if (changed) { - log("Removing block: " + block) + debuglog("Removing block: " + block) method.code.removeBlock(block) for (e <- method.exh) { e.covered = e.covered filter (_ != block) @@ -1773,8 +1750,7 @@ abstract class GenICode extends SubComponent { method.code.blocks foreach prune0 } while (changed) - if (settings.debug.value) - log("Prune fixpoint reached in " + n + " iterations."); + debuglog("Prune fixpoint reached in " + n + " iterations."); } def getMaxType(ts: List[Type]): TypeKind = @@ -1906,7 +1882,7 @@ abstract class GenICode extends SubComponent { } def loadException(ctx: Context, exh: ExceptionHandler, pos: Position) = { - log("Emitting LOAD_EXCEPTION for class: " + exh.loadExceptionClass) + debuglog("Emitting LOAD_EXCEPTION for class: " + exh.loadExceptionClass) ctx.bb.emit(LOAD_EXCEPTION(exh.loadExceptionClass) setPos pos, pos) } @@ -2017,8 +1993,7 @@ abstract class GenICode extends SubComponent { exh.resultKind = resultKind method.addHandler(exh) handlers = exh :: handlers - if (settings.debug.value) - log("added handler: " + exh); + debuglog("added handler: " + exh); exh } @@ -2028,8 +2003,7 @@ abstract class GenICode extends SubComponent { private def addActiveHandler(exh: ExceptionHandler) { handlerCount += 1 handlers = exh :: handlers - if (settings.debug.value) - log("added handler: " + exh); + debuglog("added handler: " + exh); } /** Return a new context for generating code for the given @@ -2052,8 +2026,7 @@ abstract class GenICode extends SubComponent { "Wrong nesting of exception handlers." + this + " for " + exh) handlerCount -= 1 handlers = handlers.tail - if (settings.debug.value) - log("removed handler: " + exh); + debuglog("removed handler: " + exh); } diff --git a/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala b/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala index 98ab5e146b..a53fbef200 100644 --- a/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala +++ b/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala @@ -712,8 +712,7 @@ abstract class GenJVM extends SubComponent with GenJVMUtil with GenAndroid with } def genField(f: IField) { - if (settings.debug.value) - log("Adding field: " + f.symbol.fullName) + debuglog("Adding field: " + f.symbol.fullName) val attributes = f.symbol.annotations.map(_.atp.typeSymbol).foldLeft(0) { case (res, TransientAttr) => res | ACC_TRANSIENT @@ -737,7 +736,7 @@ abstract class GenJVM extends SubComponent with GenJVMUtil with GenAndroid with def genMethod(m: IMethod) { if (m.symbol.isStaticConstructor) return - log("Generating method " + m.symbol.fullName) + debuglog("Generating method " + m.symbol.fullName) method = m endPC.clear computeLocalVarsIndex(m) @@ -787,8 +786,7 @@ abstract class GenJVM extends SubComponent with GenJVMUtil with GenAndroid with } for (local <- m.locals if ! m.params.contains(local)) { - if (settings.debug.value) - log("add local var: " + local) + debuglog("add local var: " + local) jmethod.addNewLocalVariable(javaType(local.kind), javaName(local.sym)) } @@ -1000,8 +998,7 @@ abstract class GenJVM extends SubComponent with GenJVMUtil with GenAndroid with */ def addForwarders(jclass: JClass, moduleClass: Symbol) { assert(moduleClass.isModuleClass) - if (settings.debug.value) - log("Dumping mirror class for object: " + moduleClass) + debuglog("Dumping mirror class for object: " + moduleClass) val className = jclass.getName val linkedClass = moduleClass.companionClass @@ -1040,9 +1037,7 @@ abstract class GenJVM extends SubComponent with GenJVMUtil with GenAndroid with log("Adding static forwarder for '%s' from %s to '%s'".format(m, className, moduleClass)) addForwarder(jclass, moduleClass, m, accessFlags) } - else if (settings.debug.value) { - log("No forwarder for '%s' from %s to '%s'".format(m, className, moduleClass)) - } + else debuglog("No forwarder for '%s' from %s to '%s'".format(m, className, moduleClass)) } } @@ -1079,8 +1074,7 @@ abstract class GenJVM extends SubComponent with GenJVMUtil with GenAndroid with val jcode = jmethod.getCode.asInstanceOf[JExtendedCode] def makeLabels(bs: List[BasicBlock]) = { - if (settings.debug.value) - log("Making labels for: " + method) + debuglog("Making labels for: " + method) mutable.HashMap(bs map (_ -> jcode.newLabel) : _*) } @@ -1138,16 +1132,14 @@ abstract class GenJVM extends SubComponent with GenJVMUtil with GenAndroid with } if (!covered.isEmpty) - if (settings.debug.value) - log("Some covered blocks were not found in method: " + method + + debuglog("Some covered blocks were not found in method: " + method + " covered: " + covered + " not in " + linearization) ranges } for (e <- this.method.exh ; p <- ranges(e).sortBy(_._1)) { if (p._1 < p._2) { - if (settings.debug.value) - log("Adding exception handler " + e + "at block: " + e.startBlock + " for " + method + + debuglog("Adding exception handler " + e + "at block: " + e.startBlock + " for " + method + " from: " + p._1 + " to: " + p._2 + " catching: " + e.cls); val cls = if (e.cls == NoSymbol || e.cls == ThrowableClass) null else javaName(e.cls) @@ -1162,8 +1154,7 @@ abstract class GenJVM extends SubComponent with GenJVMUtil with GenAndroid with def genBlock(b: BasicBlock) { labels(b).anchorToNext() - if (settings.debug.value) - log("Generating code for block: " + b + " at pc: " + labels(b).getAnchor()) + debuglog("Generating code for block: " + b + " at pc: " + labels(b).getAnchor()) var lastMappedPC = 0 var lastLineNr = 0 var crtPC = 0 @@ -1198,8 +1189,7 @@ abstract class GenJVM extends SubComponent with GenJVMUtil with GenAndroid with case lf @ LOAD_FIELD(field, isStatic) => var owner = javaName(lf.hostClass) - if (settings.debug.value) - log("LOAD_FIELD with owner: " + owner + + debuglog("LOAD_FIELD with owner: " + owner + " flags: " + Flags.flagsToString(field.owner.flags)) if (isStatic) jcode.emitGETSTATIC(owner, @@ -1212,8 +1202,7 @@ abstract class GenJVM extends SubComponent with GenJVMUtil with GenAndroid with case LOAD_MODULE(module) => // assert(module.isModule, "Expected module: " + module) - if (settings.debug.value) - log("generating LOAD_MODULE for: " + module + " flags: " + + debuglog("generating LOAD_MODULE for: " + module + " flags: " + Flags.flagsToString(module.flags)); if (clasz.symbol == module.moduleClass && jmethod.getName() != nme.readResolve.toString) jcode.emitALOAD_0() @@ -1353,8 +1342,7 @@ abstract class GenJVM extends SubComponent with GenJVMUtil with GenAndroid with branchArray(i) = labels(branches(i)) i += 1 } - if (settings.debug.value) - log("Emitting SWITCH:\ntags: " + tags + "\nbranches: " + branches) + debuglog("Emitting SWITCH:\ntags: " + tags + "\nbranches: " + branches) jcode.emitSWITCH(tagArray, branchArray, labels(branches.last), @@ -1674,8 +1662,7 @@ abstract class GenJVM extends SubComponent with GenJVMUtil with GenAndroid with } case Conversion(src, dst) => - if (settings.debug.value) - log("Converting from: " + src + " to: " + dst) + debuglog("Converting from: " + src + " to: " + dst) if (dst == BOOL) { println("Illegal conversion at: " + clasz + " at: " + pos.source + ":" + pos.line) @@ -1805,8 +1792,7 @@ abstract class GenJVM extends SubComponent with GenJVMUtil with GenAndroid with idx = 0; for (l <- m.locals) { - if (settings.debug.value) - log("Index value for " + l + "{" + l.## + "}: " + idx) + debuglog("Index value for " + l + "{" + l.## + "}: " + idx) l.index = idx idx += sizeOf(l.kind) } @@ -1816,7 +1802,7 @@ abstract class GenJVM extends SubComponent with GenJVMUtil with GenAndroid with /** Calls to methods in 'sym' need invokeinterface? */ def needsInterfaceCall(sym: Symbol): Boolean = { - log("checking for interface call: " + sym.fullName) + debuglog("checking for interface call: " + sym.fullName) // the following call to 'info' may cause certain symbols to fail loading // because we're too late in the compilation chain (aliases to overloaded // symbols will not be properly resolved, see scala.Range, method diff --git a/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala b/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala index 43f66a2fb7..9d3421ae27 100644 --- a/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala +++ b/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala @@ -82,7 +82,7 @@ abstract class ClassfileParser { println("Skipping class: " + root + ": " + root.getClass) } */ - log("parsing " + file.name) + debuglog("parsing " + file.name) this.in = new AbstractFileReader(file) if (root.isModule) { this.clazz = root.companionClass diff --git a/src/compiler/scala/tools/nsc/transform/AddInterfaces.scala b/src/compiler/scala/tools/nsc/transform/AddInterfaces.scala index e37c33480b..b01b1541b6 100644 --- a/src/compiler/scala/tools/nsc/transform/AddInterfaces.scala +++ b/src/compiler/scala/tools/nsc/transform/AddInterfaces.scala @@ -94,7 +94,7 @@ abstract class AddInterfaces extends InfoTransform { impl.flags = iface.flags & ~(INTERFACE | lateINTERFACE) | IMPLCLASS impl setInfo new LazyImplClassType(iface) implClassMap(iface) = impl - if (settings.debug.value) log("generating impl class " + impl + " in " + iface.owner)//debug + debuglog("generating impl class " + impl + " in " + iface.owner)//debug impl } }) diff --git a/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala b/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala index 70976ec3c2..d155665de1 100644 --- a/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala +++ b/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala @@ -490,7 +490,9 @@ abstract class SpecializeTypes extends InfoTransform with TypingTransformers { if (parents.head.typeSymbol.isTrait) parents = parents.head.parents.head :: parents val extraSpecializedMixins = specializedParents(clazz.info.parents.map(applyContext)) - log("extraSpecializedMixins: " + extraSpecializedMixins) + if (extraSpecializedMixins.nonEmpty) + debuglog("specializeClass on " + clazz + " founds extra specialized mixins: " + extraSpecializedMixins.mkString(", ")) + val infoType = ClassInfoType(parents ::: extraSpecializedMixins, decls1, cls) if (newClassTParams.isEmpty) infoType else PolyType(newClassTParams, infoType) } @@ -728,7 +730,7 @@ abstract class SpecializeTypes extends InfoTransform with TypingTransformers { val (keys, vals) = env.toList.unzip specMember.name = specializedName(sym, env) - log("normalizing: " + sym + " to " + specMember + " with params " + tps) + debuglog("normalizing: " + sym + " to " + specMember + " with params " + tps) typeEnv(specMember) = outerEnv ++ env val tps1 = produceTypeParameters(tps, specMember, env) @@ -770,7 +772,7 @@ abstract class SpecializeTypes extends InfoTransform with TypingTransformers { typeEnv(specMember) = typeEnv(sym) ++ outerEnv ++ spec wasSpecializedForTypeVars(specMember) ++= spec collect { case (s, tp) if s.tpe == tp => s } - log("sym " + specMember + " was specialized for type vars " + wasSpecializedForTypeVars(specMember)) + debuglog("sym " + specMember + " was specialized for type vars " + wasSpecializedForTypeVars(specMember)) debuglog("added specialized overload: %s in env: %s".format(specMember, typeEnv(specMember))) overloads(sym) ::= Overload(specMember, spec) @@ -915,7 +917,7 @@ abstract class SpecializeTypes extends InfoTransform with TypingTransformers { else if (strict) throw UnifyError else env case (TypeRef(_, sym1, args1), TypeRef(_, sym2, args2)) => - log("Unify - both type refs: " + tp1 + " and " + tp2 + " with args " + (args1, args2) + " - ") + log("Unify TypeRefs: " + tp1 + " and " + tp2 + " with args " + (args1, args2) + " - ") if (strict && args1.length != args2.length) throw UnifyError val e = unify(args1, args2, env, strict) log("unified to: " + e) @@ -924,11 +926,11 @@ abstract class SpecializeTypes extends InfoTransform with TypingTransformers { env case (MethodType(params1, res1), MethodType(params2, res2)) => if (strict && params1.length != params2.length) throw UnifyError - log("Unify - method types: " + tp1 + " and " + tp2) + log("Unify MethodTypes: " + tp1 + " and " + tp2) unify(res1 :: (params1 map (_.tpe)), res2 :: (params2 map (_.tpe)), env, strict) case (PolyType(tparams1, res1), PolyType(tparams2, res2)) => if (strict && tparams1.length != tparams2.length) throw UnifyError - log("Unify - poly types: " + tp1 + " and " + tp2) + log("Unify PolyTypes: " + tp1 + " and " + tp2) unify(res1, res2, env, strict) case (PolyType(_, res), other) => unify(res, other, env, strict) diff --git a/src/compiler/scala/tools/nsc/transform/TailCalls.scala b/src/compiler/scala/tools/nsc/transform/TailCalls.scala index 5745cccb12..79bcc76988 100644 --- a/src/compiler/scala/tools/nsc/transform/TailCalls.scala +++ b/src/compiler/scala/tools/nsc/transform/TailCalls.scala @@ -205,7 +205,7 @@ abstract class TailCalls extends Transform { fail(reason) } def rewriteTailCall(recv: Tree): Tree = { - log("Rewriting tail recursive method call at: " + fun.pos) + log("Rewriting tail recursive call: " + fun.pos.lineContent.trim) ctx.accessed = true typedPos(fun.pos)(Apply(Ident(ctx.label), recv :: transformArgs)) @@ -225,10 +225,9 @@ abstract class TailCalls extends Transform { tree match { case dd @ DefDef(mods, name, tparams, vparams, tpt, rhs) => - log("Entering DefDef: " + name) val newCtx = new Context(dd) - log("Considering " + name + " for tailcalls") + debuglog("Considering " + name + " for tailcalls") val newRHS = transform(rhs, newCtx) treeCopy.DefDef(tree, mods, name, tparams, vparams, tpt, { |