# HG changeset patch # User Josef Eisl # Date 1434552055 -7200 # Node ID 7b09ae87afacc359b12aa1ba054e3ec49ce06b65 # Parent 416e4e9d70fa3e77629187f6412ba014cc2cc58a LIRTest: move LIRTestSpecification into its own file. diff -r 416e4e9d70fa -r 7b09ae87afac 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 13:22:40 2015 +0200 +++ b/graal/com.oracle.graal.lir.jtt/src/com/oracle/graal/lir/jtt/LIRTest.java Wed Jun 17 16:40:55 2015 +0200 @@ -22,9 +22,6 @@ */ package com.oracle.graal.lir.jtt; -import com.oracle.jvmci.meta.ResolvedJavaMethod; -import com.oracle.jvmci.meta.Value; -import com.oracle.jvmci.meta.Kind; import java.lang.annotation.*; import java.lang.reflect.*; import java.util.stream.*; @@ -34,12 +31,11 @@ import com.oracle.graal.graph.*; import com.oracle.graal.graphbuilderconf.*; import com.oracle.graal.jtt.*; -import com.oracle.graal.lir.gen.*; 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.common.*; +import com.oracle.jvmci.meta.*; /** * Base class for LIR tests. @@ -49,66 +45,6 @@ */ public abstract class LIRTest extends JTTTest { - public abstract static class LIRTestSpecification { - private Value result; - - public void generate(LIRGeneratorTool gen) { - defaultHandler(gen); - } - - public void generate(LIRGeneratorTool gen, Value arg0) { - defaultHandler(gen, arg0); - } - - public void generate(LIRGeneratorTool gen, Value arg0, Value arg1) { - defaultHandler(gen, arg0, arg1); - } - - public void generate(LIRGeneratorTool gen, Value arg0, Value arg1, Value arg2) { - defaultHandler(gen, arg0, arg1, arg2); - } - - public void generate(LIRGeneratorTool gen, Value arg0, Value arg1, Value arg2, Value arg3) { - defaultHandler(gen, arg0, arg1, arg2, arg3); - } - - public void generate(LIRGeneratorTool gen, Value arg0, Value arg1, Value arg2, Value arg3, Value arg4) { - defaultHandler(gen, arg0, arg1, arg2, arg3, arg4); - } - - private static void defaultHandler(@SuppressWarnings("unused") LIRGeneratorTool gen, Value... args) { - throw new JVMCIError("LIRTestSpecification cannot handle generate() with %d arguments", args.length); - } - - void generate(LIRGeneratorTool gen, Value[] values) { - if (values.length == 0) { - generate(gen); - } else if (values.length == 1) { - generate(gen, values[0]); - } else if (values.length == 2) { - generate(gen, values[0], values[1]); - } else if (values.length == 3) { - generate(gen, values[0], values[1], values[2]); - } else if (values.length == 4) { - generate(gen, values[0], values[1], values[2], values[3]); - } else if (values.length == 5) { - generate(gen, values[0], values[1], values[2], values[3], values[4]); - } else { - JVMCIError.unimplemented(); - } - - } - - public void setResult(Value value) { - result = value; - } - - public Value getResult() { - assert result != null : "Result not set (using setResult())"; - return result; - } - } - @NodeInfo private static final class FixedLIRTestNode extends FixedWithNextNode implements LIRLowerable { diff -r 416e4e9d70fa -r 7b09ae87afac graal/com.oracle.graal.lir.jtt/src/com/oracle/graal/lir/jtt/LIRTestSpecification.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.graal.lir.jtt/src/com/oracle/graal/lir/jtt/LIRTestSpecification.java Wed Jun 17 16:40:55 2015 +0200 @@ -0,0 +1,87 @@ +/* + * Copyright (c) 2015, 2015, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.graal.lir.jtt; + +import com.oracle.graal.lir.gen.*; +import com.oracle.jvmci.common.*; +import com.oracle.jvmci.meta.*; + +public abstract class LIRTestSpecification { + private Value result; + + public void generate(LIRGeneratorTool gen) { + defaultHandler(gen); + } + + public void generate(LIRGeneratorTool gen, Value arg0) { + defaultHandler(gen, arg0); + } + + public void generate(LIRGeneratorTool gen, Value arg0, Value arg1) { + defaultHandler(gen, arg0, arg1); + } + + public void generate(LIRGeneratorTool gen, Value arg0, Value arg1, Value arg2) { + defaultHandler(gen, arg0, arg1, arg2); + } + + public void generate(LIRGeneratorTool gen, Value arg0, Value arg1, Value arg2, Value arg3) { + defaultHandler(gen, arg0, arg1, arg2, arg3); + } + + public void generate(LIRGeneratorTool gen, Value arg0, Value arg1, Value arg2, Value arg3, Value arg4) { + defaultHandler(gen, arg0, arg1, arg2, arg3, arg4); + } + + private static void defaultHandler(@SuppressWarnings("unused") LIRGeneratorTool gen, Value... args) { + throw new JVMCIError("LIRTestSpecification cannot handle generate() with %d arguments", args.length); + } + + void generate(LIRGeneratorTool gen, Value[] values) { + if (values.length == 0) { + generate(gen); + } else if (values.length == 1) { + generate(gen, values[0]); + } else if (values.length == 2) { + generate(gen, values[0], values[1]); + } else if (values.length == 3) { + generate(gen, values[0], values[1], values[2]); + } else if (values.length == 4) { + generate(gen, values[0], values[1], values[2], values[3]); + } else if (values.length == 5) { + generate(gen, values[0], values[1], values[2], values[3], values[4]); + } else { + JVMCIError.unimplemented(); + } + + } + + public void setResult(Value value) { + result = value; + } + + public Value getResult() { + assert result != null : "Result not set (using setResult())"; + return result; + } +}