minor cleanups (leading tabs, Unit, etc.)
git-svn-id: http://lampsvn.epfl.ch/svn-repos/scala/scala/trunk@16543 5e8d7ff9-d8ef-0310-90f0-a4852d11357a
This commit is contained in:
parent
cc816ced15
commit
66c8bd26b3
27
build.xml
27
build.xml
|
@ -1038,7 +1038,7 @@ OPTIMISED COMPILER
|
||||||
<srcfiles dir="${src.dir}/partest"/>
|
<srcfiles dir="${src.dir}/partest"/>
|
||||||
</uptodate>
|
</uptodate>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="optimised.partest" depends="optimised.pre-partest" unless="optimised.partest.available">
|
<target name="optimised.partest" depends="optimised.pre-partest" unless="optimised.partest.available">
|
||||||
<stopwatch name="optimised.partest.timer"/>
|
<stopwatch name="optimised.partest.timer"/>
|
||||||
<mkdir dir="${build-optimised.dir}/classes/partest"/>
|
<mkdir dir="${build-optimised.dir}/classes/partest"/>
|
||||||
|
@ -1047,9 +1047,9 @@ OPTIMISED COMPILER
|
||||||
destdir="${build-optimised.dir}/classes/partest"
|
destdir="${build-optimised.dir}/classes/partest"
|
||||||
target="1.5" source="1.5">
|
target="1.5" source="1.5">
|
||||||
<classpath>
|
<classpath>
|
||||||
<pathelement location="${build-optimised.dir}/classes/library"/>
|
<pathelement location="${build-optimised.dir}/classes/library"/>
|
||||||
<pathelement location="${build-optimised.dir}/classes/compiler"/>
|
<pathelement location="${build-optimised.dir}/classes/compiler"/>
|
||||||
<pathelement location="${build-optimised.dir}/classes/partest"/>
|
<pathelement location="${build-optimised.dir}/classes/partest"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
<include name="**/*.java"/>
|
<include name="**/*.java"/>
|
||||||
<compilerarg line="${javac.args}"/>
|
<compilerarg line="${javac.args}"/>
|
||||||
|
@ -1063,9 +1063,9 @@ OPTIMISED COMPILER
|
||||||
maxmemory="${scalacfork.maxmemory}">
|
maxmemory="${scalacfork.maxmemory}">
|
||||||
<include name="**/*.scala"/>
|
<include name="**/*.scala"/>
|
||||||
<compilationpath>
|
<compilationpath>
|
||||||
<pathelement location="${build-optimised.dir}/classes/library"/>
|
<pathelement location="${build-optimised.dir}/classes/library"/>
|
||||||
<pathelement location="${build-optimised.dir}/classes/compiler"/>
|
<pathelement location="${build-optimised.dir}/classes/compiler"/>
|
||||||
<pathelement location="${build-optimised.dir}/classes/partest"/>
|
<pathelement location="${build-optimised.dir}/classes/partest"/>
|
||||||
<pathelement location="${ant.jar}"/>
|
<pathelement location="${ant.jar}"/>
|
||||||
</compilationpath>
|
</compilationpath>
|
||||||
</scalacfork>
|
</scalacfork>
|
||||||
|
@ -1078,7 +1078,6 @@ OPTIMISED COMPILER
|
||||||
<stopwatch name="optimised.partest.timer" action="total"/>
|
<stopwatch name="optimised.partest.timer" action="total"/>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
|
|
||||||
<target name="optimised.pre-bin" depends="optimised.partest">
|
<target name="optimised.pre-bin" depends="optimised.partest">
|
||||||
<condition property="optimised.bin.available">
|
<condition property="optimised.bin.available">
|
||||||
<isset property="optimised.comp.available"/>
|
<isset property="optimised.comp.available"/>
|
||||||
|
@ -1087,8 +1086,8 @@ OPTIMISED COMPILER
|
||||||
|
|
||||||
<target name="optimised.bin" depends="optimised.pre-bin" unless="optimised.bin.available">
|
<target name="optimised.bin" depends="optimised.pre-bin" unless="optimised.bin.available">
|
||||||
<path id="optimised.bin.classpath">
|
<path id="optimised.bin.classpath">
|
||||||
<pathelement location="${build-optimised.dir}/classes/library"/>
|
<pathelement location="${build-optimised.dir}/classes/library"/>
|
||||||
<pathelement location="${build-optimised.dir}/classes/compiler"/>
|
<pathelement location="${build-optimised.dir}/classes/compiler"/>
|
||||||
<pathelement location="${fjbg.jar}"/>
|
<pathelement location="${fjbg.jar}"/>
|
||||||
<pathelement location="${jline.jar}"/>
|
<pathelement location="${jline.jar}"/>
|
||||||
</path>
|
</path>
|
||||||
|
@ -1248,11 +1247,11 @@ DOCUMENTATION
|
||||||
<delete dir="${build-docs.dir}" includeemptydirs="yes" quiet="yes" failonerror="no"/>
|
<delete dir="${build-docs.dir}" includeemptydirs="yes" quiet="yes" failonerror="no"/>
|
||||||
<delete dir="${build.dir}/manmaker" includeemptydirs="yes" quiet="yes" failonerror="no"/>
|
<delete dir="${build.dir}/manmaker" includeemptydirs="yes" quiet="yes" failonerror="no"/>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<!-- ===========================================================================
|
<!-- ===========================================================================
|
||||||
BOOTRAPING TEST AND TEST SUITE
|
BOOTRAPING TEST AND TEST SUITE
|
||||||
============================================================================ -->
|
============================================================================ -->
|
||||||
|
|
||||||
<target name="test.stability" depends="strap.done">
|
<target name="test.stability" depends="strap.done">
|
||||||
<same dir="${build-quick.dir}" todir="${build-strap.dir}" failondifferent="no">
|
<same dir="${build-quick.dir}" todir="${build-strap.dir}" failondifferent="no">
|
||||||
<exclude name="**/*.properties"/>
|
<exclude name="**/*.properties"/>
|
||||||
|
@ -1341,7 +1340,7 @@ DISTRIBUTION
|
||||||
<copy file="${src.dir}/swing/doc/README"
|
<copy file="${src.dir}/swing/doc/README"
|
||||||
toFile="${dist.dir}/doc/scala-devel-docs/README.scala-swing"/>
|
toFile="${dist.dir}/doc/scala-devel-docs/README.scala-swing"/>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="dist.man" depends="dist.doc">
|
<target name="dist.man" depends="dist.doc">
|
||||||
<mkdir dir="${dist.dir}/man"/>
|
<mkdir dir="${dist.dir}/man"/>
|
||||||
<copy toDir="${dist.dir}/man">
|
<copy toDir="${dist.dir}/man">
|
||||||
|
@ -1377,7 +1376,7 @@ DISTRIBUTION
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="dist.latest" depends="dist.latest.unix,dist.latest.win"/>
|
<target name="dist.latest" depends="dist.latest.unix,dist.latest.win"/>
|
||||||
|
|
||||||
<target name="dist.done" depends="dist.latest"/>
|
<target name="dist.done" depends="dist.latest"/>
|
||||||
|
|
||||||
<target name="dist.clean">
|
<target name="dist.clean">
|
||||||
|
|
|
@ -1,66 +1,64 @@
|
||||||
/* NSC -- new scala compiler
|
/* NSC -- new scala compiler
|
||||||
* Copyright 2005 LAMP/EPFL
|
* Copyright 2005-2008 LAMP/EPFL
|
||||||
* @author Martin Odersky
|
* @author Martin Odersky
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// $Id$
|
// $Id$
|
||||||
|
|
||||||
package scala.tools.nsc.backend.icode;
|
package scala.tools.nsc.backend.icode
|
||||||
|
|
||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter
|
||||||
|
|
||||||
import scala.tools.nsc.util.Position;
|
import scala.tools.nsc.symtab.Flags
|
||||||
import scala.tools.nsc.symtab.Flags;
|
import scala.tools.nsc.util.Position
|
||||||
|
|
||||||
trait Printers { self: ICodes =>
|
trait Printers { self: ICodes =>
|
||||||
// val global: Global;
|
import global._
|
||||||
import global._;
|
import global.icodes.opcodes._
|
||||||
import global.icodes.opcodes._;
|
import global.icodes._
|
||||||
import global.icodes._;
|
|
||||||
|
|
||||||
class TextPrinter(writer: PrintWriter, lin: Linearizer) {
|
class TextPrinter(writer: PrintWriter, lin: Linearizer) {
|
||||||
var margin = 0;
|
private var margin = 0
|
||||||
var out = writer;
|
private var out = writer
|
||||||
|
|
||||||
final val TAB = 2;
|
final val TAB = 2
|
||||||
|
|
||||||
def setWriter(w: PrintWriter) = (out = w);
|
def setWriter(w: PrintWriter) { out = w }
|
||||||
|
|
||||||
def indent = margin = margin + TAB;
|
def indent { margin += TAB }
|
||||||
def undent = margin = margin - TAB;
|
def undent { margin -= TAB }
|
||||||
|
|
||||||
def print(s: String) = out.print(s);
|
def print(s: String) { out.print(s) }
|
||||||
def print(o: Any): Unit = print(o.toString());
|
def print(o: Any) { print(o.toString()) }
|
||||||
|
|
||||||
def println(s: String): Unit = {
|
def println(s: String) {
|
||||||
print(s);
|
print(s);
|
||||||
println
|
println
|
||||||
}
|
}
|
||||||
|
|
||||||
def println = {
|
def println {
|
||||||
out.println();
|
out.println()
|
||||||
var i = 0;
|
var i = 0
|
||||||
while (i < margin) {
|
while (i < margin) {
|
||||||
print(" ");
|
print(" ");
|
||||||
i = i + 1;
|
i += 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
def printList[a](l: List[a], sep: String): Unit = l match {
|
def printList[A](l: List[A], sep: String): Unit = l match {
|
||||||
case Nil => ();
|
case Nil =>
|
||||||
case x :: Nil => print(x);
|
case x :: Nil => print(x)
|
||||||
case x :: xs => print(x); print(sep); printList(xs, sep);
|
case x :: xs => print(x); print(sep); printList(xs, sep)
|
||||||
}
|
}
|
||||||
|
|
||||||
def printList[a](pr: a => Unit)(l: List[a], sep: String): Unit = l match {
|
def printList[A](pr: A => Unit)(l: List[A], sep: String): Unit = l match {
|
||||||
case Nil => ();
|
case Nil =>
|
||||||
case x :: Nil => pr(x);
|
case x :: Nil => pr(x)
|
||||||
case x :: xs => pr(x); print(sep); printList(pr)(xs, sep);
|
case x :: xs => pr(x); print(sep); printList(pr)(xs, sep)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private var clazz: IClass = _
|
||||||
private var clazz : IClass = _;
|
def printClass(cls: IClass) {
|
||||||
def printClass(cls: IClass): Unit = {
|
|
||||||
this.clazz = cls;
|
this.clazz = cls;
|
||||||
print(cls.symbol.toString()); print(" extends ");
|
print(cls.symbol.toString()); print(" extends ");
|
||||||
printList(cls.symbol.info.parents, ", ");
|
printList(cls.symbol.info.parents, ", ");
|
||||||
|
@ -70,43 +68,43 @@ trait Printers { self: ICodes =>
|
||||||
println("// methods");
|
println("// methods");
|
||||||
cls.methods.foreach(printMethod);
|
cls.methods.foreach(printMethod);
|
||||||
undent; println;
|
undent; println;
|
||||||
println("}");
|
println("}")
|
||||||
}
|
}
|
||||||
|
|
||||||
def printField(f: IField): Unit = {
|
def printField(f: IField) {
|
||||||
print(f.symbol.keyString); print(" ");
|
print(f.symbol.keyString); print(" ");
|
||||||
print(f.symbol.nameString); print(": ");
|
print(f.symbol.nameString); print(": ");
|
||||||
println(f.symbol.info.toString());
|
println(f.symbol.info.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
def printMethod(m: IMethod): Unit = {
|
def printMethod(m: IMethod) {
|
||||||
print("def "); print(m.symbol.name);
|
print("def "); print(m.symbol.name);
|
||||||
print("("); printList(printParam)(m.params, ", "); print(")");
|
print("("); printList(printParam)(m.params, ", "); print(")");
|
||||||
print(": "); print(m.symbol.info.resultType);
|
print(": "); print(m.symbol.info.resultType)
|
||||||
|
|
||||||
if (!m.isDeferred) {
|
if (!m.isDeferred) {
|
||||||
println(" {");
|
println(" {")
|
||||||
println("locals: " + m.locals.mkString("", ", ", ""));
|
println("locals: " + m.locals.mkString("", ", ", ""))
|
||||||
println("startBlock: " + m.code.startBlock);
|
println("startBlock: " + m.code.startBlock)
|
||||||
println("blocks: " + m.code.blocks.mkString("[", ",", "]"));
|
println("blocks: " + m.code.blocks.mkString("[", ",", "]"))
|
||||||
println;
|
println
|
||||||
lin.linearize(m) foreach printBlock;
|
lin.linearize(m) foreach printBlock
|
||||||
println("}");
|
println("}")
|
||||||
|
|
||||||
indent;println("Exception handlers: ");
|
indent; println("Exception handlers: ")
|
||||||
m.exh foreach printExceptionHandler;
|
m.exh foreach printExceptionHandler
|
||||||
|
|
||||||
undent;println;
|
undent; println
|
||||||
} else
|
} else
|
||||||
println;
|
println
|
||||||
}
|
}
|
||||||
|
|
||||||
def printParam(p: Local): Unit = {
|
def printParam(p: Local) {
|
||||||
print(p.sym.name); print(": "); print(p.sym.info);
|
print(p.sym.name); print(": "); print(p.sym.info);
|
||||||
print(" ("); print(p.kind); print(")");
|
print(" ("); print(p.kind); print(")")
|
||||||
}
|
}
|
||||||
|
|
||||||
def printExceptionHandler(e: ExceptionHandler) = {
|
def printExceptionHandler(e: ExceptionHandler) {
|
||||||
indent;
|
indent;
|
||||||
println("catch (" + e.cls.simpleName + ") in " + e.covered + " starting at: " + e.startBlock);
|
println("catch (" + e.cls.simpleName + ") in " + e.covered + " starting at: " + e.startBlock);
|
||||||
println("consisting of blocks: " + e.blocks);
|
println("consisting of blocks: " + e.blocks);
|
||||||
|
@ -115,20 +113,20 @@ trait Printers { self: ICodes =>
|
||||||
// linearizer.linearize(e.startBlock) foreach printBlock;
|
// linearizer.linearize(e.startBlock) foreach printBlock;
|
||||||
}
|
}
|
||||||
|
|
||||||
def printBlock(bb: BasicBlock): Unit = {
|
def printBlock(bb: BasicBlock) {
|
||||||
print(bb.label);
|
print(bb.label)
|
||||||
if (bb.loopHeader) print("[loop header]");
|
if (bb.loopHeader) print("[loop header]")
|
||||||
print(": "); indent; println;
|
print(": "); indent; println
|
||||||
bb.toList foreach printInstruction;
|
bb.toList foreach printInstruction
|
||||||
undent; println;
|
undent; println
|
||||||
}
|
}
|
||||||
|
|
||||||
def printInstruction(i: Instruction): Unit = {
|
def printInstruction(i: Instruction) {
|
||||||
// if (settings.Xdce.value)
|
// if (settings.Xdce.value)
|
||||||
// print(if (i.useful) " " else " * ");
|
// print(if (i.useful) " " else " * ");
|
||||||
if (settings.debug.value)
|
if (settings.debug.value)
|
||||||
print(i.pos.line.map(_.toString).getOrElse("No line"))
|
print(i.pos.line.map(_.toString).getOrElse("No line"))
|
||||||
println(i.toString());
|
println(i.toString())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue