Mercurial > hg > truffle
changeset 2791:6d14aa4fbf90
Gotos removed (except for exception dispatch chains and edge splitting).
author | Thomas Wuerthinger <thomas@wuerthinger.net> |
---|---|
date | Wed, 25 May 2011 20:03:05 +0200 |
parents | 50677668afe3 |
children | 2f3258e3800e |
files | graal/GraalCompiler/src/com/sun/c1x/C1XOptions.java graal/GraalCompiler/src/com/sun/c1x/alloc/LinearScan.java graal/GraalCompiler/src/com/sun/c1x/gen/PhiSimplifier.java graal/GraalCompiler/src/com/sun/c1x/graph/GraphBuilder.java graal/GraalGraph/src/com/oracle/graal/graph/Node.java |
diffstat | 5 files changed, 23 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/graal/GraalCompiler/src/com/sun/c1x/C1XOptions.java Wed May 25 19:29:40 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/C1XOptions.java Wed May 25 20:03:05 2011 +0200 @@ -116,7 +116,7 @@ public static int SequentialSwitchLimit = 4; public static int RangeTestsSwitchDensity = 5; - public static boolean DetailedAsserts = true;//____; + public static boolean DetailedAsserts = ____; // Runtime settings public static int ReadPrefetchInstr = 0;
--- a/graal/GraalCompiler/src/com/sun/c1x/alloc/LinearScan.java Wed May 25 19:29:40 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/alloc/LinearScan.java Wed May 25 20:03:05 2011 +0200 @@ -27,6 +27,7 @@ import java.util.*; +import com.oracle.graal.graph.*; import com.sun.c1x.*; import com.sun.c1x.alloc.Interval.*; import com.sun.c1x.debug.*; @@ -813,6 +814,7 @@ } TTY.println("preds=" + startBlock.blockPredecessors().size() + ", succs=" + startBlock.blockSuccessors().size()); + TTY.println("startBlock-ID: " + startBlock.blockID()); // bailout of if this occurs in product mode. throw new CiBailout("liveIn set of first block must be empty"); @@ -820,6 +822,7 @@ } private void reportFailure(int numBlocks) { + TTY.println(compilation.method.toString()); TTY.println("Error: liveIn set of first block must be empty (when this fails, variables are used before they are defined)"); TTY.print("affected registers:"); TTY.println(ir.startBlock.liveIn.toString()); @@ -831,6 +834,17 @@ Value instr = operand.isVariable() ? gen.operands.instructionForResult(((CiVariable) operand)) : null; TTY.println(" var %d (HIR instruction %s)", operandNum, instr == null ? " " : instr.toString()); + if (instr instanceof Phi) { + Phi phi = (Phi) instr; + TTY.println("phi block begin: " + phi.block()); + TTY.println("pred count on blockbegin: " + phi.block().predecessors().size()); + TTY.println("phi values: " + phi.valueCount()); + TTY.println("phi block preds:"); + for (Node n : phi.block().predecessors()) { + TTY.println(n.toString()); + } + } + for (int j = 0; j < numBlocks; j++) { LIRBlock block = blockAt(j); if (block.liveGen.get(operandNum)) {
--- a/graal/GraalCompiler/src/com/sun/c1x/gen/PhiSimplifier.java Wed May 25 19:29:40 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/gen/PhiSimplifier.java Wed May 25 20:03:05 2011 +0200 @@ -44,6 +44,11 @@ return x; } Phi phi = (Phi) x; + + if (phi.valueCount() == 1) { + return (Value) phi.replace(phi.valueAt(0)); + } + if (phi.checkFlag(Value.Flag.PhiCannotSimplify)) { // already tried, cannot simplify this phi return phi;
--- a/graal/GraalCompiler/src/com/sun/c1x/graph/GraphBuilder.java Wed May 25 19:29:40 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/graph/GraphBuilder.java Wed May 25 20:03:05 2011 +0200 @@ -421,7 +421,6 @@ FrameState stateWithException = entryState.duplicateModified(bci, CiKind.Void, exception); Instruction successor = createTarget(dispatchBlock, stateWithException); - //exception.appendNext(successor); BlockEnd end = new Goto(successor, graph); exception.appendNext(end);
--- a/graal/GraalGraph/src/com/oracle/graal/graph/Node.java Wed May 25 19:29:40 2011 +0200 +++ b/graal/GraalGraph/src/com/oracle/graal/graph/Node.java Wed May 25 20:03:05 2011 +0200 @@ -82,8 +82,8 @@ return getClass().getSimpleName(); } - public void replace(Node other) { - assert !isDeleted() && !other.isDeleted(); + public Node replace(Node other) { + assert !isDeleted() && (other == null || !other.isDeleted()); assert other == null || other.graph == graph; for (Node usage : usages) { usage.inputs.replaceFirstOccurrence(this, other); @@ -103,6 +103,7 @@ predecessors.clear(); predecessorsIndex.clear(); delete(); + return other; } public boolean isDeleted() {