# HG changeset patch # User Thomas Wuerthinger # Date 1306346585 -7200 # Node ID 6d14aa4fbf90c77d0ed776c891efeea123a2e621 # Parent 50677668afe363dba3a7b9da1436abd160c84c3d Gotos removed (except for exception dispatch chains and edge splitting). diff -r 50677668afe3 -r 6d14aa4fbf90 graal/GraalCompiler/src/com/sun/c1x/C1XOptions.java --- 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; diff -r 50677668afe3 -r 6d14aa4fbf90 graal/GraalCompiler/src/com/sun/c1x/alloc/LinearScan.java --- 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)) { diff -r 50677668afe3 -r 6d14aa4fbf90 graal/GraalCompiler/src/com/sun/c1x/gen/PhiSimplifier.java --- 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; diff -r 50677668afe3 -r 6d14aa4fbf90 graal/GraalCompiler/src/com/sun/c1x/graph/GraphBuilder.java --- 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); diff -r 50677668afe3 -r 6d14aa4fbf90 graal/GraalGraph/src/com/oracle/graal/graph/Node.java --- 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() {