# HG changeset patch # User Thomas Wuerthinger # Date 1307455148 -7200 # Node ID c6af2af32b3d1a03fea05903e260612a91b11b17 # Parent 3a4ad04d60a16494ab11e59a1a6f3fcabce646ef# Parent a0c066ff81adf08e4cd62ef6df2b93243b8e8b31 Merge. diff -r 3a4ad04d60a1 -r c6af2af32b3d graal/GraalCompiler/src/com/oracle/max/graal/opt/CanonicalizerPhase.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/GraalCompiler/src/com/oracle/max/graal/opt/CanonicalizerPhase.java Tue Jun 07 15:59:08 2011 +0200 @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2011, 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.max.graal.opt; + +import com.oracle.graal.graph.*; + +public class CanonicalizerPhase extends Phase { + + + @Override + protected void run(Graph graph) { + // TODO Auto-generated method stub + + } + + public interface CanonicalizerOp extends Op { + Node canonical(Node node); + } +} diff -r 3a4ad04d60a1 -r c6af2af32b3d graal/GraalCompiler/src/com/oracle/max/graal/schedule/Schedule.java --- a/graal/GraalCompiler/src/com/oracle/max/graal/schedule/Schedule.java Tue Jun 07 15:56:21 2011 +0200 +++ b/graal/GraalCompiler/src/com/oracle/max/graal/schedule/Schedule.java Tue Jun 07 15:59:08 2011 +0200 @@ -82,7 +82,7 @@ } private static boolean isCFG(Node n) { - return n != null && ((n instanceof Instruction) || n == n.graph().start()); + return n != null && ((n instanceof FixedNode) || n == n.graph().start()); } public static boolean isBlockEnd(Node n) { diff -r 3a4ad04d60a1 -r c6af2af32b3d graal/GraalCompiler/src/com/sun/c1x/C1XCompilation.java --- a/graal/GraalCompiler/src/com/sun/c1x/C1XCompilation.java Tue Jun 07 15:56:21 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/C1XCompilation.java Tue Jun 07 15:59:08 2011 +0200 @@ -25,13 +25,12 @@ import java.util.*; -import com.oracle.graal.graph.*; import com.oracle.max.asm.*; import com.sun.c1x.alloc.*; import com.sun.c1x.asm.*; import com.sun.c1x.debug.*; import com.sun.c1x.gen.*; -import com.sun.c1x.gen.LIRGenerator.*; +import com.sun.c1x.gen.LIRGenerator.DeoptimizationStub; import com.sun.c1x.graph.*; import com.sun.c1x.lir.*; import com.sun.c1x.observer.*; diff -r 3a4ad04d60a1 -r c6af2af32b3d graal/GraalCompiler/src/com/sun/c1x/gen/LIRGenerator.java --- a/graal/GraalCompiler/src/com/sun/c1x/gen/LIRGenerator.java Tue Jun 07 15:56:21 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/gen/LIRGenerator.java Tue Jun 07 15:59:08 2011 +0200 @@ -42,7 +42,6 @@ import com.sun.c1x.lir.*; import com.sun.c1x.util.*; import com.sun.c1x.value.*; -import com.sun.cri.bytecode.*; import com.sun.cri.bytecode.Bytecodes.MemoryBarriers; import com.sun.cri.ci.*; import com.sun.cri.ri.*; @@ -426,7 +425,7 @@ } @Override - public void visitIfOp(IfOp i) { + public void visitIfOp(Conditional i) { Value x = i.x(); Value y = i.y(); CiKind xtype = x.kind; @@ -1397,7 +1396,7 @@ protected void preGCWriteBarrier(CiValue addrOpr, boolean patch, LIRDebugInfo info) { } - protected void setNoResult(Instruction x) { + protected void setNoResult(Value x) { x.clearOperand(); } @@ -1590,10 +1589,6 @@ } public boolean isNonNull(XirArgument argument) { - if (argument.constant == null && argument.object instanceof LIRItem) { - // check the flag on the original value - return ((LIRItem) argument.object).instruction.isNonNull(); - } return false; } diff -r 3a4ad04d60a1 -r c6af2af32b3d graal/GraalCompiler/src/com/sun/c1x/graph/GraphBuilder.java --- a/graal/GraalCompiler/src/com/sun/c1x/graph/GraphBuilder.java Tue Jun 07 15:56:21 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/graph/GraphBuilder.java Tue Jun 07 15:59:08 2011 +0200 @@ -543,30 +543,41 @@ private void genArithmeticOp(CiKind result, int opcode, CiKind x, CiKind y, boolean canTrap) { Value yValue = frameState.pop(y); Value xValue = frameState.pop(x); - Value result1 = append(new ArithmeticOp(opcode, result, xValue, yValue, isStrict(method.accessFlags()), canTrap, graph)); + Value result1 = append(new Arithmetic(opcode, result, xValue, yValue, isStrict(method.accessFlags()), canTrap, graph)); frameState.push(result, result1); } private void genNegateOp(CiKind kind) { - frameState.push(kind, append(new NegateOp(frameState.pop(kind), graph))); + frameState.push(kind, append(new Negate(frameState.pop(kind), graph))); } private void genShiftOp(CiKind kind, int opcode) { Value s = frameState.ipop(); Value x = frameState.pop(kind); - frameState.push(kind, append(new ShiftOp(opcode, x, s, graph))); + frameState.push(kind, append(new Shift(opcode, x, s, graph))); } private void genLogicOp(CiKind kind, int opcode) { Value y = frameState.pop(kind); Value x = frameState.pop(kind); - frameState.push(kind, append(new LogicOp(opcode, x, y, graph))); + Logic v; + switch(opcode){ + case IAND: + case LAND: v = new And(kind, x, y, graph); break; + case IOR: + case LOR: v = new Or(kind, x, y, graph); break; + case IXOR: + case LXOR: v = new Xor(kind, x, y, graph); break; + default: + throw new CiBailout("should not reach"); + } + frameState.push(kind, append(v)); } private void genCompareOp(CiKind kind, int opcode, CiKind resultKind) { Value y = frameState.pop(kind); Value x = frameState.pop(kind); - Value value = append(new CompareOp(opcode, resultKind, x, y, graph)); + Value value = append(new Compare(opcode, resultKind, x, y, graph)); if (!resultKind.isVoid()) { frameState.ipush(value); } @@ -582,7 +593,7 @@ int delta = stream().readIncrement(); Value x = frameState.localAt(index); Value y = append(Constant.forInt(delta, graph)); - frameState.storeLocal(index, append(new ArithmeticOp(IADD, CiKind.Int, x, y, isStrict(method.accessFlags()), false, graph))); + frameState.storeLocal(index, append(new Arithmetic(IADD, CiKind.Int, x, y, isStrict(method.accessFlags()), false, graph))); } private void genGoto(int fromBCI, int toBCI) { diff -r 3a4ad04d60a1 -r c6af2af32b3d graal/GraalCompiler/src/com/sun/c1x/ir/Anchor.java --- a/graal/GraalCompiler/src/com/sun/c1x/ir/Anchor.java Tue Jun 07 15:56:21 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/ir/Anchor.java Tue Jun 07 15:59:08 2011 +0200 @@ -58,7 +58,6 @@ @Override public Node copy(Graph into) { Anchor x = new Anchor(null, into); - x.setNonNull(isNonNull()); return x; } } diff -r 3a4ad04d60a1 -r c6af2af32b3d graal/GraalCompiler/src/com/sun/c1x/ir/And.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/GraalCompiler/src/com/sun/c1x/ir/And.java Tue Jun 07 15:59:08 2011 +0200 @@ -0,0 +1,111 @@ +/* + * Copyright (c) 2011, 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.sun.c1x.ir; + +import com.oracle.graal.graph.*; +import com.oracle.max.graal.opt.CanonicalizerPhase.CanonicalizerOp; +import com.sun.cri.bytecode.*; +import com.sun.cri.ci.*; + +public final class And extends Logic { + private static final AndCanonicalizerOp CANONICALIZER = new AndCanonicalizerOp(); + + /** + * @param opcode + * @param x + * @param y + * @param graph + */ + public And(CiKind kind, Value x, Value y, Graph graph) { + super(kind, kind == CiKind.Int ? Bytecodes.IAND : Bytecodes.LAND, x, y, graph); + } + + @Override + public String shortName() { + return "&"; + } + + @Override + public Node copy(Graph into) { + And x = new And(kind, x(), y(), graph()); + return x; + } + + @SuppressWarnings("unchecked") + @Override + public T lookup(Class clazz) { + if (clazz == CanonicalizerOp.class) { + return (T) CANONICALIZER; + } + return super.lookup(clazz); + } + + private static class AndCanonicalizerOp implements CanonicalizerOp { + @Override + public Node canonical(Node node) { + assert node instanceof And; + And and = (And) node; + CiKind kind = and.kind; + Graph graph = and.graph(); + Value x = and.x(); + Value y = and.y(); + if (x == y) { + return x; + } + if (x.isConstant() && !y.isConstant()) { + and.swapOperands(); + Value t = y; + y = x; + x = t; + } + if (x.isConstant()) { + if (kind == CiKind.Int) { + return Constant.forInt(x.asConstant().asInt() & y.asConstant().asInt(), graph); + } else { + assert kind == CiKind.Long; + return Constant.forLong(x.asConstant().asLong() & y.asConstant().asLong(), graph); + } + } else if (y.isConstant()) { + if (kind == CiKind.Int) { + int c = y.asConstant().asInt(); + if (c == -1) { + return x; + } + if (c == 0) { + return Constant.forInt(0, graph); + } + } else { + assert kind == CiKind.Long; + long c = y.asConstant().asLong(); + if (c == -1) { + return x; + } + if (c == 0) { + return Constant.forLong(0, graph); + } + } + } + return and; + } + } +} diff -r 3a4ad04d60a1 -r c6af2af32b3d graal/GraalCompiler/src/com/sun/c1x/ir/Arithmetic.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/GraalCompiler/src/com/sun/c1x/ir/Arithmetic.java Tue Jun 07 15:59:08 2011 +0200 @@ -0,0 +1,88 @@ +/* + * Copyright (c) 2009, 2011, 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.sun.c1x.ir; + +import com.oracle.graal.graph.*; +import com.sun.c1x.debug.*; +import com.sun.cri.bytecode.*; +import com.sun.cri.ci.*; + +/** + * The {@code ArithmeticOp} class represents arithmetic operations such as addition, subtraction, etc. + */ +public final class Arithmetic extends Binary { + + private static final int INPUT_COUNT = 0; + private static final int SUCCESSOR_COUNT = 0; + + private final boolean canTrap; + private final boolean isStrictFP; + + /** + * Creates a new arithmetic operation. + * @param opcode the bytecode opcode + * @param kind the result kind of the operation + * @param x the first input instruction + * @param y the second input instruction + * @param isStrictFP indicates this operation has strict rounding semantics + * @param stateBefore the state for instructions that may trap + */ + public Arithmetic(int opcode, CiKind kind, Value x, Value y, boolean isStrictFP, boolean canTrap, Graph graph) { + super(kind, opcode, x, y, INPUT_COUNT, SUCCESSOR_COUNT, graph); + this.isStrictFP = isStrictFP; + this.canTrap = canTrap; + } + + /** + * Checks whether this instruction has strict fp semantics. + * @return {@code true} if this instruction has strict fp semantics + */ + public boolean isStrictFP() { + return isStrictFP; + } + + @Override + public void accept(ValueVisitor v) { + v.visitArithmetic(this); + } + + public boolean isCommutative() { + return Bytecodes.isCommutative(opcode); + } + + @Override + public void print(LogStream out) { + out.print(x()).print(' ').print(Bytecodes.operator(opcode)).print(' ').print(y()); + } + + @Override + public String shortName() { + return Bytecodes.operator(opcode); + } + + @Override + public Node copy(Graph into) { + Arithmetic x = new Arithmetic(opcode, kind, null, null, isStrictFP, canTrap, into); + return x; + } +} diff -r 3a4ad04d60a1 -r c6af2af32b3d graal/GraalCompiler/src/com/sun/c1x/ir/ArithmeticOp.java --- a/graal/GraalCompiler/src/com/sun/c1x/ir/ArithmeticOp.java Tue Jun 07 15:56:21 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,89 +0,0 @@ -/* - * Copyright (c) 2009, 2011, 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.sun.c1x.ir; - -import com.oracle.graal.graph.*; -import com.sun.c1x.debug.*; -import com.sun.cri.bytecode.*; -import com.sun.cri.ci.*; - -/** - * The {@code ArithmeticOp} class represents arithmetic operations such as addition, subtraction, etc. - */ -public final class ArithmeticOp extends Op2 { - - private static final int INPUT_COUNT = 0; - private static final int SUCCESSOR_COUNT = 0; - - private final boolean canTrap; - private final boolean isStrictFP; - - /** - * Creates a new arithmetic operation. - * @param opcode the bytecode opcode - * @param kind the result kind of the operation - * @param x the first input instruction - * @param y the second input instruction - * @param isStrictFP indicates this operation has strict rounding semantics - * @param stateBefore the state for instructions that may trap - */ - public ArithmeticOp(int opcode, CiKind kind, Value x, Value y, boolean isStrictFP, boolean canTrap, Graph graph) { - super(kind, opcode, x, y, INPUT_COUNT, SUCCESSOR_COUNT, graph); - this.isStrictFP = isStrictFP; - this.canTrap = canTrap; - } - - /** - * Checks whether this instruction has strict fp semantics. - * @return {@code true} if this instruction has strict fp semantics - */ - public boolean isStrictFP() { - return isStrictFP; - } - - @Override - public void accept(ValueVisitor v) { - v.visitArithmeticOp(this); - } - - public boolean isCommutative() { - return Bytecodes.isCommutative(opcode); - } - - @Override - public void print(LogStream out) { - out.print(x()).print(' ').print(Bytecodes.operator(opcode)).print(' ').print(y()); - } - - @Override - public String shortName() { - return Bytecodes.operator(opcode); - } - - @Override - public Node copy(Graph into) { - ArithmeticOp x = new ArithmeticOp(opcode, kind, null, null, isStrictFP, canTrap, into); - x.setNonNull(isNonNull()); - return x; - } -} diff -r 3a4ad04d60a1 -r c6af2af32b3d graal/GraalCompiler/src/com/sun/c1x/ir/ArrayLength.java --- a/graal/GraalCompiler/src/com/sun/c1x/ir/ArrayLength.java Tue Jun 07 15:56:21 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/ir/ArrayLength.java Tue Jun 07 15:59:08 2011 +0200 @@ -31,7 +31,7 @@ /** * The {@code ArrayLength} instruction gets the length of an array. */ -public final class ArrayLength extends Value { +public final class ArrayLength extends FloatingNode { private static final int INPUT_COUNT = 1; private static final int INPUT_ARRAY = 0; @@ -96,7 +96,6 @@ @Override public Node copy(Graph into) { ArrayLength x = new ArrayLength(null, into); - x.setNonNull(isNonNull()); return x; } } diff -r 3a4ad04d60a1 -r c6af2af32b3d graal/GraalCompiler/src/com/sun/c1x/ir/Binary.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/GraalCompiler/src/com/sun/c1x/ir/Binary.java Tue Jun 07 15:59:08 2011 +0200 @@ -0,0 +1,115 @@ +/* + * Copyright (c) 2009, 2011, 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.sun.c1x.ir; + +import com.oracle.graal.graph.*; +import com.sun.c1x.util.*; +import com.sun.cri.bytecode.*; +import com.sun.cri.ci.*; + +/** + * The {@code Op2} class is the base of arithmetic and logic operations with two inputs. + */ +public abstract class Binary extends FloatingNode { + + private static final int INPUT_COUNT = 2; + private static final int INPUT_X = 0; + private static final int INPUT_Y = 1; + + private static final int SUCCESSOR_COUNT = 0; + + @Override + protected int inputCount() { + return super.inputCount() + INPUT_COUNT; + } + + @Override + protected int successorCount() { + return super.successorCount() + SUCCESSOR_COUNT; + } + + /** + * The first input to this instruction. + */ + public Value x() { + return (Value) inputs().get(super.inputCount() + INPUT_X); + } + + public Value setX(Value n) { + return (Value) inputs().set(super.inputCount() + INPUT_X, n); + } + + /** + * The second input to this instruction. + */ + public Value y() { + return (Value) inputs().get(super.inputCount() + INPUT_Y); + } + + public Value setY(Value n) { + return (Value) inputs().set(super.inputCount() + INPUT_Y, n); + } + + /** + * The opcode of this instruction. + */ + public final int opcode; + + /** + * Creates a new Op2 instance. + * @param kind the result type of this instruction + * @param opcode the bytecode opcode + * @param x the first input instruction + * @param y the second input instruction + */ + public Binary(CiKind kind, int opcode, Value x, Value y, int inputCount, int successorCount, Graph graph) { + super(kind, inputCount + INPUT_COUNT, successorCount + SUCCESSOR_COUNT, graph); + this.opcode = opcode; + setX(x); + setY(y); + } + + /** + * Swaps the operands of this instruction. This is only legal for commutative operations. + */ + public void swapOperands() { + assert Bytecodes.isCommutative(opcode); + Value t = x(); + setX(y()); + setY(t); + } + + @Override + public int valueNumber() { + return Util.hash2(opcode, x(), y()); + } + + @Override + public boolean valueEqual(Node i) { + if (i instanceof Binary) { + Binary o = (Binary) i; + return opcode == o.opcode && x() == o.x() && y() == o.y(); + } + return false; + } +} diff -r 3a4ad04d60a1 -r c6af2af32b3d graal/GraalCompiler/src/com/sun/c1x/ir/CheckCast.java --- a/graal/GraalCompiler/src/com/sun/c1x/ir/CheckCast.java Tue Jun 07 15:56:21 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/ir/CheckCast.java Tue Jun 07 15:59:08 2011 +0200 @@ -46,7 +46,6 @@ */ public CheckCast(RiType targetClass, Value targetClassInstruction, Value object, Graph graph) { super(targetClass, targetClassInstruction, object, CiKind.Object, INPUT_COUNT, SUCCESSOR_COUNT, graph); - setNonNull(true); } /** @@ -99,7 +98,6 @@ @Override public Node copy(Graph into) { CheckCast x = new CheckCast(targetClass, null, null, into); - x.setNonNull(isNonNull()); return x; } } diff -r 3a4ad04d60a1 -r c6af2af32b3d graal/GraalCompiler/src/com/sun/c1x/ir/Compare.java --- a/graal/GraalCompiler/src/com/sun/c1x/ir/Compare.java Tue Jun 07 15:56:21 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/ir/Compare.java Tue Jun 07 15:59:08 2011 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2011, 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 @@ -24,118 +24,45 @@ import com.oracle.graal.graph.*; import com.sun.c1x.debug.*; -import com.sun.c1x.util.*; +import com.sun.cri.bytecode.*; import com.sun.cri.ci.*; -public final class Compare extends Value { - - private static final int INPUT_COUNT = 2; - private static final int INPUT_X = 0; - private static final int INPUT_Y = 1; - - private static final int SUCCESSOR_COUNT = 0; - - @Override - protected int inputCount() { - return super.inputCount() + INPUT_COUNT; - } +/** + * The {@code CompareOp} instruction represents comparisons such as equals, not equal, etc. + */ +public final class Compare extends Binary { - @Override - protected int successorCount() { - return super.successorCount() + SUCCESSOR_COUNT; - } - - /** - * The instruction that produces the first input to this comparison. - */ - public Value x() { - return (Value) inputs().get(super.inputCount() + INPUT_X); - } - - public Value setX(Value n) { - return (Value) inputs().set(super.inputCount() + INPUT_X, n); - } + private static final int INPUT_COUNT = 0; + private static final int SUCCESSOR_COUNT = 0; /** - * The instruction that produces the second input to this comparison. - */ - public Value y() { - return (Value) inputs().get(super.inputCount() + INPUT_Y); - } - - public Value setY(Value n) { - return (Value) inputs().set(super.inputCount() + INPUT_Y, n); - } - - Condition condition; - boolean unorderedIsTrue; - - /** - * Constructs a new If instruction. - * @param x the instruction producing the first input to the instruction - * @param condition the condition (comparison operation) - * @param y the instruction that produces the second input to this instruction - * @param graph + * Creates a new compare operation. + * @param opcode the bytecode opcode + * @param kind the result kind + * @param x the first input + * @param y the second input */ - public Compare(Value x, Condition condition, Value y, Graph graph) { - super(CiKind.Illegal, INPUT_COUNT, SUCCESSOR_COUNT, graph); - assert (x == null && y == null) || Util.archKindsEqual(x, y); - this.condition = condition; - setX(x); - setY(y); - } - - /** - * Gets the condition (comparison operation) for this instruction. - * @return the condition - */ - public Condition condition() { - return condition; - } - - /** - * Checks whether unordered inputs mean true or false. - * @return {@code true} if unordered inputs produce true - */ - public boolean unorderedIsTrue() { - return unorderedIsTrue; - } - - /** - * Swaps the operands to this if and reverses the condition (e.g. > goes to <=). - * @see Condition#mirror() - */ - public void swapOperands() { - condition = condition.mirror(); - Value t = x(); - setX(y()); - setY(t); + public Compare(int opcode, CiKind kind, Value x, Value y, Graph graph) { + super(kind, opcode, x, y, INPUT_COUNT, SUCCESSOR_COUNT, graph); } @Override public void accept(ValueVisitor v) { + v.visitCompare(this); } @Override public void print(LogStream out) { - out.print("comp "). - print(x()). - print(' '). - print(condition().operator). - print(' '). - print(y()); - } - - @Override - public String shortName() { - return "Comp " + condition.operator; + out.print(x()). + print(' '). + print(Bytecodes.operator(opcode)). + print(' '). + print(y()); } @Override public Node copy(Graph into) { - Compare x = new Compare(null, condition, null, into); - x.unorderedIsTrue = unorderedIsTrue; - x.setNonNull(isNonNull()); + Compare x = new Compare(opcode, kind, null, null, into); return x; } } diff -r 3a4ad04d60a1 -r c6af2af32b3d graal/GraalCompiler/src/com/sun/c1x/ir/CompareOp.java --- a/graal/GraalCompiler/src/com/sun/c1x/ir/CompareOp.java Tue Jun 07 15:56:21 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2009, 2011, 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.sun.c1x.ir; - -import com.oracle.graal.graph.*; -import com.sun.c1x.debug.*; -import com.sun.cri.bytecode.*; -import com.sun.cri.ci.*; - -/** - * The {@code CompareOp} instruction represents comparisons such as equals, not equal, etc. - */ -public final class CompareOp extends Op2 { - - private static final int INPUT_COUNT = 0; - private static final int SUCCESSOR_COUNT = 0; - - /** - * Creates a new compare operation. - * @param opcode the bytecode opcode - * @param kind the result kind - * @param x the first input - * @param y the second input - */ - public CompareOp(int opcode, CiKind kind, Value x, Value y, Graph graph) { - super(kind, opcode, x, y, INPUT_COUNT, SUCCESSOR_COUNT, graph); - } - - @Override - public void accept(ValueVisitor v) { - v.visitCompareOp(this); - } - - @Override - public void print(LogStream out) { - out.print(x()). - print(' '). - print(Bytecodes.operator(opcode)). - print(' '). - print(y()); - } - - @Override - public Node copy(Graph into) { - CompareOp x = new CompareOp(opcode, kind, null, null, into); - x.setNonNull(isNonNull()); - return x; - } -} diff -r 3a4ad04d60a1 -r c6af2af32b3d graal/GraalCompiler/src/com/sun/c1x/ir/Conditional.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/GraalCompiler/src/com/sun/c1x/ir/Conditional.java Tue Jun 07 15:59:08 2011 +0200 @@ -0,0 +1,155 @@ +/* + * Copyright (c) 2009, 2011, 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.sun.c1x.ir; + +import com.oracle.graal.graph.*; +import com.sun.c1x.debug.*; +import com.sun.c1x.util.*; +import com.sun.cri.bytecode.*; +import com.sun.cri.ci.*; + +/** + * The {@code IfOp} class represents a comparison that yields one of two values. + * Note that these nodes are not built directly from the bytecode but are introduced + * by conditional expression elimination. + */ +public final class Conditional extends Binary { + + private static final int INPUT_COUNT = 2; + private static final int INPUT_TRUE_VALUE = 0; + private static final int INPUT_FALSE_VALUE = 1; + + private static final int SUCCESSOR_COUNT = 0; + + @Override + protected int inputCount() { + return super.inputCount() + INPUT_COUNT; + } + + @Override + protected int successorCount() { + return super.successorCount() + SUCCESSOR_COUNT; + } + + + /** + * The instruction that produces the value if the comparison is true. + */ + public Value trueValue() { + return (Value) inputs().get(super.inputCount() + INPUT_TRUE_VALUE); + } + + public Value setTrueValue(Value n) { + return (Value) inputs().set(super.inputCount() + INPUT_TRUE_VALUE, n); + } + + /** + * The instruction that produces the value if the comparison is false. + */ + public Value falseValue() { + return (Value) inputs().get(super.inputCount() + INPUT_FALSE_VALUE); + } + + public Value setFalseValue(Value n) { + return (Value) inputs().set(super.inputCount() + INPUT_FALSE_VALUE, n); + } + + + Condition condition; + + /** + * Constructs a new IfOp. + * @param x the instruction producing the first value to be compared + * @param condition the condition of the comparison + * @param y the instruction producing the second value to be compared + * @param trueValue the value produced if the condition is true + * @param falseValue the value produced if the condition is false + */ + public Conditional(Value x, Condition condition, Value y, Value trueValue, Value falseValue, Graph graph) { + // TODO: return the appropriate bytecode IF_ICMPEQ, etc + super(trueValue.kind.meet(falseValue.kind), Bytecodes.ILLEGAL, x, y, INPUT_COUNT, SUCCESSOR_COUNT, graph); + this.condition = condition; + setTrueValue(trueValue); + setFalseValue(falseValue); + } + + // for copying + private Conditional(CiKind kind, Condition cond, Graph graph) { + super(kind, Bytecodes.ILLEGAL, null, null, INPUT_COUNT, SUCCESSOR_COUNT, graph); + this.condition = cond; + } + + /** + * Gets the condition of this if operation. + * @return the condition + */ + public Condition condition() { + return condition; + } + + /** + * Checks whether this comparison operator is commutative (i.e. it is either == or !=). + * @return {@code true} if this comparison is commutative + */ + public boolean isCommutative() { + return condition == Condition.EQ || condition == Condition.NE; + } + + @Override + public void accept(ValueVisitor v) { + v.visitIfOp(this); + } + + @Override + public int valueNumber() { + return Util.hash4(condition.hashCode(), x(), y(), trueValue(), falseValue()); + } + + @Override + public boolean valueEqual(Node i) { + if (i instanceof Conditional) { + Conditional o = (Conditional) i; + return opcode == o.opcode && x() == o.x() && y() == o.y() && trueValue() == o.trueValue() && falseValue() == o.falseValue(); + } + return false; + } + + @Override + public void print(LogStream out) { + out.print(x()). + print(' '). + print(condition().operator). + print(' '). + print(y()). + print(" ? "). + print(trueValue()). + print(" : "). + print(falseValue()); + } + + @Override + public Node copy(Graph into) { + Conditional x = new Conditional(kind, condition, into); + return x; + } +} diff -r 3a4ad04d60a1 -r c6af2af32b3d graal/GraalCompiler/src/com/sun/c1x/ir/Constant.java --- a/graal/GraalCompiler/src/com/sun/c1x/ir/Constant.java Tue Jun 07 15:56:21 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/ir/Constant.java Tue Jun 07 15:59:08 2011 +0200 @@ -33,7 +33,7 @@ * The {@code Constant} instruction represents a constant such as an integer value, * long, float, object reference, address, etc. */ -public final class Constant extends Value { +public final class Constant extends FloatingNode { private static final int INPUT_COUNT = 0; private static final int SUCCESSOR_COUNT = 0; @@ -48,7 +48,6 @@ public Constant(CiConstant value, Graph graph) { super(value.kind.stackKind(), INPUT_COUNT, SUCCESSOR_COUNT, graph); this.value = value; - setNonNull(true); } @Override @@ -195,7 +194,6 @@ @Override public Node copy(Graph into) { Constant x = new Constant(value, into); - x.setNonNull(isNonNull()); return x; } } diff -r 3a4ad04d60a1 -r c6af2af32b3d graal/GraalCompiler/src/com/sun/c1x/ir/Convert.java --- a/graal/GraalCompiler/src/com/sun/c1x/ir/Convert.java Tue Jun 07 15:56:21 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/ir/Convert.java Tue Jun 07 15:59:08 2011 +0200 @@ -31,7 +31,7 @@ /** * The {@code Convert} class represents a conversion between primitive types. */ -public final class Convert extends Value { +public final class Convert extends FloatingNode { private static final int INPUT_COUNT = 1; private static final int INPUT_VALUE = 0; @@ -104,7 +104,6 @@ @Override public Node copy(Graph into) { Convert x = new Convert(opcode, null, kind, into); - x.setNonNull(isNonNull()); return x; } } diff -r 3a4ad04d60a1 -r c6af2af32b3d graal/GraalCompiler/src/com/sun/c1x/ir/Deoptimize.java --- a/graal/GraalCompiler/src/com/sun/c1x/ir/Deoptimize.java Tue Jun 07 15:56:21 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/ir/Deoptimize.java Tue Jun 07 15:59:08 2011 +0200 @@ -64,7 +64,6 @@ public Node copy(Graph into) { Deoptimize x = new Deoptimize(into); x.setMessage(message); - x.setNonNull(isNonNull()); return x; } } diff -r 3a4ad04d60a1 -r c6af2af32b3d graal/GraalCompiler/src/com/sun/c1x/ir/ExceptionDispatch.java --- a/graal/GraalCompiler/src/com/sun/c1x/ir/ExceptionDispatch.java Tue Jun 07 15:56:21 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/ir/ExceptionDispatch.java Tue Jun 07 15:59:08 2011 +0200 @@ -128,7 +128,6 @@ @Override public Node copy(Graph into) { ExceptionDispatch x = new ExceptionDispatch(null, null, null, catchType, into); - x.setNonNull(isNonNull()); return x; } } diff -r 3a4ad04d60a1 -r c6af2af32b3d graal/GraalCompiler/src/com/sun/c1x/ir/ExceptionObject.java --- a/graal/GraalCompiler/src/com/sun/c1x/ir/ExceptionObject.java Tue Jun 07 15:56:21 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/ir/ExceptionObject.java Tue Jun 07 15:59:08 2011 +0200 @@ -41,7 +41,6 @@ */ public ExceptionObject(Graph graph) { super(CiKind.Object, INPUT_COUNT, SUCCESSOR_COUNT, graph); - setNonNull(true); } @Override @@ -57,7 +56,6 @@ @Override public Node copy(Graph into) { ExceptionObject x = new ExceptionObject(into); - x.setNonNull(isNonNull()); return x; } } diff -r 3a4ad04d60a1 -r c6af2af32b3d graal/GraalCompiler/src/com/sun/c1x/ir/FixedNode.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/GraalCompiler/src/com/sun/c1x/ir/FixedNode.java Tue Jun 07 15:59:08 2011 +0200 @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2011, 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.sun.c1x.ir; + +import com.oracle.graal.graph.*; +import com.sun.cri.ci.*; + + +public abstract class FixedNode extends Value { + + public FixedNode(CiKind kind, int inputCount, int successorCount, Graph graph) { + super(kind, inputCount, successorCount, graph); + } + +} diff -r 3a4ad04d60a1 -r c6af2af32b3d graal/GraalCompiler/src/com/sun/c1x/ir/FloatingNode.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/GraalCompiler/src/com/sun/c1x/ir/FloatingNode.java Tue Jun 07 15:59:08 2011 +0200 @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2011, 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.sun.c1x.ir; + +import com.oracle.graal.graph.*; +import com.sun.cri.ci.*; + + +public abstract class FloatingNode extends Value { + + /** + * @param kind + * @param inputCount + * @param successorCount + * @param graph + */ + public FloatingNode(CiKind kind, int inputCount, int successorCount, Graph graph) { + super(kind, inputCount, successorCount, graph); + } + +} diff -r 3a4ad04d60a1 -r c6af2af32b3d graal/GraalCompiler/src/com/sun/c1x/ir/If.java --- a/graal/GraalCompiler/src/com/sun/c1x/ir/If.java Tue Jun 07 15:56:21 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/ir/If.java Tue Jun 07 15:59:08 2011 +0200 @@ -190,7 +190,6 @@ public Node copy(Graph into) { If x = new If(null, condition, null, into); x.unorderedIsTrue = unorderedIsTrue; - x.setNonNull(isNonNull()); return x; } } diff -r 3a4ad04d60a1 -r c6af2af32b3d graal/GraalCompiler/src/com/sun/c1x/ir/IfOp.java --- a/graal/GraalCompiler/src/com/sun/c1x/ir/IfOp.java Tue Jun 07 15:56:21 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,156 +0,0 @@ -/* - * Copyright (c) 2009, 2011, 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.sun.c1x.ir; - -import com.oracle.graal.graph.*; -import com.sun.c1x.debug.*; -import com.sun.c1x.util.*; -import com.sun.cri.bytecode.*; -import com.sun.cri.ci.*; - -/** - * The {@code IfOp} class represents a comparison that yields one of two values. - * Note that these nodes are not built directly from the bytecode but are introduced - * by conditional expression elimination. - */ -public final class IfOp extends Op2 { - - private static final int INPUT_COUNT = 2; - private static final int INPUT_TRUE_VALUE = 0; - private static final int INPUT_FALSE_VALUE = 1; - - private static final int SUCCESSOR_COUNT = 0; - - @Override - protected int inputCount() { - return super.inputCount() + INPUT_COUNT; - } - - @Override - protected int successorCount() { - return super.successorCount() + SUCCESSOR_COUNT; - } - - - /** - * The instruction that produces the value if the comparison is true. - */ - public Value trueValue() { - return (Value) inputs().get(super.inputCount() + INPUT_TRUE_VALUE); - } - - public Value setTrueValue(Value n) { - return (Value) inputs().set(super.inputCount() + INPUT_TRUE_VALUE, n); - } - - /** - * The instruction that produces the value if the comparison is false. - */ - public Value falseValue() { - return (Value) inputs().get(super.inputCount() + INPUT_FALSE_VALUE); - } - - public Value setFalseValue(Value n) { - return (Value) inputs().set(super.inputCount() + INPUT_FALSE_VALUE, n); - } - - - Condition condition; - - /** - * Constructs a new IfOp. - * @param x the instruction producing the first value to be compared - * @param condition the condition of the comparison - * @param y the instruction producing the second value to be compared - * @param trueValue the value produced if the condition is true - * @param falseValue the value produced if the condition is false - */ - public IfOp(Value x, Condition condition, Value y, Value trueValue, Value falseValue, Graph graph) { - // TODO: return the appropriate bytecode IF_ICMPEQ, etc - super(trueValue.kind.meet(falseValue.kind), Bytecodes.ILLEGAL, x, y, INPUT_COUNT, SUCCESSOR_COUNT, graph); - this.condition = condition; - setTrueValue(trueValue); - setFalseValue(falseValue); - } - - // for copying - private IfOp(CiKind kind, Condition cond, Graph graph) { - super(kind, Bytecodes.ILLEGAL, null, null, INPUT_COUNT, SUCCESSOR_COUNT, graph); - this.condition = cond; - } - - /** - * Gets the condition of this if operation. - * @return the condition - */ - public Condition condition() { - return condition; - } - - /** - * Checks whether this comparison operator is commutative (i.e. it is either == or !=). - * @return {@code true} if this comparison is commutative - */ - public boolean isCommutative() { - return condition == Condition.EQ || condition == Condition.NE; - } - - @Override - public void accept(ValueVisitor v) { - v.visitIfOp(this); - } - - @Override - public int valueNumber() { - return Util.hash4(condition.hashCode(), x(), y(), trueValue(), falseValue()); - } - - @Override - public boolean valueEqual(Node i) { - if (i instanceof IfOp) { - IfOp o = (IfOp) i; - return opcode == o.opcode && x() == o.x() && y() == o.y() && trueValue() == o.trueValue() && falseValue() == o.falseValue(); - } - return false; - } - - @Override - public void print(LogStream out) { - out.print(x()). - print(' '). - print(condition().operator). - print(' '). - print(y()). - print(" ? "). - print(trueValue()). - print(" : "). - print(falseValue()); - } - - @Override - public Node copy(Graph into) { - IfOp x = new IfOp(kind, condition, into); - x.setNonNull(isNonNull()); - return x; - } -} diff -r 3a4ad04d60a1 -r c6af2af32b3d graal/GraalCompiler/src/com/sun/c1x/ir/InstanceOf.java --- a/graal/GraalCompiler/src/com/sun/c1x/ir/InstanceOf.java Tue Jun 07 15:56:21 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/ir/InstanceOf.java Tue Jun 07 15:59:08 2011 +0200 @@ -74,7 +74,6 @@ @Override public Node copy(Graph into) { InstanceOf x = new InstanceOf(targetClass, null, null, into); - x.setNonNull(isNonNull()); return x; } } diff -r 3a4ad04d60a1 -r c6af2af32b3d graal/GraalCompiler/src/com/sun/c1x/ir/Instruction.java --- a/graal/GraalCompiler/src/com/sun/c1x/ir/Instruction.java Tue Jun 07 15:56:21 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/ir/Instruction.java Tue Jun 07 15:59:08 2011 +0200 @@ -41,7 +41,7 @@ * Instruction nodes are chained together in a basic block through the embedded * {@link Instruction#next} field. An Instruction may also have a list of {@link ExceptionHandler}s. */ -public abstract class Instruction extends Value { +public abstract class Instruction extends FixedNode { private static final int INPUT_COUNT = 0; @@ -111,8 +111,7 @@ } /** - * Gets the state after the instruction, if it is recorded. Typically only - * instances of {@link BlockEnd} have a non-null state after. + * Gets the state after the instruction, if it is recorded. * @return the state after the instruction */ public FrameState stateAfter() { diff -r 3a4ad04d60a1 -r c6af2af32b3d graal/GraalCompiler/src/com/sun/c1x/ir/Invoke.java --- a/graal/GraalCompiler/src/com/sun/c1x/ir/Invoke.java Tue Jun 07 15:56:21 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/ir/Invoke.java Tue Jun 07 15:59:08 2011 +0200 @@ -197,7 +197,6 @@ @Override public Node copy(Graph into) { Invoke x = new Invoke(bci, opcode, kind, new Value[argumentCount], target, returnType, into); - x.setNonNull(isNonNull()); return x; } } diff -r 3a4ad04d60a1 -r c6af2af32b3d graal/GraalCompiler/src/com/sun/c1x/ir/LoadField.java --- a/graal/GraalCompiler/src/com/sun/c1x/ir/LoadField.java Tue Jun 07 15:56:21 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/ir/LoadField.java Tue Jun 07 15:59:08 2011 +0200 @@ -92,7 +92,6 @@ @Override public Node copy(Graph into) { LoadField x = new LoadField(null, field, into); - x.setNonNull(isNonNull()); return x; } } diff -r 3a4ad04d60a1 -r c6af2af32b3d graal/GraalCompiler/src/com/sun/c1x/ir/LoadIndexed.java --- a/graal/GraalCompiler/src/com/sun/c1x/ir/LoadIndexed.java Tue Jun 07 15:56:21 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/ir/LoadIndexed.java Tue Jun 07 15:59:08 2011 +0200 @@ -88,7 +88,6 @@ @Override public Node copy(Graph into) { LoadIndexed x = new LoadIndexed(null, null, null, elementKind(), into); - x.setNonNull(isNonNull()); return x; } } diff -r 3a4ad04d60a1 -r c6af2af32b3d graal/GraalCompiler/src/com/sun/c1x/ir/Local.java --- a/graal/GraalCompiler/src/com/sun/c1x/ir/Local.java Tue Jun 07 15:56:21 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/ir/Local.java Tue Jun 07 15:59:08 2011 +0200 @@ -31,7 +31,7 @@ * The {@code Local} instruction is a placeholder for an incoming argument * to a function call. */ -public final class Local extends Value { +public final class Local extends FloatingNode { private static final int INPUT_COUNT = 1; @@ -94,7 +94,6 @@ public Node copy(Graph into) { Local x = new Local(kind, index, into); x.setDeclaredType(declaredType()); - x.setNonNull(isNonNull()); return x; } } diff -r 3a4ad04d60a1 -r c6af2af32b3d graal/GraalCompiler/src/com/sun/c1x/ir/Logic.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/GraalCompiler/src/com/sun/c1x/ir/Logic.java Tue Jun 07 15:59:08 2011 +0200 @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2009, 2011, 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.sun.c1x.ir; + +import com.oracle.graal.graph.*; +import com.sun.c1x.debug.*; +import com.sun.cri.ci.*; + +/** + * The {@code LogicOp} class definition. + */ +public abstract class Logic extends Binary { + + private static final int INPUT_COUNT = 0; + private static final int SUCCESSOR_COUNT = 0; + + /** + * Constructs a new logic operation instruction. + * @param opcode the opcode of the logic operation + * @param x the first input into this instruction + * @param y the second input into this instruction + */ + public Logic(CiKind kind, int opcode, Value x, Value y, Graph graph) { + super(kind, opcode, x, y, INPUT_COUNT, SUCCESSOR_COUNT, graph); + } + + @Override + public void accept(ValueVisitor v) { + v.visitLogic(this); + } + + @Override + public void print(LogStream out) { + out.print(x()).print(' ').print(this.shortName()).print(' ').print(y()); + } + + @Override + public abstract String shortName(); +} diff -r 3a4ad04d60a1 -r c6af2af32b3d graal/GraalCompiler/src/com/sun/c1x/ir/LogicOp.java --- a/graal/GraalCompiler/src/com/sun/c1x/ir/LogicOp.java Tue Jun 07 15:56:21 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2009, 2011, 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.sun.c1x.ir; - -import com.oracle.graal.graph.*; -import com.sun.c1x.debug.*; -import com.sun.cri.bytecode.*; -import com.sun.cri.ci.*; - -/** - * The {@code LogicOp} class definition. - */ -public final class LogicOp extends Op2 { - - private static final int INPUT_COUNT = 0; - private static final int SUCCESSOR_COUNT = 0; - - /** - * Constructs a new logic operation instruction. - * @param opcode the opcode of the logic operation - * @param x the first input into this instruction - * @param y the second input into this instruction - */ - public LogicOp(int opcode, Value x, Value y, Graph graph) { - super(x.kind, opcode, x, y, INPUT_COUNT, SUCCESSOR_COUNT, graph); - } - - // for copying - private LogicOp(CiKind kind, int opcode, Graph graph) { - super(kind, opcode, null, null, INPUT_COUNT, SUCCESSOR_COUNT, graph); - } - - @Override - public void accept(ValueVisitor v) { - v.visitLogicOp(this); - } - - @Override - public void print(LogStream out) { - out.print(x()).print(' ').print(Bytecodes.operator(opcode)).print(' ').print(y()); - } - - @Override - public Node copy(Graph into) { - LogicOp x = new LogicOp(kind, opcode, into); - x.setNonNull(isNonNull()); - return x; - } -} diff -r 3a4ad04d60a1 -r c6af2af32b3d graal/GraalCompiler/src/com/sun/c1x/ir/LookupSwitch.java --- a/graal/GraalCompiler/src/com/sun/c1x/ir/LookupSwitch.java Tue Jun 07 15:56:21 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/ir/LookupSwitch.java Tue Jun 07 15:59:08 2011 +0200 @@ -87,7 +87,6 @@ @Override public Node copy(Graph into) { LookupSwitch x = new LookupSwitch(null, Arrays.asList(new Instruction[numberOfCases() + 1]), keys.clone(), into); - x.setNonNull(isNonNull()); return x; } } diff -r 3a4ad04d60a1 -r c6af2af32b3d graal/GraalCompiler/src/com/sun/c1x/ir/LoopBegin.java --- a/graal/GraalCompiler/src/com/sun/c1x/ir/LoopBegin.java Tue Jun 07 15:56:21 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/ir/LoopBegin.java Tue Jun 07 15:59:08 2011 +0200 @@ -65,7 +65,6 @@ @Override public Node copy(Graph into) { LoopBegin x = new LoopBegin(into); - x.setNonNull(isNonNull()); return x; } } diff -r 3a4ad04d60a1 -r c6af2af32b3d graal/GraalCompiler/src/com/sun/c1x/ir/LoopEnd.java --- a/graal/GraalCompiler/src/com/sun/c1x/ir/LoopEnd.java Tue Jun 07 15:56:21 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/ir/LoopEnd.java Tue Jun 07 15:59:08 2011 +0200 @@ -76,7 +76,6 @@ @Override public Node copy(Graph into) { LoopEnd x = new LoopEnd(into); - x.setNonNull(isNonNull()); return x; } } diff -r 3a4ad04d60a1 -r c6af2af32b3d graal/GraalCompiler/src/com/sun/c1x/ir/Merge.java --- a/graal/GraalCompiler/src/com/sun/c1x/ir/Merge.java Tue Jun 07 15:56:21 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/ir/Merge.java Tue Jun 07 15:59:08 2011 +0200 @@ -264,7 +264,6 @@ public Node copy(Graph into) { assert getClass() == Merge.class : "copy of " + getClass(); Merge x = new Merge(into); - x.setNonNull(isNonNull()); return x; } diff -r 3a4ad04d60a1 -r c6af2af32b3d graal/GraalCompiler/src/com/sun/c1x/ir/MonitorAddress.java --- a/graal/GraalCompiler/src/com/sun/c1x/ir/MonitorAddress.java Tue Jun 07 15:56:21 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/ir/MonitorAddress.java Tue Jun 07 15:59:08 2011 +0200 @@ -39,7 +39,6 @@ public MonitorAddress(int monitor, Graph graph) { super(CiKind.Word, INPUT_COUNT, SUCCESSOR_COUNT, graph); this.monitor = monitor; - setNonNull(true); } @Override @@ -59,7 +58,6 @@ @Override public Node copy(Graph into) { MonitorAddress x = new MonitorAddress(monitor, into); - x.setNonNull(isNonNull()); return x; } } diff -r 3a4ad04d60a1 -r c6af2af32b3d graal/GraalCompiler/src/com/sun/c1x/ir/MonitorEnter.java --- a/graal/GraalCompiler/src/com/sun/c1x/ir/MonitorEnter.java Tue Jun 07 15:56:21 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/ir/MonitorEnter.java Tue Jun 07 15:59:08 2011 +0200 @@ -64,7 +64,6 @@ @Override public Node copy(Graph into) { MonitorEnter x = new MonitorEnter(null, null, lockNumber, into); - x.setNonNull(isNonNull()); return x; } } diff -r 3a4ad04d60a1 -r c6af2af32b3d graal/GraalCompiler/src/com/sun/c1x/ir/MonitorExit.java --- a/graal/GraalCompiler/src/com/sun/c1x/ir/MonitorExit.java Tue Jun 07 15:56:21 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/ir/MonitorExit.java Tue Jun 07 15:59:08 2011 +0200 @@ -58,7 +58,6 @@ @Override public Node copy(Graph into) { MonitorExit x = new MonitorExit(null, null, lockNumber, into); - x.setNonNull(isNonNull()); return x; } } diff -r 3a4ad04d60a1 -r c6af2af32b3d graal/GraalCompiler/src/com/sun/c1x/ir/Negate.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/GraalCompiler/src/com/sun/c1x/ir/Negate.java Tue Jun 07 15:59:08 2011 +0200 @@ -0,0 +1,106 @@ +/* + * Copyright (c) 2009, 2011, 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.sun.c1x.ir; + +import com.oracle.graal.graph.*; +import com.sun.c1x.debug.*; +import com.sun.c1x.util.*; +import com.sun.cri.bytecode.*; +import com.sun.cri.ci.*; + +/** + * The {@code NegateOp} instruction negates its operand. + */ +public final class Negate extends FloatingNode { + + private static final int INPUT_COUNT = 2; + private static final int INPUT_X = 0; + private static final int INPUT_Y = 1; + + private static final int SUCCESSOR_COUNT = 0; + + @Override + protected int inputCount() { + return super.inputCount() + INPUT_COUNT; + } + + @Override + protected int successorCount() { + return super.successorCount() + SUCCESSOR_COUNT; + } + + /** + * The instruction producing input to this instruction. + */ + public Value x() { + return (Value) inputs().get(super.inputCount() + INPUT_X); + } + + public Value setX(Value n) { + return (Value) inputs().set(super.inputCount() + INPUT_X, n); + } + + /** + * Creates new NegateOp instance. + * @param x the instruction producing the value that is input to this instruction + */ + public Negate(Value x, Graph graph) { + super(x.kind, INPUT_COUNT, SUCCESSOR_COUNT, graph); + setX(x); + } + + // for copying + private Negate(CiKind kind, Graph graph) { + super(kind, INPUT_COUNT, SUCCESSOR_COUNT, graph); + } + + @Override + public void accept(ValueVisitor v) { + v.visitNegate(this); + } + + @Override + public int valueNumber() { + return Util.hash1(Bytecodes.INEG, x()); + } + + @Override + public boolean valueEqual(Node i) { + if (i instanceof Negate) { + Negate o = (Negate) i; + return x() == o.x(); + } + return false; + } + + @Override + public void print(LogStream out) { + out.print("- ").print(x()); + } + + @Override + public Node copy(Graph into) { + Negate x = new Negate(kind, into); + return x; + } +} diff -r 3a4ad04d60a1 -r c6af2af32b3d graal/GraalCompiler/src/com/sun/c1x/ir/NegateOp.java --- a/graal/GraalCompiler/src/com/sun/c1x/ir/NegateOp.java Tue Jun 07 15:56:21 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,107 +0,0 @@ -/* - * Copyright (c) 2009, 2011, 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.sun.c1x.ir; - -import com.oracle.graal.graph.*; -import com.sun.c1x.debug.*; -import com.sun.c1x.util.*; -import com.sun.cri.bytecode.*; -import com.sun.cri.ci.*; - -/** - * The {@code NegateOp} instruction negates its operand. - */ -public final class NegateOp extends Value { - - private static final int INPUT_COUNT = 2; - private static final int INPUT_X = 0; - private static final int INPUT_Y = 1; - - private static final int SUCCESSOR_COUNT = 0; - - @Override - protected int inputCount() { - return super.inputCount() + INPUT_COUNT; - } - - @Override - protected int successorCount() { - return super.successorCount() + SUCCESSOR_COUNT; - } - - /** - * The instruction producing input to this instruction. - */ - public Value x() { - return (Value) inputs().get(super.inputCount() + INPUT_X); - } - - public Value setX(Value n) { - return (Value) inputs().set(super.inputCount() + INPUT_X, n); - } - - /** - * Creates new NegateOp instance. - * @param x the instruction producing the value that is input to this instruction - */ - public NegateOp(Value x, Graph graph) { - super(x.kind, INPUT_COUNT, SUCCESSOR_COUNT, graph); - setX(x); - } - - // for copying - private NegateOp(CiKind kind, Graph graph) { - super(kind, INPUT_COUNT, SUCCESSOR_COUNT, graph); - } - - @Override - public void accept(ValueVisitor v) { - v.visitNegateOp(this); - } - - @Override - public int valueNumber() { - return Util.hash1(Bytecodes.INEG, x()); - } - - @Override - public boolean valueEqual(Node i) { - if (i instanceof NegateOp) { - NegateOp o = (NegateOp) i; - return x() == o.x(); - } - return false; - } - - @Override - public void print(LogStream out) { - out.print("- ").print(x()); - } - - @Override - public Node copy(Graph into) { - NegateOp x = new NegateOp(kind, into); - x.setNonNull(isNonNull()); - return x; - } -} diff -r 3a4ad04d60a1 -r c6af2af32b3d graal/GraalCompiler/src/com/sun/c1x/ir/NewArray.java --- a/graal/GraalCompiler/src/com/sun/c1x/ir/NewArray.java Tue Jun 07 15:56:21 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/ir/NewArray.java Tue Jun 07 15:59:08 2011 +0200 @@ -66,7 +66,6 @@ */ NewArray(Value length, int inputCount, int successorCount, Graph graph) { super(CiKind.Object, inputCount + INPUT_COUNT, successorCount + SUCCESSOR_COUNT, graph); - setNonNull(true); setLength(length); } } diff -r 3a4ad04d60a1 -r c6af2af32b3d graal/GraalCompiler/src/com/sun/c1x/ir/NewInstance.java --- a/graal/GraalCompiler/src/com/sun/c1x/ir/NewInstance.java Tue Jun 07 15:56:21 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/ir/NewInstance.java Tue Jun 07 15:59:08 2011 +0200 @@ -30,7 +30,7 @@ /** * The {@code NewInstance} instruction represents the allocation of an instance class object. */ -public final class NewInstance extends Value { +public final class NewInstance extends FloatingNode { private static final int INPUT_COUNT = 0; private static final int SUCCESSOR_COUNT = 0; @@ -51,7 +51,6 @@ this.instanceClass = type; this.cpi = cpi; this.constantPool = constantPool; - setNonNull(true); } /** @@ -85,7 +84,6 @@ @Override public Node copy(Graph into) { NewInstance x = new NewInstance(instanceClass, cpi, constantPool, into); - x.setNonNull(isNonNull()); return x; } } diff -r 3a4ad04d60a1 -r c6af2af32b3d graal/GraalCompiler/src/com/sun/c1x/ir/NewMultiArray.java --- a/graal/GraalCompiler/src/com/sun/c1x/ir/NewMultiArray.java Tue Jun 07 15:56:21 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/ir/NewMultiArray.java Tue Jun 07 15:59:08 2011 +0200 @@ -120,7 +120,6 @@ @Override public Node copy(Graph into) { NewMultiArray x = new NewMultiArray(elementType, new Value[dimensionCount], cpi, constantPool, into); - x.setNonNull(isNonNull()); return x; } } diff -r 3a4ad04d60a1 -r c6af2af32b3d graal/GraalCompiler/src/com/sun/c1x/ir/NewObjectArray.java --- a/graal/GraalCompiler/src/com/sun/c1x/ir/NewObjectArray.java Tue Jun 07 15:56:21 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/ir/NewObjectArray.java Tue Jun 07 15:59:08 2011 +0200 @@ -79,7 +79,6 @@ @Override public Node copy(Graph into) { NewObjectArray x = new NewObjectArray(elementClass, null, into); - x.setNonNull(isNonNull()); return x; } } diff -r 3a4ad04d60a1 -r c6af2af32b3d graal/GraalCompiler/src/com/sun/c1x/ir/NewTypeArray.java --- a/graal/GraalCompiler/src/com/sun/c1x/ir/NewTypeArray.java Tue Jun 07 15:56:21 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/ir/NewTypeArray.java Tue Jun 07 15:59:08 2011 +0200 @@ -69,7 +69,6 @@ @Override public Node copy(Graph into) { NewTypeArray x = new NewTypeArray(null, elementType, into); - x.setNonNull(isNonNull()); return x; } } diff -r 3a4ad04d60a1 -r c6af2af32b3d graal/GraalCompiler/src/com/sun/c1x/ir/NullCheck.java --- a/graal/GraalCompiler/src/com/sun/c1x/ir/NullCheck.java Tue Jun 07 15:56:21 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/ir/NullCheck.java Tue Jun 07 15:59:08 2011 +0200 @@ -68,14 +68,12 @@ */ public NullCheck(Value object, Graph graph) { super(object.kind, INPUT_COUNT, SUCCESSOR_COUNT, graph); - setNonNull(true); setObject(object); } // for copying private NullCheck(CiKind kind, Graph graph) { super(kind, INPUT_COUNT, SUCCESSOR_COUNT, graph); - setNonNull(true); } @Override @@ -117,7 +115,6 @@ @Override public Node copy(Graph into) { NullCheck x = new NullCheck(kind, into); - x.setNonNull(isNonNull()); return x; } } diff -r 3a4ad04d60a1 -r c6af2af32b3d graal/GraalCompiler/src/com/sun/c1x/ir/Op2.java --- a/graal/GraalCompiler/src/com/sun/c1x/ir/Op2.java Tue Jun 07 15:56:21 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,115 +0,0 @@ -/* - * Copyright (c) 2009, 2011, 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.sun.c1x.ir; - -import com.oracle.graal.graph.*; -import com.sun.c1x.util.*; -import com.sun.cri.bytecode.*; -import com.sun.cri.ci.*; - -/** - * The {@code Op2} class is the base of arithmetic and logic operations with two inputs. - */ -public abstract class Op2 extends Value { - - private static final int INPUT_COUNT = 2; - private static final int INPUT_X = 0; - private static final int INPUT_Y = 1; - - private static final int SUCCESSOR_COUNT = 0; - - @Override - protected int inputCount() { - return super.inputCount() + INPUT_COUNT; - } - - @Override - protected int successorCount() { - return super.successorCount() + SUCCESSOR_COUNT; - } - - /** - * The first input to this instruction. - */ - public Value x() { - return (Value) inputs().get(super.inputCount() + INPUT_X); - } - - public Value setX(Value n) { - return (Value) inputs().set(super.inputCount() + INPUT_X, n); - } - - /** - * The second input to this instruction. - */ - public Value y() { - return (Value) inputs().get(super.inputCount() + INPUT_Y); - } - - public Value setY(Value n) { - return (Value) inputs().set(super.inputCount() + INPUT_Y, n); - } - - /** - * The opcode of this instruction. - */ - public final int opcode; - - /** - * Creates a new Op2 instance. - * @param kind the result type of this instruction - * @param opcode the bytecode opcode - * @param x the first input instruction - * @param y the second input instruction - */ - public Op2(CiKind kind, int opcode, Value x, Value y, int inputCount, int successorCount, Graph graph) { - super(kind, inputCount + INPUT_COUNT, successorCount + SUCCESSOR_COUNT, graph); - this.opcode = opcode; - setX(x); - setY(y); - } - - /** - * Swaps the operands of this instruction. This is only legal for commutative operations. - */ - public void swapOperands() { - assert Bytecodes.isCommutative(opcode); - Value t = x(); - setX(y()); - setY(t); - } - - @Override - public int valueNumber() { - return Util.hash2(opcode, x(), y()); - } - - @Override - public boolean valueEqual(Node i) { - if (i instanceof Op2) { - Op2 o = (Op2) i; - return opcode == o.opcode && x() == o.x() && y() == o.y(); - } - return false; - } -} diff -r 3a4ad04d60a1 -r c6af2af32b3d graal/GraalCompiler/src/com/sun/c1x/ir/Or.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/GraalCompiler/src/com/sun/c1x/ir/Or.java Tue Jun 07 15:59:08 2011 +0200 @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2011, 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.sun.c1x.ir; + +import com.oracle.graal.graph.*; +import com.sun.cri.bytecode.*; +import com.sun.cri.ci.*; + + +/** + * + */ +public final class Or extends Logic { + + /** + * @param opcode + * @param kind + * @param x + * @param y + * @param graph + */ + public Or(CiKind kind, Value x, Value y, Graph graph) { + super(kind, kind == CiKind.Int ? Bytecodes.IOR : Bytecodes.LOR, x, y, graph); + } + + @Override + public String shortName() { + return "|"; + } + + @Override + public Node copy(Graph into) { + Or x = new Or(kind, x(), y(), graph()); + return x; + } + +} diff -r 3a4ad04d60a1 -r c6af2af32b3d graal/GraalCompiler/src/com/sun/c1x/ir/Phi.java --- a/graal/GraalCompiler/src/com/sun/c1x/ir/Phi.java Tue Jun 07 15:56:21 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/ir/Phi.java Tue Jun 07 15:59:08 2011 +0200 @@ -30,7 +30,7 @@ * The {@code Phi} instruction represents the merging of dataflow * in the instruction graph. It refers to a join block and a variable. */ -public final class Phi extends Value { +public final class Phi extends FixedNode { private static final int DEFAULT_MAX_VALUES = 2; @@ -169,7 +169,6 @@ Phi x = new Phi(kind, null, maxValues, into); x.usedInputCount = usedInputCount; x.isDead = isDead; - x.setNonNull(isNonNull()); return x; } } diff -r 3a4ad04d60a1 -r c6af2af32b3d graal/GraalCompiler/src/com/sun/c1x/ir/Placeholder.java --- a/graal/GraalCompiler/src/com/sun/c1x/ir/Placeholder.java Tue Jun 07 15:56:21 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/ir/Placeholder.java Tue Jun 07 15:59:08 2011 +0200 @@ -65,7 +65,6 @@ @Override public Node copy(Graph into) { Placeholder x = new Placeholder(into); - x.setNonNull(isNonNull()); return x; } } diff -r 3a4ad04d60a1 -r c6af2af32b3d graal/GraalCompiler/src/com/sun/c1x/ir/RegisterFinalizer.java --- a/graal/GraalCompiler/src/com/sun/c1x/ir/RegisterFinalizer.java Tue Jun 07 15:56:21 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/ir/RegisterFinalizer.java Tue Jun 07 15:59:08 2011 +0200 @@ -77,7 +77,6 @@ @Override public Node copy(Graph into) { RegisterFinalizer x = new RegisterFinalizer(null, null, into); - x.setNonNull(isNonNull()); return x; } } diff -r 3a4ad04d60a1 -r c6af2af32b3d graal/GraalCompiler/src/com/sun/c1x/ir/Return.java --- a/graal/GraalCompiler/src/com/sun/c1x/ir/Return.java Tue Jun 07 15:56:21 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/ir/Return.java Tue Jun 07 15:59:08 2011 +0200 @@ -96,7 +96,6 @@ @Override public Node copy(Graph into) { Return x = new Return(kind, into); - x.setNonNull(isNonNull()); return x; } } diff -r 3a4ad04d60a1 -r c6af2af32b3d graal/GraalCompiler/src/com/sun/c1x/ir/Shift.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/GraalCompiler/src/com/sun/c1x/ir/Shift.java Tue Jun 07 15:59:08 2011 +0200 @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2009, 2011, 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.sun.c1x.ir; + +import com.oracle.graal.graph.*; +import com.sun.c1x.debug.*; +import com.sun.cri.bytecode.*; +import com.sun.cri.ci.*; + +/** + * The {@code ShiftOp} class represents shift operations. + */ +public final class Shift extends Binary { + + private static final int INPUT_COUNT = 0; + private static final int SUCCESSOR_COUNT = 0; + + /** + * Creates a new shift operation. + * @param opcode the opcode of the shift + * @param x the first input value + * @param y the second input value + */ + public Shift(int opcode, Value x, Value y, Graph graph) { + super(x.kind, opcode, x, y, INPUT_COUNT, SUCCESSOR_COUNT, graph); + } + + private Shift(CiKind kind, int opcode, Graph graph) { + super(kind, opcode, null, null, INPUT_COUNT, SUCCESSOR_COUNT, graph); + } + + @Override + public void accept(ValueVisitor v) { + v.visitShift(this); + } + + @Override + public void print(LogStream out) { + out.print(x()).print(' ').print(Bytecodes.operator(opcode)).print(' ').print(y()); + } + + @Override + public Node copy(Graph into) { + Shift x = new Shift(kind, opcode, into); + return x; + } +} diff -r 3a4ad04d60a1 -r c6af2af32b3d graal/GraalCompiler/src/com/sun/c1x/ir/ShiftOp.java --- a/graal/GraalCompiler/src/com/sun/c1x/ir/ShiftOp.java Tue Jun 07 15:56:21 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,68 +0,0 @@ -/* - * Copyright (c) 2009, 2011, 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.sun.c1x.ir; - -import com.oracle.graal.graph.*; -import com.sun.c1x.debug.*; -import com.sun.cri.bytecode.*; -import com.sun.cri.ci.*; - -/** - * The {@code ShiftOp} class represents shift operations. - */ -public final class ShiftOp extends Op2 { - - private static final int INPUT_COUNT = 0; - private static final int SUCCESSOR_COUNT = 0; - - /** - * Creates a new shift operation. - * @param opcode the opcode of the shift - * @param x the first input value - * @param y the second input value - */ - public ShiftOp(int opcode, Value x, Value y, Graph graph) { - super(x.kind, opcode, x, y, INPUT_COUNT, SUCCESSOR_COUNT, graph); - } - - private ShiftOp(CiKind kind, int opcode, Graph graph) { - super(kind, opcode, null, null, INPUT_COUNT, SUCCESSOR_COUNT, graph); - } - - @Override - public void accept(ValueVisitor v) { - v.visitShiftOp(this); - } - - @Override - public void print(LogStream out) { - out.print(x()).print(' ').print(Bytecodes.operator(opcode)).print(' ').print(y()); - } - - @Override - public Node copy(Graph into) { - ShiftOp x = new ShiftOp(kind, opcode, into); - x.setNonNull(isNonNull()); - return x; - } -} diff -r 3a4ad04d60a1 -r c6af2af32b3d graal/GraalCompiler/src/com/sun/c1x/ir/StoreField.java --- a/graal/GraalCompiler/src/com/sun/c1x/ir/StoreField.java Tue Jun 07 15:56:21 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/ir/StoreField.java Tue Jun 07 15:59:08 2011 +0200 @@ -90,7 +90,6 @@ @Override public Node copy(Graph into) { StoreField x = new StoreField(null, field, null, into); - x.setNonNull(isNonNull()); return x; } } diff -r 3a4ad04d60a1 -r c6af2af32b3d graal/GraalCompiler/src/com/sun/c1x/ir/StoreIndexed.java --- a/graal/GraalCompiler/src/com/sun/c1x/ir/StoreIndexed.java Tue Jun 07 15:56:21 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/ir/StoreIndexed.java Tue Jun 07 15:59:08 2011 +0200 @@ -85,7 +85,6 @@ @Override public Node copy(Graph into) { StoreIndexed x = new StoreIndexed(null, null, null, elementKind(), null, into); - x.setNonNull(isNonNull()); return x; } } diff -r 3a4ad04d60a1 -r c6af2af32b3d graal/GraalCompiler/src/com/sun/c1x/ir/TableSwitch.java --- a/graal/GraalCompiler/src/com/sun/c1x/ir/TableSwitch.java Tue Jun 07 15:56:21 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/ir/TableSwitch.java Tue Jun 07 15:59:08 2011 +0200 @@ -89,7 +89,6 @@ @Override public Node copy(Graph into) { TableSwitch x = new TableSwitch(null, Arrays.asList(new Instruction[numberOfCases() + 1]), lowKey, into); - x.setNonNull(isNonNull()); return x; } } diff -r 3a4ad04d60a1 -r c6af2af32b3d graal/GraalCompiler/src/com/sun/c1x/ir/TypeCheck.java --- a/graal/GraalCompiler/src/com/sun/c1x/ir/TypeCheck.java Tue Jun 07 15:56:21 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/ir/TypeCheck.java Tue Jun 07 15:59:08 2011 +0200 @@ -29,7 +29,7 @@ /** * The {@code TypeCheck} instruction is the base class of casts and instanceof tests. */ -public abstract class TypeCheck extends Value { +public abstract class TypeCheck extends FloatingNode { private static final int INPUT_COUNT = 2; private static final int INPUT_OBJECT = 0; diff -r 3a4ad04d60a1 -r c6af2af32b3d graal/GraalCompiler/src/com/sun/c1x/ir/Unwind.java --- a/graal/GraalCompiler/src/com/sun/c1x/ir/Unwind.java Tue Jun 07 15:56:21 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/ir/Unwind.java Tue Jun 07 15:59:08 2011 +0200 @@ -81,7 +81,6 @@ @Override public Node copy(Graph into) { Unwind x = new Unwind(null, into); - x.setNonNull(isNonNull()); return x; } } diff -r 3a4ad04d60a1 -r c6af2af32b3d graal/GraalCompiler/src/com/sun/c1x/ir/Value.java --- a/graal/GraalCompiler/src/com/sun/c1x/ir/Value.java Tue Jun 07 15:56:21 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/ir/Value.java Tue Jun 07 15:59:08 2011 +0200 @@ -41,8 +41,6 @@ */ public final CiKind kind; - private boolean isNonNull; - protected CiValue operand = CiValue.IllegalValue; /** @@ -67,18 +65,6 @@ } /** - * Checks whether this instruction produces a value which is guaranteed to be non-null. - * @return {@code true} if this instruction's value is not null - */ - public boolean isNonNull() { - return isNonNull; - } - - public void setNonNull(boolean isNonNull) { - this.isNonNull = isNonNull; - } - - /** * Checks whether this value is a constant (i.e. it is of type {@link Constant}. * @return {@code true} if this value is a constant */ @@ -177,9 +163,6 @@ public String flagsToString() { StringBuilder sb = new StringBuilder(); - if (isNonNull()) { - sb.append("NonNull"); - } return sb.toString(); } @@ -219,7 +202,6 @@ public Map getDebugProperties() { Map properties = super.getDebugProperties(); properties.put("kind", kind.toString()); - properties.put("nonNull", isNonNull); properties.put("operand", operand == null ? "null" : operand.toString()); return properties; } diff -r 3a4ad04d60a1 -r c6af2af32b3d graal/GraalCompiler/src/com/sun/c1x/ir/ValueVisitor.java --- a/graal/GraalCompiler/src/com/sun/c1x/ir/ValueVisitor.java Tue Jun 07 15:56:21 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/ir/ValueVisitor.java Tue Jun 07 15:59:08 2011 +0200 @@ -31,29 +31,29 @@ */ public abstract class ValueVisitor { // Checkstyle: stop - public abstract void visitArithmeticOp(ArithmeticOp i); + public abstract void visitArithmetic(Arithmetic i); public abstract void visitArrayLength(ArrayLength i); public abstract void visitMerge(Merge i); public abstract void visitCheckCast(CheckCast i); - public abstract void visitCompareOp(CompareOp i); + public abstract void visitCompare(Compare i); public abstract void visitConstant(Constant i); public abstract void visitConvert(Convert i); public abstract void visitExceptionObject(ExceptionObject i); public abstract void visitFrameState(FrameState i); public abstract void visitAnchor(Anchor i); public abstract void visitIf(If i); - public abstract void visitIfOp(IfOp i); + public abstract void visitIfOp(Conditional i); public abstract void visitInstanceOf(InstanceOf i); public abstract void visitInvoke(Invoke i); public abstract void visitLoadField(LoadField i); public abstract void visitLoadIndexed(LoadIndexed i); public abstract void visitLocal(Local i); - public abstract void visitLogicOp(LogicOp i); + public abstract void visitLogic(Logic i); public abstract void visitLookupSwitch(LookupSwitch i); public abstract void visitMonitorAddress(MonitorAddress monitorAddress); public abstract void visitMonitorEnter(MonitorEnter i); public abstract void visitMonitorExit(MonitorExit i); - public abstract void visitNegateOp(NegateOp i); + public abstract void visitNegate(Negate i); public abstract void visitNewInstance(NewInstance i); public abstract void visitNewMultiArray(NewMultiArray i); public abstract void visitNewObjectArray(NewObjectArray i); @@ -62,7 +62,7 @@ public abstract void visitPhi(Phi i); public abstract void visitRegisterFinalizer(RegisterFinalizer i); public abstract void visitReturn(Return i); - public abstract void visitShiftOp(ShiftOp i); + public abstract void visitShift(Shift i); public abstract void visitStoreField(StoreField i); public abstract void visitStoreIndexed(StoreIndexed i); public abstract void visitTableSwitch(TableSwitch i); diff -r 3a4ad04d60a1 -r c6af2af32b3d graal/GraalCompiler/src/com/sun/c1x/ir/Xor.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/GraalCompiler/src/com/sun/c1x/ir/Xor.java Tue Jun 07 15:59:08 2011 +0200 @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2011, 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.sun.c1x.ir; + +import com.oracle.graal.graph.*; +import com.sun.cri.bytecode.*; +import com.sun.cri.ci.*; + +public final class Xor extends Logic { + + /** + * @param opcode + * @param kind + * @param x + * @param y + * @param graph + */ + public Xor(CiKind kind, Value x, Value y, Graph graph) { + super(kind, kind == CiKind.Int ? Bytecodes.IXOR : Bytecodes.LXOR, x, y, graph); + } + + @Override + public String shortName() { + return "^"; + } + + @Override + public Node copy(Graph into) { + Xor x = new Xor(kind, null, null, graph()); + return x; + } + +} diff -r 3a4ad04d60a1 -r c6af2af32b3d graal/GraalCompiler/src/com/sun/c1x/target/amd64/AMD64LIRGenerator.java --- a/graal/GraalCompiler/src/com/sun/c1x/target/amd64/AMD64LIRGenerator.java Tue Jun 07 15:56:21 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/target/amd64/AMD64LIRGenerator.java Tue Jun 07 15:59:08 2011 +0200 @@ -124,7 +124,7 @@ } @Override - public void visitNegateOp(NegateOp x) { + public void visitNegate(Negate x) { LIRItem value = new LIRItem(x.x(), this); value.setDestroysRegister(); value.loadItem(); @@ -144,7 +144,7 @@ return false; } - public void visitArithmeticOpFloat(ArithmeticOp x) { + public void visitArithmeticOpFloat(Arithmetic x) { LIRItem left = new LIRItem(x.x(), this); LIRItem right = new LIRItem(x.y(), this); assert !left.isStack() || !right.isStack() : "can't both be memory operands"; @@ -185,7 +185,7 @@ setResult(x, reg); } - public void visitArithmeticOpLong(ArithmeticOp x) { + public void visitArithmeticOpLong(Arithmetic x) { int opcode = x.opcode; if (opcode == Bytecodes.LDIV || opcode == Bytecodes.LREM) { // emit inline 64-bit code @@ -228,7 +228,7 @@ } } - public void visitArithmeticOpInt(ArithmeticOp x) { + public void visitArithmeticOpInt(Arithmetic x) { int opcode = x.opcode; if (opcode == Bytecodes.IDIV || opcode == Bytecodes.IREM) { // emit code for integer division or modulus @@ -306,7 +306,7 @@ } } - public void visitArithmeticOpWord(ArithmeticOp x) { + public void visitArithmeticOpWord(Arithmetic x) { int opcode = x.opcode; if (opcode == Bytecodes.WDIV || opcode == Bytecodes.WREM || opcode == Bytecodes.WDIVI || opcode == Bytecodes.WREMI) { // emit code for long division or modulus @@ -359,7 +359,7 @@ } @Override - public void visitArithmeticOp(ArithmeticOp x) { + public void visitArithmetic(Arithmetic x) { trySwap(x); if (x.kind.isWord() || x.opcode == Bytecodes.WREMI) { @@ -384,7 +384,7 @@ } @Override - public void visitShiftOp(ShiftOp x) { + public void visitShift(Shift x) { // count must always be in rcx CiValue count = makeOperand(x.y()); boolean mustLoadCount = !count.isConstant() || x.kind == CiKind.Long; @@ -400,7 +400,7 @@ } @Override - public void visitLogicOp(LogicOp x) { + public void visitLogic(Logic x) { trySwap(x); LIRItem right = new LIRItem(x.y(), this); @@ -412,12 +412,12 @@ logicOp(x.opcode, reg, left, right.result()); } - private void trySwap(Op2 x) { + private void trySwap(Binary x) { // (tw) TODO: Check what this is for? } @Override - public void visitCompareOp(CompareOp x) { + public void visitCompare(Compare x) { LIRItem left = new LIRItem(x.x(), this); LIRItem right = new LIRItem(x.y(), this); if (!x.kind.isVoid() && x.x().kind.isLong()) { diff -r 3a4ad04d60a1 -r c6af2af32b3d graal/GraalCompiler/src/com/sun/c1x/value/FrameState.java --- a/graal/GraalCompiler/src/com/sun/c1x/value/FrameState.java Tue Jun 07 15:56:21 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/value/FrameState.java Tue Jun 07 15:59:08 2011 +0200 @@ -511,7 +511,6 @@ @Override public Node copy(Graph into) { FrameState x = new FrameState(method, bci, localsSize, stackSize, locksSize, into); - x.setNonNull(isNonNull()); return x; } } diff -r 3a4ad04d60a1 -r c6af2af32b3d graal/GraalCompiler/src/com/sun/c1x/value/FrameStateBuilder.java --- a/graal/GraalCompiler/src/com/sun/c1x/value/FrameStateBuilder.java Tue Jun 07 15:56:21 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/value/FrameStateBuilder.java Tue Jun 07 15:59:08 2011 +0200 @@ -57,7 +57,6 @@ // add the receiver and assume it is non null Local local = new Local(method.holder().kind(), javaIndex, graph); local.inputs().set(0, graph.start()); - local.setNonNull(true); local.setDeclaredType(method.holder()); storeLocal(javaIndex, local); javaIndex = 1; diff -r 3a4ad04d60a1 -r c6af2af32b3d graal/GraalGraph/src/com/oracle/graal/graph/NodeArray.java --- a/graal/GraalGraph/src/com/oracle/graal/graph/NodeArray.java Tue Jun 07 15:56:21 2011 +0200 +++ b/graal/GraalGraph/src/com/oracle/graal/graph/NodeArray.java Tue Jun 07 15:59:08 2011 +0200 @@ -36,6 +36,7 @@ this.nodes = new Node[length]; } + @Override public Iterator iterator() { return Arrays.asList(this.nodes).iterator(); } @@ -44,6 +45,7 @@ return this.node; } + @Override public Node set(int index, Node node) { assert node == Node.Null || node.graph == self().graph; assert node == Node.Null || node.id() != Node.DeletedID : "inserted node must not be deleted"; @@ -86,10 +88,12 @@ } } + @Override public Node get(int index) { return nodes[index]; } + @Override public Node[] toArray() { return Arrays.copyOf(nodes, nodes.length); } @@ -133,6 +137,7 @@ assert false; } + @Override public int size() { return nodes.length; } diff -r 3a4ad04d60a1 -r c6af2af32b3d graal/GraalGraph/src/com/oracle/graal/graph/StartNode.java --- a/graal/GraalGraph/src/com/oracle/graal/graph/StartNode.java Tue Jun 07 15:56:21 2011 +0200 +++ b/graal/GraalGraph/src/com/oracle/graal/graph/StartNode.java Tue Jun 07 15:59:08 2011 +0200 @@ -40,7 +40,7 @@ } public Node start() { - return (Node) successors().get(super.successorCount() + SUCCESSOR_START); + return successors().get(super.successorCount() + SUCCESSOR_START); } public Node setStart(Node next) {