# HG changeset patch # User Josef Eisl # Date 1434551847 -7200 # Node ID 5ab48fcf8fcd63380b3c1c72195e11ee3df3fade # Parent 7b09ae87afacc359b12aa1ba054e3ec49ce06b65 LIRTest: remove FloatingLIRTestNode. diff -r 7b09ae87afac -r 5ab48fcf8fcd graal/com.oracle.graal.lir.jtt/src/com/oracle/graal/lir/jtt/LIRTest.java --- a/graal/com.oracle.graal.lir.jtt/src/com/oracle/graal/lir/jtt/LIRTest.java Wed Jun 17 16:40:55 2015 +0200 +++ b/graal/com.oracle.graal.lir.jtt/src/com/oracle/graal/lir/jtt/LIRTest.java Wed Jun 17 16:37:27 2015 +0200 @@ -33,7 +33,6 @@ import com.oracle.graal.jtt.*; import com.oracle.graal.nodeinfo.*; import com.oracle.graal.nodes.*; -import com.oracle.graal.nodes.calc.*; import com.oracle.graal.nodes.spi.*; import com.oracle.jvmci.meta.*; @@ -46,52 +45,14 @@ public abstract class LIRTest extends JTTTest { @NodeInfo - private static final class FixedLIRTestNode extends FixedWithNextNode implements LIRLowerable { + private static final class LIRTestNode extends FixedWithNextNode implements LIRLowerable { - public static final NodeClass TYPE = NodeClass.create(FixedLIRTestNode.class); + public static final NodeClass TYPE = NodeClass.create(LIRTestNode.class); @Input protected ValueNode opsNode; @Input protected NodeInputList values; public final SnippetReflectionProvider snippetReflection; - public FixedLIRTestNode(SnippetReflectionProvider snippetReflection, ValueNode opsNode, ValueNode[] values) { - super(TYPE, StampFactory.forVoid()); - this.opsNode = opsNode; - this.values = new NodeInputList<>(this, values); - this.snippetReflection = snippetReflection; - } - - public NodeInputList values() { - return values; - } - - public ValueNode getLIROpsNode() { - return opsNode; - } - - @Override - public void generate(NodeLIRBuilderTool gen) { - LIRTestSpecification ops = getLIROperations(); - Stream v = values().stream().map(node -> gen.operand(node)); - - ops.generate(gen.getLIRGeneratorTool(), v.toArray(size -> new Value[size])); - } - - private LIRTestSpecification getLIROperations() { - assert getLIROpsNode().isConstant(); - LIRTestSpecification spec = snippetReflection.asObject(LIRTestSpecification.class, getLIROpsNode().asJavaConstant()); - return spec; - } - } - - @NodeInfo - private static final class FloatingLIRTestNode extends FloatingNode implements LIRLowerable { - - public static final NodeClass TYPE = NodeClass.create(FloatingLIRTestNode.class); - @Input protected ValueNode opsNode; - @Input protected NodeInputList values; - public final SnippetReflectionProvider snippetReflection; - - public FloatingLIRTestNode(SnippetReflectionProvider snippetReflection, Kind kind, ValueNode opsNode, ValueNode[] values) { + public LIRTestNode(SnippetReflectionProvider snippetReflection, Kind kind, ValueNode opsNode, ValueNode[] values) { super(TYPE, StampFactory.forKind(kind)); this.opsNode = opsNode; this.values = new NodeInputList<>(this, values); @@ -115,68 +76,41 @@ gen.setResult(this, ops.getResult()); } - private LIRTestSpecification getLIROperations() { + public LIRTestSpecification getLIROperations() { assert getLIROpsNode().isConstant(); LIRTestSpecification spec = snippetReflection.asObject(LIRTestSpecification.class, getLIROpsNode().asJavaConstant()); return spec; } } - private InvocationPlugin fixedLIRNodePlugin = new InvocationPlugin() { - public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver, ValueNode spec) { - b.add(new FixedLIRTestNode(getSnippetReflection(), spec, new ValueNode[]{})); - return true; - } - - public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver, ValueNode spec, ValueNode arg0) { - b.add(new FixedLIRTestNode(getSnippetReflection(), spec, new ValueNode[]{arg0})); - return true; - } - - public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver, ValueNode spec, ValueNode arg0, ValueNode arg1) { - b.add(new FixedLIRTestNode(getSnippetReflection(), spec, new ValueNode[]{arg0, arg1})); - return true; - } - - public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver, ValueNode spec, ValueNode arg0, ValueNode arg1, ValueNode arg2) { - b.add(new FixedLIRTestNode(getSnippetReflection(), spec, new ValueNode[]{arg0, arg1, arg2})); - return true; - } - - public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver, ValueNode spec, ValueNode arg0, ValueNode arg1, ValueNode arg2, ValueNode arg3) { - b.add(new FixedLIRTestNode(getSnippetReflection(), spec, new ValueNode[]{arg0, arg1, arg2, arg3})); - return true; - } - }; - - private InvocationPlugin floatingLIRNodePlugin = new InvocationPlugin() { + private final InvocationPlugin lirTestPlugin = new InvocationPlugin() { public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver, ValueNode spec) { Kind returnKind = targetMethod.getSignature().getReturnKind(); - b.addPush(returnKind, new FloatingLIRTestNode(getSnippetReflection(), returnKind, spec, new ValueNode[]{})); + b.addPush(returnKind, new LIRTestNode(getSnippetReflection(), returnKind, spec, new ValueNode[]{})); return true; } public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver, ValueNode spec, ValueNode arg0) { Kind returnKind = targetMethod.getSignature().getReturnKind(); - b.addPush(returnKind, new FloatingLIRTestNode(getSnippetReflection(), returnKind, spec, new ValueNode[]{arg0})); + b.addPush(returnKind, new LIRTestNode(getSnippetReflection(), returnKind, spec, new ValueNode[]{arg0})); return true; } public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver, ValueNode spec, ValueNode arg0, ValueNode arg1) { Kind returnKind = targetMethod.getSignature().getReturnKind(); - b.addPush(returnKind, new FloatingLIRTestNode(getSnippetReflection(), returnKind, spec, new ValueNode[]{arg0, arg1})); + b.addPush(returnKind, new LIRTestNode(getSnippetReflection(), returnKind, spec, new ValueNode[]{arg0, arg1})); return true; } public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver, ValueNode spec, ValueNode arg0, ValueNode arg1, ValueNode arg2) { Kind returnKind = targetMethod.getSignature().getReturnKind(); - b.addPush(returnKind, new FloatingLIRTestNode(getSnippetReflection(), returnKind, spec, new ValueNode[]{arg0, arg1, arg2})); + b.addPush(returnKind, new LIRTestNode(getSnippetReflection(), returnKind, spec, new ValueNode[]{arg0, arg1, arg2})); return true; } public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver, ValueNode spec, ValueNode arg0, ValueNode arg1, ValueNode arg2, ValueNode arg3) { Kind returnKind = targetMethod.getSignature().getReturnKind(); - b.addPush(returnKind, new FloatingLIRTestNode(getSnippetReflection(), returnKind, spec, new ValueNode[]{arg0, arg1, arg2, arg3})); + b.addPush(returnKind, new LIRTestNode(getSnippetReflection(), returnKind, spec, new ValueNode[]{arg0, arg1, arg2, arg3})); return true; } @@ -194,11 +128,7 @@ assert p.length > 0; assert LIRTestSpecification.class.isAssignableFrom(p[0]); - if (m.getReturnType().equals(void.class)) { - invocationPlugins.register(fixedLIRNodePlugin, c, m.getName(), p); - } else { - invocationPlugins.register(floatingLIRNodePlugin, c, m.getName(), p); - } + invocationPlugins.register(lirTestPlugin, c, m.getName(), p); } } return super.editGraphBuilderConfiguration(conf);