# HG changeset patch # User Gilles Duboscq # Date 1332154520 -3600 # Node ID 5d0925455be19ae692c524f1cec341c8a83820f9 # Parent 56a53c80ad2bcb484b68f3d8f23226a0b1610878 Canonicalize some filter usages. Fix for graph printer's escape (escape invalid control chars). Small comment fixes diff -r 56a53c80ad2b -r 5d0925455be1 graal/com.oracle.graal.java/src/com/oracle/graal/java/FrameStateBuilder.java --- a/graal/com.oracle.graal.java/src/com/oracle/graal/java/FrameStateBuilder.java Fri Mar 16 19:30:11 2012 +0100 +++ b/graal/com.oracle.graal.java/src/com/oracle/graal/java/FrameStateBuilder.java Mon Mar 19 11:55:20 2012 +0100 @@ -22,19 +22,19 @@ */ package com.oracle.graal.java; +import static com.oracle.graal.graph.iterators.NodePredicates.*; import static com.oracle.graal.nodes.ValueUtil.*; import static java.lang.reflect.Modifier.*; import java.util.*; -import com.oracle.max.cri.ci.*; -import com.oracle.max.cri.ri.*; import com.oracle.graal.graph.*; import com.oracle.graal.graph.Node.Verbosity; -import com.oracle.graal.graph.iterators.*; import com.oracle.graal.nodes.*; import com.oracle.graal.nodes.PhiNode.PhiType; import com.oracle.graal.nodes.type.*; +import com.oracle.max.cri.ci.*; +import com.oracle.max.cri.ri.*; public class FrameStateBuilder { private final RiResolvedMethod method; @@ -169,7 +169,7 @@ } else if (block.isPhiAtMerge(currentValue)) { if (otherValue == null || currentValue.kind() != otherValue.kind()) { - deletePhi(currentValue); + deletePhi((PhiNode) currentValue); return null; } ((PhiNode) currentValue).addInput(otherValue); @@ -194,19 +194,19 @@ } } - private void deletePhi(Node phi) { + private void deletePhi(PhiNode phi) { if (phi.isDeleted()) { return; } // Collect all phi functions that use this phi so that we can delete them recursively (after we delete ourselfs to avoid circles). - List phiUsages = phi.usages().filter(NodePredicates.isA(PhiNode.class)).snapshot(); + List phiUsages = phi.usages().filter(PhiNode.class).snapshot(); // Remove the phi function from all FrameStates where it is used and then delete it. - assert phi.usages().filter(NodePredicates.isNotA(FrameState.class)).filter(NodePredicates.isNotA(PhiNode.class)).isEmpty() : "phi function that gets deletes must only be used in frame states"; + assert phi.usages().filter(isNotA(FrameState.class).nor(PhiNode.class)).isEmpty() : "phi function that gets deletes must only be used in frame states"; phi.replaceAtUsages(null); phi.safeDelete(); - for (Node phiUsage : phiUsages) { + for (PhiNode phiUsage : phiUsages) { deletePhi(phiUsage); } } diff -r 56a53c80ad2b -r 5d0925455be1 graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderPhase.java --- a/graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderPhase.java Fri Mar 16 19:30:11 2012 +0100 +++ b/graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderPhase.java Mon Mar 19 11:55:20 2012 +0100 @@ -190,7 +190,7 @@ connectLoopEndToBegin(); - // remove Placeholders (except for loop exits) + // remove Placeholders for (BlockPlaceholderNode n : currentGraph.getNodes(BlockPlaceholderNode.class)) { currentGraph.removeFixed(n); } @@ -1340,7 +1340,7 @@ currentGraph.reduceDegenerateLoopBegin(begin); } else { // Delete unnecessary loop phi functions, i.e., phi functions where all inputs are either the same or the phi itself. - for (PhiNode phi : begin.stateAfter().values().filter(PhiNode.class).snapshot()) { + for (PhiNode phi : begin.phis().snapshot()) { checkRedundantPhi(phi); } } diff -r 56a53c80ad2b -r 5d0925455be1 graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/loop/LoopInline.java --- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/loop/LoopInline.java Fri Mar 16 19:30:11 2012 +0100 +++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/loop/LoopInline.java Mon Mar 19 11:55:20 2012 +0100 @@ -24,9 +24,6 @@ import org.junit.*; -/* - * This test is meaningful only if you run it with 'forced' inlinning because running it in the harness with -Xcomp will not trigger any normal inlining - */ public class LoopInline { public static int test(int arg) { diff -r 56a53c80ad2b -r 5d0925455be1 graal/com.oracle.graal.printer/src/com/oracle/graal/printer/BasicIdealGraphPrinter.java --- a/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/BasicIdealGraphPrinter.java Fri Mar 16 19:30:11 2012 +0100 +++ b/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/BasicIdealGraphPrinter.java Mon Mar 19 11:55:20 2012 +0100 @@ -297,6 +297,20 @@ assert false; } break; + case '\u0000': case '\u0001': case '\u0002': case '\u0003': + case '\u0004': case '\u0005': case '\u0006': case '\u0007': + case '\u0008': case '\u000b': case '\u000c': case '\u000e': + case '\u000f': case '\u0010': case '\u0011': case '\u0012': + case '\u0013': case '\u0014': case '\u0015': case '\u0016': + case '\u0017': case '\u0018': case '\u0019': case '\u001a': + case '\u001b': case '\u001c': case '\u001d': case '\u001e': + case '\u001f': + if (str == null) { + str = new StringBuilder(); + str.append(s, 0, i); + } + str.append("'0x").append(Integer.toHexString(c)); + break; default: if (str != null) { str.append(c);