# HG changeset patch # User Lukas Stadler # Date 1304601787 -7200 # Node ID fec99fc30af1199642b64e7d992d567abbebf663 # Parent 51ebe5f0516f8c9399ddbf1152732365f171ea59 checkstyle fixes, updated AccessArray + subclasses diff -r 51ebe5f0516f -r fec99fc30af1 graal/GraalCompiler/src/com/sun/c1x/graph/GraphBuilder.java --- a/graal/GraalCompiler/src/com/sun/c1x/graph/GraphBuilder.java Thu May 05 15:01:34 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/graph/GraphBuilder.java Thu May 05 15:23:07 2011 +0200 @@ -378,7 +378,7 @@ FrameState entryState = entry.stateBefore(); assert entry.bci() == handler.handler.handlerBCI(); - assert entryState == null || curState.locksSize() == entryState.locksSize() : "locks do not match : cur:"+curState.locksSize()+" entry:"+entryState.locksSize(); + assert entryState == null || curState.locksSize() == entryState.locksSize() : "locks do not match : cur:" + curState.locksSize() + " entry:" + entryState.locksSize(); // exception handler starts with an empty expression stack curState = curState.immutableCopyWithEmptyStack(); @@ -441,9 +441,9 @@ Value array = apop(); Value length = null; if (cseArrayLength(array)) { - length = append(new ArrayLength(array, stateBefore)); + length = append(new ArrayLength(array, stateBefore, graph)); } - Value v = append(new LoadIndexed(array, index, length, kind, stateBefore)); + Value v = append(new LoadIndexed(array, index, length, kind, stateBefore, graph)); push(kind.stackKind(), v); } @@ -454,9 +454,9 @@ Value array = apop(); Value length = null; if (cseArrayLength(array)) { - length = append(new ArrayLength(array, stateBefore)); + length = append(new ArrayLength(array, stateBefore, graph)); } - StoreIndexed result = new StoreIndexed(array, index, length, kind, value, stateBefore); + StoreIndexed result = new StoreIndexed(array, index, length, kind, value, stateBefore, graph); append(result); if (memoryMap != null) { memoryMap.storeValue(value); @@ -1631,7 +1631,7 @@ private void genArrayLength() { FrameState stateBefore = curState.immutableCopy(bci()); - ipush(append(new ArrayLength(apop(), stateBefore))); + ipush(append(new ArrayLength(apop(), stateBefore, graph))); } void killMemoryMap() { @@ -1692,7 +1692,7 @@ } /** - * Adds an exception handler + * Adds an exception handler. * @param handler the handler to add */ private void addExceptionHandler(ExceptionHandler handler) { diff -r 51ebe5f0516f -r fec99fc30af1 graal/GraalCompiler/src/com/sun/c1x/graph/IR.java --- a/graal/GraalCompiler/src/com/sun/c1x/graph/IR.java Thu May 05 15:01:34 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/graph/IR.java Thu May 05 15:23:07 2011 +0200 @@ -267,7 +267,7 @@ } /** - * Gets the number of locks + * Gets the number of locks. * @return the number of locks */ public final int maxLocks() { diff -r 51ebe5f0516f -r fec99fc30af1 graal/GraalCompiler/src/com/sun/c1x/ir/AccessArray.java --- a/graal/GraalCompiler/src/com/sun/c1x/ir/AccessArray.java Thu May 05 15:01:34 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/ir/AccessArray.java Thu May 05 15:23:07 2011 +0200 @@ -22,6 +22,7 @@ */ package com.sun.c1x.ir; +import com.oracle.graal.graph.*; import com.sun.c1x.value.*; import com.sun.cri.ci.*; @@ -32,29 +33,45 @@ */ public abstract class AccessArray extends StateSplit { - protected Value array; + private static final int INPUT_COUNT = 1; + private static final int INPUT_ARRAY = 0; + + 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 array object. + */ + public Value array() { + return (Value) inputs().get(super.inputCount() + INPUT_ARRAY); + } + + public Value setArray(Value n) { + return (Value) inputs().set(super.inputCount() + INPUT_ARRAY, n); + } + /** * Creates a new AccessArray instruction. * @param kind the type of the result of this instruction * @param array the instruction that produces the array object value * @param stateBefore the frame state before the instruction + * @param inputCount + * @param successorCount + * @param graph */ - public AccessArray(CiKind kind, Value array, FrameState stateBefore) { - super(kind, stateBefore); - this.array = array; + public AccessArray(CiKind kind, Value array, FrameState stateBefore, int inputCount, int successorCount, Graph graph) { + super(kind, stateBefore, inputCount + INPUT_COUNT, successorCount + SUCCESSOR_COUNT, graph); + setArray(array); } - /** - * Gets the instruction that produces the array object. - * @return the instruction that produces the array object - */ - public Value array() { - return array; - } - - @Override - public void inputValuesDo(ValueClosure closure) { - array = closure.apply(array); - } } diff -r 51ebe5f0516f -r fec99fc30af1 graal/GraalCompiler/src/com/sun/c1x/ir/AccessIndexed.java --- a/graal/GraalCompiler/src/com/sun/c1x/ir/AccessIndexed.java Thu May 05 15:01:34 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/ir/AccessIndexed.java Thu May 05 15:23:07 2011 +0200 @@ -22,6 +22,7 @@ */ package com.sun.c1x.ir; +import com.oracle.graal.graph.*; import com.sun.c1x.value.*; import com.sun.cri.ci.*; @@ -33,8 +34,44 @@ */ public abstract class AccessIndexed extends AccessArray { - private Value index; - private Value length; + private static final int INPUT_COUNT = 2; + private static final int INPUT_INDEX = 0; + private static final int INPUT_LENGTH = 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 the index into the array. + */ + public Value index() { + return (Value) inputs().get(super.inputCount() + INPUT_INDEX); + } + + public Value setIndex(Value n) { + return (Value) inputs().set(super.inputCount() + INPUT_INDEX, n); + } + + /** + * The instruction that produces the length of the array. + */ + public Value length() { + return (Value) inputs().get(super.inputCount() + INPUT_LENGTH); + } + + public Value setLength(Value n) { + return (Value) inputs().set(super.inputCount() + INPUT_LENGTH, n); + } + private final CiKind elementType; /** @@ -45,31 +82,18 @@ * @param length the instruction producing the length (used in bounds check elimination?) * @param elementType the type of the elements of the array * @param stateBefore the state before executing this instruction + * @param inputCount + * @param successorCount + * @param graph */ - AccessIndexed(CiKind kind, Value array, Value index, Value length, CiKind elementType, FrameState stateBefore) { - super(kind, array, stateBefore); - this.index = index; - this.length = length; + AccessIndexed(CiKind kind, Value array, Value index, Value length, CiKind elementType, FrameState stateBefore, int inputCount, int successorCount, Graph graph) { + super(kind, array, stateBefore, inputCount + INPUT_COUNT, successorCount + SUCCESSOR_COUNT, graph); + setIndex(index); + setLength(length); this.elementType = elementType; } /** - * Gets the instruction producing the index into the array. - * @return the index - */ - public Value index() { - return index; - } - - /** - * Gets the instruction that produces the length of the array. - * @return the length - */ - public Value length() { - return length; - } - - /** * Gets the element type of the array. * @return the element type */ @@ -77,12 +101,4 @@ return elementType; } - @Override - public void inputValuesDo(ValueClosure closure) { - super.inputValuesDo(closure); - index = closure.apply(index); - if (length != null) { - length = closure.apply(length); - } - } } diff -r 51ebe5f0516f -r fec99fc30af1 graal/GraalCompiler/src/com/sun/c1x/ir/ArrayLength.java --- a/graal/GraalCompiler/src/com/sun/c1x/ir/ArrayLength.java Thu May 05 15:01:34 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/ir/ArrayLength.java Thu May 05 15:23:07 2011 +0200 @@ -22,6 +22,7 @@ */ package com.sun.c1x.ir; +import com.oracle.graal.graph.*; import com.sun.c1x.debug.*; import com.sun.c1x.util.*; import com.sun.c1x.value.*; @@ -35,13 +36,16 @@ */ public final class ArrayLength extends AccessArray { + private static final int INPUT_COUNT = 0; + private static final int SUCCESSOR_COUNT = 0; + /** * Constructs a new ArrayLength instruction. * @param array the instruction producing the array * @param newFrameState the state before executing this instruction */ - public ArrayLength(Value array, FrameState newFrameState) { - super(CiKind.Int, array, newFrameState); + public ArrayLength(Value array, FrameState newFrameState, Graph graph) { + super(CiKind.Int, array, newFrameState, INPUT_COUNT, SUCCESSOR_COUNT, graph); } @Override @@ -51,20 +55,20 @@ @Override public int valueNumber() { - return Util.hash1(Bytecodes.ARRAYLENGTH, array); + return Util.hash1(Bytecodes.ARRAYLENGTH, array()); } @Override public boolean valueEqual(Instruction i) { if (i instanceof ArrayLength) { ArrayLength o = (ArrayLength) i; - return array == o.array; + return array() == o.array(); } return false; } @Override public void print(LogStream out) { - out.print(array).print(".length"); + out.print(array()).print(".length"); } } diff -r 51ebe5f0516f -r fec99fc30af1 graal/GraalCompiler/src/com/sun/c1x/ir/LoadIndexed.java --- a/graal/GraalCompiler/src/com/sun/c1x/ir/LoadIndexed.java Thu May 05 15:01:34 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/ir/LoadIndexed.java Thu May 05 15:23:07 2011 +0200 @@ -22,6 +22,7 @@ */ package com.sun.c1x.ir; +import com.oracle.graal.graph.*; import com.sun.c1x.debug.*; import com.sun.c1x.value.*; import com.sun.cri.ci.*; @@ -34,6 +35,9 @@ */ public final class LoadIndexed extends AccessIndexed { + private static final int INPUT_COUNT = 0; + private static final int SUCCESSOR_COUNT = 0; + /** * Creates a new LoadIndexed instruction. * @param array the instruction producing the array @@ -41,9 +45,10 @@ * @param length the instruction producing the length * @param elementType the element type * @param stateBefore the state before executing this instruction + * @param graph */ - public LoadIndexed(Value array, Value index, Value length, CiKind elementType, FrameState stateBefore) { - super(elementType.stackKind(), array, index, length, elementType, stateBefore); + public LoadIndexed(Value array, Value index, Value length, CiKind elementType, FrameState stateBefore, Graph graph) { + super(elementType.stackKind(), array, index, length, elementType, stateBefore, INPUT_COUNT, SUCCESSOR_COUNT, graph); } /** diff -r 51ebe5f0516f -r fec99fc30af1 graal/GraalCompiler/src/com/sun/c1x/ir/Op2.java --- a/graal/GraalCompiler/src/com/sun/c1x/ir/Op2.java Thu May 05 15:01:34 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/ir/Op2.java Thu May 05 15:23:07 2011 +0200 @@ -51,7 +51,7 @@ } /** - * The first input to this instruction + * The first input to this instruction. */ public Value x() { return (Value) inputs().get(super.inputCount() + INPUT_X); @@ -62,7 +62,7 @@ } /** - * The second input to this instruction + * The second input to this instruction. */ public Value y() { return (Value) inputs().get(super.inputCount() + INPUT_Y); diff -r 51ebe5f0516f -r fec99fc30af1 graal/GraalCompiler/src/com/sun/c1x/ir/StateSplit.java --- a/graal/GraalCompiler/src/com/sun/c1x/ir/StateSplit.java Thu May 05 15:01:34 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/ir/StateSplit.java Thu May 05 15:23:07 2011 +0200 @@ -22,6 +22,7 @@ */ package com.sun.c1x.ir; +import com.oracle.graal.graph.*; import com.sun.c1x.value.*; import com.sun.cri.ci.*; @@ -43,10 +44,17 @@ /** * Creates a new state split with the specified value type. * @param kind the type of the value that this instruction produces + * @param inputCount + * @param successorCount + * @param graph */ + public StateSplit(CiKind kind, FrameState stateBefore, int inputCount, int successorCount, Graph graph) { + super(kind, inputCount, successorCount, graph); + this.stateBefore = stateBefore; + } + public StateSplit(CiKind kind, FrameState stateBefore) { - super(kind); - this.stateBefore = stateBefore; + this(kind, stateBefore, 0, 0, null); } @Override diff -r 51ebe5f0516f -r fec99fc30af1 graal/GraalCompiler/src/com/sun/c1x/ir/StoreIndexed.java --- a/graal/GraalCompiler/src/com/sun/c1x/ir/StoreIndexed.java Thu May 05 15:01:34 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/ir/StoreIndexed.java Thu May 05 15:23:07 2011 +0200 @@ -22,6 +22,7 @@ */ package com.sun.c1x.ir; +import com.oracle.graal.graph.*; import com.sun.c1x.debug.*; import com.sun.c1x.value.*; import com.sun.cri.ci.*; @@ -33,6 +34,9 @@ */ public final class StoreIndexed extends AccessIndexed { + private static final int INPUT_COUNT = 0; + private static final int SUCCESSOR_COUNT = 0; + /** * The value to store. */ @@ -46,9 +50,10 @@ * @param elementType the element type * @param value the value to store into the array * @param stateBefore the state before executing this instruction + * @param graph */ - public StoreIndexed(Value array, Value index, Value length, CiKind elementType, Value value, FrameState stateBefore) { - super(CiKind.Void, array, index, length, elementType, stateBefore); + public StoreIndexed(Value array, Value index, Value length, CiKind elementType, Value value, FrameState stateBefore, Graph graph) { + super(CiKind.Void, array, index, length, elementType, stateBefore, INPUT_COUNT, SUCCESSOR_COUNT, graph); this.value = value; } diff -r 51ebe5f0516f -r fec99fc30af1 graal/GraalCompiler/src/com/sun/c1x/lir/FrameMap.java --- a/graal/GraalCompiler/src/com/sun/c1x/lir/FrameMap.java Thu May 05 15:01:34 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/lir/FrameMap.java Thu May 05 15:23:07 2011 +0200 @@ -326,7 +326,7 @@ } private int offsetForMonitorBase(int index) { - assert index >= 0 && index < monitorCount : "invalid monitor index : " + index+ " (monitorCount=" + monitorCount + ")"; + assert index >= 0 && index < monitorCount : "invalid monitor index : " + index + " (monitorCount=" + monitorCount + ")"; int size = compilation.runtime.sizeOfBasicObjectLock(); assert size != 0 : "monitors are not on the stack in this VM"; int offset = offsetToMonitors() + index * size; diff -r 51ebe5f0516f -r fec99fc30af1 graal/GraalRuntime/src/com/oracle/graal/runtime/VMExitsNative.java --- a/graal/GraalRuntime/src/com/oracle/graal/runtime/VMExitsNative.java Thu May 05 15:01:34 2011 +0200 +++ b/graal/GraalRuntime/src/com/oracle/graal/runtime/VMExitsNative.java Thu May 05 15:23:07 2011 +0200 @@ -85,7 +85,7 @@ if (result.bailout() != null) { Throwable cause = result.bailout().getCause(); - if(!C1XOptions.QuietBailout) { + if (!C1XOptions.QuietBailout) { StringWriter out = new StringWriter(); result.bailout().printStackTrace(new PrintWriter(out)); TTY.println("Bailout:\n" + out.toString());