Mercurial > hg > truffle
changeset 4340:5caca26cb1b9
small fix (missing changes)
author | Lukas Stadler <lukas.stadler@jku.at> |
---|---|
date | Fri, 27 Jan 2012 17:36:06 +0100 |
parents | 15ec30809d0f |
children | 1bd28959b8b8 b197bbb58d2f |
files | graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/gen/LIRGenerator.java graal/com.oracle.max.graal.tests/src/com/oracle/max/graal/compiler/tests/GraphTest.java |
diffstat | 2 files changed, 39 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- 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); }
--- 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()));