# HG changeset patch # User Lukas Stadler # Date 1327682166 -3600 # Node ID 5caca26cb1b9837823f484f38ed70c24145683e2 # Parent 15ec30809d0f3cfcd5b3ca985f114db96c9deb24 small fix (missing changes) diff -r 15ec30809d0f -r 5caca26cb1b9 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/gen/LIRGenerator.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/gen/LIRGenerator.java Fri Jan 27 17:28:24 2012 +0100 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/gen/LIRGenerator.java Fri Jan 27 17:36:06 2012 +0100 @@ -645,7 +645,7 @@ if (writeBarrier != null) { emitXir(writeBarrier, null, null, false); } - } + } @SuppressWarnings("unused") protected void preGCWriteBarrier(CiValue addrOpr, boolean patch, LIRDebugInfo info) { @@ -749,7 +749,7 @@ private void emitInstanceOfBranch(InstanceOfNode x, LabelRef trueSuccessor, LabelRef falseSuccessor, LIRDebugInfo info) { XirArgument obj = toXirArgument(x.object()); XirSnippet snippet = xir.genInstanceOf(site(x), obj, toXirArgument(x.targetClassInstruction()), x.targetClass()); - emitXir(snippet, x, info, null, false, x.negated ? falseSuccessor : trueSuccessor, x.negated ? trueSuccessor : falseSuccessor); + emitXir(snippet, x, info, null, false, x.negated() ? falseSuccessor : trueSuccessor, x.negated() ? trueSuccessor : falseSuccessor); } @@ -791,8 +791,8 @@ private Variable emitInstanceOfConditional(InstanceOfNode x, CiValue trueValue, CiValue falseValue) { XirArgument obj = toXirArgument(x.object()); - XirArgument trueArg = toXirArgument(x.negated ? falseValue : trueValue); - XirArgument falseArg = toXirArgument(x.negated ? trueValue : falseValue); + XirArgument trueArg = toXirArgument(x.negated() ? falseValue : trueValue); + XirArgument falseArg = toXirArgument(x.negated() ? trueValue : falseValue); XirSnippet snippet = xir.genMaterializeInstanceOf(site(x), obj, toXirArgument(x.targetClassInstruction()), trueArg, falseArg, x.targetClass()); return (Variable) emitXir(snippet, null, null, false); } diff -r 15ec30809d0f -r 5caca26cb1b9 graal/com.oracle.max.graal.tests/src/com/oracle/max/graal/compiler/tests/GraphTest.java --- a/graal/com.oracle.max.graal.tests/src/com/oracle/max/graal/compiler/tests/GraphTest.java Fri Jan 27 17:28:24 2012 +0100 +++ b/graal/com.oracle.max.graal.tests/src/com/oracle/max/graal/compiler/tests/GraphTest.java Fri Jan 27 17:36:06 2012 +0100 @@ -94,7 +94,31 @@ found = m; } } - return parse(found); + if (found != null) { + return parse(found); + } else { + throw new RuntimeException("method not found: " + methodName); + } + } + + /** + * Parses a Java method to produce a graph. + * + * @param methodName the name of the method in {@code this.getClass()} to be parsed + */ + protected StructuredGraph parseProfiled(String methodName) { + Method found = null; + for (Method m : this.getClass().getMethods()) { + if (m.getName().equals(methodName)) { + Assert.assertNull(found); + found = m; + } + } + if (found != null) { + return parseProfiled(found); + } else { + throw new RuntimeException("method not found: " + methodName); + } } /** @@ -107,6 +131,16 @@ return graph; } + /** + * Parses a Java method to produce a graph. + */ + protected StructuredGraph parseProfiled(Method m) { + RiResolvedMethod riMethod = runtime.getRiMethod(m); + StructuredGraph graph = new StructuredGraph(riMethod); + new GraphBuilderPhase(runtime, GraphBuilderConfiguration.getDefault()).apply(graph); + return graph; + } + protected PhasePlan getDefaultPhasePlan() { PhasePlan plan = new PhasePlan(); plan.addPhase(PhasePosition.AFTER_PARSING, new GraphBuilderPhase(runtime, GraphBuilderConfiguration.getSnippetDefault()));