# HG changeset patch # User Thomas Wuerthinger # Date 1304605397 -7200 # Node ID f713d83b5a6b4d1c3e6aa465ea5d8414443678b6 # Parent e4395464810e13f1e8f1cc101cc4ea8123bb0799# Parent 1c36b17f7ee0bd9d37a55e34f737c9cf4b365856 Merge. diff -r e4395464810e -r f713d83b5a6b graal/GraalCompiler/src/com/sun/c1x/gen/LIRGenerator.java --- a/graal/GraalCompiler/src/com/sun/c1x/gen/LIRGenerator.java Thu May 05 16:22:59 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/gen/LIRGenerator.java Thu May 05 16:23:17 2011 +0200 @@ -465,7 +465,7 @@ CiValue resultOperand = resultOperandFor(x.kind); CiCallingConvention cc = compilation.frameMap().getCallingConvention(x.signature(), JavaCall); List pointerSlots = new ArrayList(2); - List argList = visitInvokeArguments(cc, x.arguments(), pointerSlots); + List argList = visitInvokeArguments(cc, x, pointerSlots); if (C1XOptions.InvokeSnippetAfterArguments) { destinationAddress = emitXir(snippet, x, info.copy(), null, x.target(), false, pointerSlots); @@ -1434,11 +1434,12 @@ return new LIRDebugInfo(state, x.exceptionHandlers()); } - List visitInvokeArguments(CiCallingConvention cc, Value[] args, List pointerSlots) { + List visitInvokeArguments(CiCallingConvention cc, Invoke x, List pointerSlots) { // for each argument, load it into the correct location - List argList = new ArrayList(args.length); + List argList = new ArrayList(x.argumentCount()); int j = 0; - for (Value arg : args) { + for (int i = 0; i < x.argumentCount(); i++) { + Value arg = x.argument(i); if (arg != null) { CiValue operand = cc.locations[j++]; if (operand.isRegister()) { @@ -1456,7 +1457,7 @@ } if (arg.kind == CiKind.Object && pointerSlots != null) { - // This slot must be marked explicitedly in the pointer map. + // This slot must be marked explicitly in the pointer map. pointerSlots.add(slot); } } @@ -1600,7 +1601,7 @@ private CiValue emitInvokeKnown(RiMethod method, FrameState stateBefore, Value... args) { boolean isStatic = Modifier.isStatic(method.accessFlags()); - Invoke invoke = new Invoke(isStatic ? Bytecodes.INVOKESTATIC : Bytecodes.INVOKESPECIAL, method.signature().returnKind(), args, method, null, stateBefore); + Invoke invoke = new Invoke(isStatic ? Bytecodes.INVOKESTATIC : Bytecodes.INVOKESPECIAL, method.signature().returnKind(), args, method, null, stateBefore, null); visitInvoke(invoke); return invoke.operand(); } diff -r e4395464810e -r f713d83b5a6b graal/GraalCompiler/src/com/sun/c1x/graph/GraphBuilder.java --- a/graal/GraalCompiler/src/com/sun/c1x/graph/GraphBuilder.java Thu May 05 16:22:59 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/graph/GraphBuilder.java Thu May 05 16:23:17 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(); @@ -425,7 +425,7 @@ if (!riType.isResolved() || C1XOptions.TestPatching) { push(CiKind.Object, append(new ResolveClass(riType, RiType.Representation.JavaClass, null))); } else { - push(CiKind.Object, append(new Constant(riType.getEncoding(Representation.JavaClass)))); + push(CiKind.Object, append(new Constant(riType.getEncoding(Representation.JavaClass), graph))); } } else if (con instanceof CiConstant) { CiConstant constant = (CiConstant) con; @@ -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); @@ -587,14 +587,14 @@ void genConvert(int opcode, CiKind from, CiKind to) { CiKind tt = to.stackKind(); - push(tt, append(new Convert(opcode, pop(from.stackKind()), tt))); + push(tt, append(new Convert(opcode, pop(from.stackKind()), tt, graph))); } void genIncrement() { int index = stream().readLocalIndex(); int delta = stream().readIncrement(); Value x = curState.localAt(index); - Value y = append(Constant.forInt(delta)); + Value y = append(Constant.forInt(delta, graph)); curState.storeLocal(index, append(new ArithmeticOp(IADD, CiKind.Int, x, y, isStrict(method().accessFlags()), null, graph))); } @@ -704,7 +704,7 @@ void genGetField(int cpi, RiField field) { // Must copy the state here, because the field holder must still be on the stack. FrameState stateBefore = curState.immutableCopy(bci()); - LoadField load = new LoadField(apop(), field, stateBefore); + LoadField load = new LoadField(apop(), field, stateBefore, graph); appendOptimizedLoadField(field.kind(), load); } @@ -712,7 +712,7 @@ // Must copy the state here, because the field holder must still be on the stack. FrameState stateBefore = curState.immutableCopy(bci()); Value value = pop(field.kind().stackKind()); - appendOptimizedStoreField(new StoreField(apop(), field, value, stateBefore)); + appendOptimizedStoreField(new StoreField(apop(), field, value, stateBefore, graph)); } void genGetStatic(int cpi, RiField field) { @@ -726,7 +726,7 @@ push(constantValue.kind.stackKind(), appendConstant(constantValue)); } else { Value container = genResolveClass(RiType.Representation.StaticFields, holder, field.isResolved(), cpi); - LoadField load = new LoadField(container, field, null); + LoadField load = new LoadField(container, field, null, graph); appendOptimizedLoadField(field.kind(), load); } } @@ -735,7 +735,7 @@ RiType holder = field.holder(); Value container = genResolveClass(RiType.Representation.StaticFields, holder, field.isResolved(), cpi); Value value = pop(field.kind().stackKind()); - StoreField store = new StoreField(container, field, value, null); + StoreField store = new StoreField(container, field, value, null, graph); appendOptimizedStoreField(store); } @@ -901,7 +901,7 @@ private void appendInvoke(int opcode, RiMethod target, Value[] args, int cpi, RiConstantPool constantPool) { CiKind resultType = returnKind(target); - Value result = append(new Invoke(opcode, resultType.stackKind(), args, target, target.signature().returnType(compilation.method.holder()), null)); + Value result = append(new Invoke(opcode, resultType.stackKind(), args, target, target.signature().returnType(compilation.method.holder()), null, graph)); pushReturn(resultType, result); } @@ -1021,7 +1021,7 @@ lockAddress = new MonitorAddress(lockNumber); append(lockAddress); } - append(new MonitorExit(rootMethodSynchronizedObject, lockAddress, lockNumber, stateBefore)); + append(new MonitorExit(rootMethodSynchronizedObject, lockAddress, lockNumber, stateBefore, graph)); curState.unlock(); } append(new Return(x, !noSafepoints())); @@ -1041,7 +1041,7 @@ lockAddress = new MonitorAddress(lockNumber); append(lockAddress); } - MonitorEnter monitorEnter = new MonitorEnter(x, lockAddress, lockNumber, null); + MonitorEnter monitorEnter = new MonitorEnter(x, lockAddress, lockNumber, null, graph); appendWithoutOptimization(monitorEnter, bci); curState.lock(ir, x, lockNumber + 1); monitorEnter.setStateAfter(curState.immutableCopy(bci)); @@ -1058,7 +1058,7 @@ lockAddress = new MonitorAddress(lockNumber); append(lockAddress); } - appendWithoutOptimization(new MonitorExit(x, lockAddress, lockNumber, null), bci); + appendWithoutOptimization(new MonitorExit(x, lockAddress, lockNumber, null, graph), bci); curState.unlock(); killMemoryMap(); // prevent any optimizations across synchronization } @@ -1139,7 +1139,7 @@ } private Value appendConstant(CiConstant type) { - return appendWithBCI(new Constant(type), bci()); + return appendWithBCI(new Constant(type, graph), bci()); } private Value append(Instruction x) { @@ -1242,7 +1242,7 @@ private Value synchronizedObject(FrameState curState2, RiMethod target) { if (isStatic(target.accessFlags())) { - Constant classConstant = new Constant(target.holder().getEncoding(Representation.JavaClass)); + Constant classConstant = new Constant(target.holder().getEncoding(Representation.JavaClass), graph); return appendWithoutOptimization(classConstant, Instruction.SYNCHRONIZATION_ENTRY_BCI); } else { return curState2.localAt(0); @@ -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 e4395464810e -r f713d83b5a6b graal/GraalCompiler/src/com/sun/c1x/graph/IR.java --- a/graal/GraalCompiler/src/com/sun/c1x/graph/IR.java Thu May 05 16:22:59 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/graph/IR.java Thu May 05 16:23:17 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 e4395464810e -r f713d83b5a6b graal/GraalCompiler/src/com/sun/c1x/ir/AccessArray.java --- a/graal/GraalCompiler/src/com/sun/c1x/ir/AccessArray.java Thu May 05 16:22:59 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/ir/AccessArray.java Thu May 05 16:23:17 2011 +0200 @@ -22,39 +22,53 @@ */ package com.sun.c1x.ir; +import com.oracle.graal.graph.*; import com.sun.c1x.value.*; import com.sun.cri.ci.*; /** * This the base class of all array operations. - * - * @author Ben L. Titzer */ 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 e4395464810e -r f713d83b5a6b graal/GraalCompiler/src/com/sun/c1x/ir/AccessField.java --- a/graal/GraalCompiler/src/com/sun/c1x/ir/AccessField.java Thu May 05 16:22:59 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/ir/AccessField.java Thu May 05 16:23:17 2011 +0200 @@ -24,6 +24,7 @@ import java.lang.reflect.*; +import com.oracle.graal.graph.*; import com.sun.c1x.value.*; import com.sun.cri.ci.*; import com.sun.cri.ri.*; @@ -33,7 +34,32 @@ */ public abstract class AccessField extends StateSplit { - private Value object; + private static final int INPUT_COUNT = 1; + private static final int INPUT_OBJECT = 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 receiver object of this field access (for instance field accesses). + */ + public Value object() { + return (Value) inputs().get(super.inputCount() + INPUT_OBJECT); + } + + public Value setObject(Value n) { + return (Value) inputs().set(super.inputCount() + INPUT_OBJECT, n); + } + protected final RiField field; /** @@ -41,24 +67,16 @@ * @param kind the result kind of the access * @param object the instruction producing the receiver object * @param field the compiler interface representation of the field - * @param isStatic indicates if the field is static * @param stateBefore the state before the field access - * @param isLoaded indicates if the class is loaded + * @param inputCount + * @param successorCount + * @param graph */ - public AccessField(CiKind kind, Value object, RiField field, FrameState stateBefore) { - super(kind, stateBefore); - this.object = object; - this.field = field; + public AccessField(CiKind kind, Value object, RiField field, FrameState stateBefore, int inputCount, int successorCount, Graph graph) { + super(kind, stateBefore, inputCount + INPUT_COUNT, successorCount + SUCCESSOR_COUNT, graph); assert object != null : "every field access must reference some object"; - } - - /** - * Gets the instruction that produces the receiver object of this field access - * (for instance field accesses). - * @return the instruction that produces the receiver object - */ - public Value object() { - return object; + this.field = field; + setObject(object); } /** @@ -92,9 +110,4 @@ public boolean isVolatile() { return isLoaded() && Modifier.isVolatile(field.accessFlags()); } - - @Override - public void inputValuesDo(ValueClosure closure) { - object = closure.apply(object); - } } diff -r e4395464810e -r f713d83b5a6b graal/GraalCompiler/src/com/sun/c1x/ir/AccessIndexed.java --- a/graal/GraalCompiler/src/com/sun/c1x/ir/AccessIndexed.java Thu May 05 16:22:59 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/ir/AccessIndexed.java Thu May 05 16:23:17 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 e4395464810e -r f713d83b5a6b graal/GraalCompiler/src/com/sun/c1x/ir/AccessMonitor.java --- a/graal/GraalCompiler/src/com/sun/c1x/ir/AccessMonitor.java Thu May 05 16:22:59 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/ir/AccessMonitor.java Thu May 05 16:23:17 2011 +0200 @@ -22,32 +22,58 @@ */ package com.sun.c1x.ir; +import com.oracle.graal.graph.*; import com.sun.c1x.value.*; import com.sun.cri.ci.*; /** * The {@code AccessMonitor} instruction is the base class of both monitor acquisition and release. - * - * @author Ben L. Titzer */ public abstract class AccessMonitor extends StateSplit { - /** - * The object locked or unlocked by this instruction. - */ - private Value object; + private static final int INPUT_COUNT = 2; + private static final int INPUT_OBJECT = 0; + private static final int INPUT_LOCK_ADDRESS = 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 address of the on-stack lock object or {@code null} if the runtime does not place locks on the stack. + * The instruction producing the object locked or unlocked by this instruction. */ - private Value lockAddress; + public Value object() { + return (Value) inputs().get(super.inputCount() + INPUT_OBJECT); + } + + public Value setObject(Value n) { + return (Value) inputs().set(super.inputCount() + INPUT_OBJECT, n); + } + + /** + * The instruction producing the address of the lock object. + */ + public Value lockAddress() { + return (Value) inputs().get(super.inputCount() + INPUT_LOCK_ADDRESS); + } + + public Value setLockAddress(Value n) { + return (Value) inputs().set(super.inputCount() + INPUT_LOCK_ADDRESS, n); + } /** * The lock number of this monitor access. */ public final int lockNumber; - /** * Creates a new AccessMonitor instruction. * @@ -55,33 +81,14 @@ * @param lockAddress the address of the on-stack lock object or {@code null} if the runtime does not place locks on the stack * @param stateBefore the state before executing the monitor operation * @param lockNumber the number of the lock being acquired - */ - public AccessMonitor(Value object, Value lockAddress, FrameState stateBefore, int lockNumber) { - super(CiKind.Illegal, stateBefore); - this.object = object; - this.lockAddress = lockAddress; - this.lockNumber = lockNumber; - } - - /** - * Gets the instruction producing the object locked or unlocked by this instruction. + * @param inputCount + * @param successorCount + * @param graph */ - public Value object() { - return object; - } - - /** - * Gets the instruction producing the address of the lock object. - */ - public Value lockAddress() { - return lockAddress; - } - - @Override - public void inputValuesDo(ValueClosure closure) { - object = closure.apply(object); - if (lockAddress != null) { - lockAddress = closure.apply(lockAddress); - } + public AccessMonitor(Value object, Value lockAddress, FrameState stateBefore, int lockNumber, int inputCount, int successorCount, Graph graph) { + super(CiKind.Illegal, stateBefore, inputCount + INPUT_COUNT, successorCount + SUCCESSOR_COUNT, graph); + this.lockNumber = lockNumber; + setObject(object); + setLockAddress(lockAddress); } } diff -r e4395464810e -r f713d83b5a6b graal/GraalCompiler/src/com/sun/c1x/ir/ArrayLength.java --- a/graal/GraalCompiler/src/com/sun/c1x/ir/ArrayLength.java Thu May 05 16:22:59 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/ir/ArrayLength.java Thu May 05 16:23:17 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 e4395464810e -r f713d83b5a6b graal/GraalCompiler/src/com/sun/c1x/ir/Constant.java --- a/graal/GraalCompiler/src/com/sun/c1x/ir/Constant.java Thu May 05 16:22:59 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/ir/Constant.java Thu May 05 16:23:17 2011 +0200 @@ -24,6 +24,7 @@ import static com.sun.c1x.C1XCompilation.*; +import com.oracle.graal.graph.*; import com.sun.c1x.debug.*; import com.sun.cri.ci.*; import com.sun.cri.ri.*; @@ -36,14 +37,18 @@ */ public final class Constant extends Instruction { + private static final int INPUT_COUNT = 0; + private static final int SUCCESSOR_COUNT = 0; + public final CiConstant value; /** * Constructs a new instruction representing the specified constant. * @param value the constant + * @param graph */ - public Constant(CiConstant value) { - super(value.kind.stackKind()); + public Constant(CiConstant value, Graph graph) { + super(value.kind.stackKind(), INPUT_COUNT, SUCCESSOR_COUNT, graph); this.value = value; initFlag(Value.Flag.NonNull, value.isNonNull()); } @@ -56,10 +61,11 @@ /** * Creates an instruction for a double constant. * @param d the double value for which to create the instruction + * @param graph * @return an instruction representing the double */ - public static Constant forDouble(double d) { - return new Constant(CiConstant.forDouble(d)); + public static Constant forDouble(double d, Graph graph) { + return new Constant(CiConstant.forDouble(d), graph); } /** @@ -67,8 +73,8 @@ * @param f the float value for which to create the instruction * @return an instruction representing the float */ - public static Constant forFloat(float f) { - return new Constant(CiConstant.forFloat(f)); + public static Constant forFloat(float f, Graph graph) { + return new Constant(CiConstant.forFloat(f), graph); } /** @@ -76,8 +82,8 @@ * @param i the long value for which to create the instruction * @return an instruction representing the long */ - public static Constant forLong(long i) { - return new Constant(CiConstant.forLong(i)); + public static Constant forLong(long i, Graph graph) { + return new Constant(CiConstant.forLong(i), graph); } /** @@ -85,8 +91,8 @@ * @param i the integer value for which to create the instruction * @return an instruction representing the integer */ - public static Constant forInt(int i) { - return new Constant(CiConstant.forInt(i)); + public static Constant forInt(int i, Graph graph) { + return new Constant(CiConstant.forInt(i), graph); } /** @@ -94,8 +100,8 @@ * @param i the boolean value for which to create the instruction * @return an instruction representing the boolean */ - public static Constant forBoolean(boolean i) { - return new Constant(CiConstant.forBoolean(i)); + public static Constant forBoolean(boolean i, Graph graph) { + return new Constant(CiConstant.forBoolean(i), graph); } /** @@ -103,8 +109,8 @@ * @param i the address value for which to create the instruction * @return an instruction representing the address */ - public static Constant forJsr(int i) { - return new Constant(CiConstant.forJsr(i)); + public static Constant forJsr(int i, Graph graph) { + return new Constant(CiConstant.forJsr(i), graph); } /** @@ -112,8 +118,8 @@ * @param o the object value for which to create the instruction * @return an instruction representing the object */ - public static Constant forObject(Object o) { - return new Constant(CiConstant.forObject(o)); + public static Constant forObject(Object o, Graph graph) { + return new Constant(CiConstant.forObject(o), graph); } /** @@ -121,8 +127,8 @@ * @param val the word value for which to create the instruction * @return an instruction representing the word */ - public static Constant forWord(long val) { - return new Constant(CiConstant.forWord(val)); + public static Constant forWord(long val, Graph graph) { + return new Constant(CiConstant.forWord(val), graph); } @Override diff -r e4395464810e -r f713d83b5a6b graal/GraalCompiler/src/com/sun/c1x/ir/Convert.java --- a/graal/GraalCompiler/src/com/sun/c1x/ir/Convert.java Thu May 05 16:22:59 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/ir/Convert.java Thu May 05 16:23:17 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.cri.bytecode.*; @@ -29,41 +30,51 @@ /** * The {@code Convert} class represents a conversion between primitive types. - * - * @author Ben L. Titzer */ public final class Convert extends Instruction { + private static final int INPUT_COUNT = 1; + private static final int INPUT_VALUE = 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 which produces the input value to this instruction. + */ + public Value value() { + return (Value) inputs().get(super.inputCount() + INPUT_VALUE); + } + + public Value setValue(Value n) { + return (Value) inputs().set(super.inputCount() + INPUT_VALUE, n); + } + /** * The opcode for this conversion operation. */ public final int opcode; - Value value; - /** * Constructs a new Convert instance. * @param opcode the bytecode representing the operation * @param value the instruction producing the input value * @param kind the result type of this instruction + * @param graph */ - public Convert(int opcode, Value value, CiKind kind) { - super(kind); + public Convert(int opcode, Value value, CiKind kind, Graph graph) { + super(kind, INPUT_COUNT, SUCCESSOR_COUNT, graph); this.opcode = opcode; - this.value = value; - } - - /** - * Gets the instruction which produces the input value to this instruction. - * @return the input value instruction - */ - public Value value() { - return value; - } - - @Override - public void inputValuesDo(ValueClosure closure) { - value = closure.apply(value); + setValue(value); } @Override @@ -73,14 +84,14 @@ @Override public int valueNumber() { - return Util.hash1(opcode, value); + return Util.hash1(opcode, value()); } @Override public boolean valueEqual(Instruction i) { if (i instanceof Convert) { Convert o = (Convert) i; - return opcode == o.opcode && value == o.value; + return opcode == o.opcode && value() == o.value(); } return false; } diff -r e4395464810e -r f713d83b5a6b graal/GraalCompiler/src/com/sun/c1x/ir/IfOp.java --- a/graal/GraalCompiler/src/com/sun/c1x/ir/IfOp.java Thu May 05 16:22:59 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/ir/IfOp.java Thu May 05 16:23:17 2011 +0200 @@ -31,8 +31,6 @@ * 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. - * - * @author Ben L. Titzer */ public final class IfOp extends Op2 { diff -r e4395464810e -r f713d83b5a6b graal/GraalCompiler/src/com/sun/c1x/ir/Invoke.java --- a/graal/GraalCompiler/src/com/sun/c1x/ir/Invoke.java Thu May 05 16:22:59 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/ir/Invoke.java Thu May 05 16:23:17 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.*; @@ -34,8 +35,38 @@ */ public final class Invoke extends StateSplit { + private final int argumentCount; + + private static final int SUCCESSOR_COUNT = 0; + + @Override + protected int inputCount() { + return super.inputCount() + argumentCount; + } + + @Override + protected int successorCount() { + return super.successorCount() + SUCCESSOR_COUNT; + } + + /** + * The list of instructions that produce input for this instruction. + */ + public Value argument(int index) { + assert index >= 0 && index < argumentCount; + return (Value) inputs().get(super.inputCount() + index); + } + + public Value setArgument(int index, Value n) { + assert index >= 0 && index < argumentCount; + return (Value) inputs().set(super.inputCount() + index, n); + } + + public int argumentCount() { + return argumentCount; + } + public final int opcode; - public final Value[] arguments; public final RiMethod target; public final RiType returnType; @@ -49,12 +80,16 @@ * @param target the target method being called * @param stateBefore the state before executing the invocation */ - public Invoke(int opcode, CiKind result, Value[] args, RiMethod target, RiType returnType, FrameState stateBefore) { - super(result, stateBefore); + public Invoke(int opcode, CiKind result, Value[] args, RiMethod target, RiType returnType, FrameState stateBefore, Graph graph) { + super(result, stateBefore, args.length, SUCCESSOR_COUNT, graph); this.opcode = opcode; - this.arguments = args; this.target = target; this.returnType = returnType; + + this.argumentCount = args.length; + for (int i = 0; i < args.length; i++) { + setArgument(i, args[i]); + } } /** @@ -85,7 +120,7 @@ */ public Value receiver() { assert !isStatic(); - return arguments[0]; + return argument(0); } /** @@ -97,14 +132,6 @@ } /** - * Gets the list of instructions that produce input for this instruction. - * @return the list of instructions that produce input - */ - public Value[] arguments() { - return arguments; - } - - /** * Checks whether this invocation has a receiver object. * @return {@code true} if this invocation has a receiver object; {@code false} otherwise, if this is a * static call @@ -114,17 +141,6 @@ } @Override - public void inputValuesDo(ValueClosure closure) { - for (int i = 0; i < arguments.length; i++) { - Value arg = arguments[i]; - if (arg != null) { - arguments[i] = closure.apply(arg); - assert arguments[i] != null; - } - } - } - - @Override public void accept(ValueVisitor v) { v.visitInvoke(this); } @@ -144,12 +160,11 @@ RiMethod target = target(); out.print(target.name()).print('('); - Value[] arguments = arguments(); - for (int i = argStart; i < arguments.length; i++) { + for (int i = argStart; i < argumentCount; i++) { if (i > argStart) { out.print(", "); } - out.print(arguments[i]); + out.print(argument(i)); } out.print(CiUtil.format(") [method: %H.%n(%p):%r]", target, false)); } diff -r e4395464810e -r f713d83b5a6b graal/GraalCompiler/src/com/sun/c1x/ir/LoadField.java --- a/graal/GraalCompiler/src/com/sun/c1x/ir/LoadField.java Thu May 05 16:22:59 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/ir/LoadField.java Thu May 05 16:23:17 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.*; @@ -32,16 +33,20 @@ */ public final class LoadField extends AccessField { + private static final int INPUT_COUNT = 0; + private static final int SUCCESSOR_COUNT = 0; + /** * Creates a new LoadField instance. * @param object the receiver object * @param field the compiler interface field * @param isStatic indicates if the field is static * @param stateBefore the state before the field access + * @param graph * @param isLoaded indicates if the class is loaded */ - public LoadField(Value object, RiField field, FrameState stateBefore) { - super(field.kind().stackKind(), object, field, stateBefore); + public LoadField(Value object, RiField field, FrameState stateBefore, Graph graph) { + super(field.kind().stackKind(), object, field, stateBefore, INPUT_COUNT, SUCCESSOR_COUNT, graph); } /** diff -r e4395464810e -r f713d83b5a6b graal/GraalCompiler/src/com/sun/c1x/ir/LoadIndexed.java --- a/graal/GraalCompiler/src/com/sun/c1x/ir/LoadIndexed.java Thu May 05 16:22:59 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/ir/LoadIndexed.java Thu May 05 16:23:17 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.*; @@ -29,11 +30,12 @@ /** * The {@code LoadIndexed} instruction represents a read from an element of an array. - * - * @author Ben L. Titzer */ 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 +43,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 e4395464810e -r f713d83b5a6b graal/GraalCompiler/src/com/sun/c1x/ir/LogicOp.java --- a/graal/GraalCompiler/src/com/sun/c1x/ir/LogicOp.java Thu May 05 16:22:59 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/ir/LogicOp.java Thu May 05 16:23:17 2011 +0200 @@ -28,8 +28,6 @@ /** * The {@code LogicOp} class definition. - * - * @author Ben L. Titzer */ public final class LogicOp extends Op2 { diff -r e4395464810e -r f713d83b5a6b graal/GraalCompiler/src/com/sun/c1x/ir/MonitorEnter.java --- a/graal/GraalCompiler/src/com/sun/c1x/ir/MonitorEnter.java Thu May 05 16:22:59 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/ir/MonitorEnter.java Thu May 05 16:23:17 2011 +0200 @@ -22,16 +22,18 @@ */ package com.sun.c1x.ir; +import com.oracle.graal.graph.*; import com.sun.c1x.debug.*; import com.sun.c1x.value.*; /** * The {@code MonitorEnter} instruction represents the acquisition of a monitor. - * - * @author Ben L. Titzer */ public final class MonitorEnter extends AccessMonitor { + private static final int INPUT_COUNT = 0; + private static final int SUCCESSOR_COUNT = 0; + private FrameState stateAfter; /** @@ -41,9 +43,10 @@ * @param lockAddress the address of the on-stack lock object or {@code null} if the runtime does not place locks on the stack * @param lockNumber the number of the lock * @param stateBefore the state before + * @param graph */ - public MonitorEnter(Value object, Value lockAddress, int lockNumber, FrameState stateBefore) { - super(object, lockAddress, stateBefore, lockNumber); + public MonitorEnter(Value object, Value lockAddress, int lockNumber, FrameState stateBefore, Graph graph) { + super(object, lockAddress, stateBefore, lockNumber, INPUT_COUNT, SUCCESSOR_COUNT, graph); } @Override diff -r e4395464810e -r f713d83b5a6b graal/GraalCompiler/src/com/sun/c1x/ir/MonitorExit.java --- a/graal/GraalCompiler/src/com/sun/c1x/ir/MonitorExit.java Thu May 05 16:22:59 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/ir/MonitorExit.java Thu May 05 16:23:17 2011 +0200 @@ -22,16 +22,18 @@ */ package com.sun.c1x.ir; +import com.oracle.graal.graph.*; import com.sun.c1x.debug.*; import com.sun.c1x.value.*; /** * The {@code MonitorExit} instruction represents a monitor release. - * - * @author Ben L. Titzer */ public final class MonitorExit extends AccessMonitor { + private static final int INPUT_COUNT = 0; + private static final int SUCCESSOR_COUNT = 0; + /** * Creates a new MonitorExit instruction. * @@ -39,9 +41,10 @@ * @param lockAddress the address of the on-stack lock object or {@code null} if the runtime does not place locks on the stack * @param lockNumber the number of the lock * @param stateBefore the state before executing this instruction + * @param graph */ - public MonitorExit(Value object, Value lockAddress, int lockNumber, FrameState stateBefore) { - super(object, lockAddress, stateBefore, lockNumber); + public MonitorExit(Value object, Value lockAddress, int lockNumber, FrameState stateBefore, Graph graph) { + super(object, lockAddress, stateBefore, lockNumber, INPUT_COUNT, SUCCESSOR_COUNT, graph); } @Override diff -r e4395464810e -r f713d83b5a6b graal/GraalCompiler/src/com/sun/c1x/ir/Op2.java --- a/graal/GraalCompiler/src/com/sun/c1x/ir/Op2.java Thu May 05 16:22:59 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/ir/Op2.java Thu May 05 16:23:17 2011 +0200 @@ -29,8 +29,6 @@ /** * The {@code Op2} class is the base of arithmetic and logic operations with two inputs. - * - * @author Ben L. Titzer */ public abstract class Op2 extends Instruction { @@ -51,7 +49,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 +60,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 e4395464810e -r f713d83b5a6b graal/GraalCompiler/src/com/sun/c1x/ir/ShiftOp.java --- a/graal/GraalCompiler/src/com/sun/c1x/ir/ShiftOp.java Thu May 05 16:22:59 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/ir/ShiftOp.java Thu May 05 16:23:17 2011 +0200 @@ -28,8 +28,6 @@ /** * The {@code ShiftOp} class represents shift operations. - * - * @author Ben L. Titzer */ public final class ShiftOp extends Op2 { diff -r e4395464810e -r f713d83b5a6b graal/GraalCompiler/src/com/sun/c1x/ir/StateSplit.java --- a/graal/GraalCompiler/src/com/sun/c1x/ir/StateSplit.java Thu May 05 16:22:59 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/ir/StateSplit.java Thu May 05 16:23:17 2011 +0200 @@ -22,17 +22,19 @@ */ package com.sun.c1x.ir; +import com.oracle.graal.graph.*; import com.sun.c1x.value.*; import com.sun.cri.ci.*; /** * The {@code StateSplit} class is the abstract base class of all instructions * that store an immutable copy of the frame state. - * - * @author Ben L. Titzer */ public abstract class StateSplit extends Instruction { + private static final int INPUT_COUNT = 0; + private static final int SUCCESSOR_COUNT = 0; + /** * Sentinel denoting an explicitly cleared state. */ @@ -43,10 +45,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 + INPUT_COUNT, successorCount + SUCCESSOR_COUNT, graph); + this.stateBefore = stateBefore; + } + public StateSplit(CiKind kind, FrameState stateBefore) { - super(kind); - this.stateBefore = stateBefore; + this(kind, stateBefore, 0, 0, null); } @Override diff -r e4395464810e -r f713d83b5a6b graal/GraalCompiler/src/com/sun/c1x/ir/StoreField.java --- a/graal/GraalCompiler/src/com/sun/c1x/ir/StoreField.java Thu May 05 16:22:59 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/ir/StoreField.java Thu May 05 16:23:17 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.*; @@ -32,37 +33,43 @@ */ public final class StoreField extends AccessField { + private static final int INPUT_COUNT = 1; + private static final int INPUT_VALUE = 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 value to store. + * The value that is written to the field. */ - Value value; + public Value value() { + return (Value) inputs().get(super.inputCount() + INPUT_VALUE); + } + + public Value setValue(Value n) { + return (Value) inputs().set(super.inputCount() + INPUT_VALUE, n); + } /** * Creates a new LoadField instance. * @param object the receiver object * @param field the compiler interface field * @param value the instruction representing the value to store to the field - * @param isStatic indicates if the field is static * @param stateBefore the state before the field access - * @param isLoaded indicates if the class is loaded + * @param graph */ - public StoreField(Value object, RiField field, Value value, FrameState stateBefore) { - super(CiKind.Void, object, field, stateBefore); - this.value = value; - } - - /** - * Gets the value that is written to the field. - * @return the value - */ - public Value value() { - return value; - } - - @Override - public void inputValuesDo(ValueClosure closure) { - super.inputValuesDo(closure); - value = closure.apply(value); + public StoreField(Value object, RiField field, Value value, FrameState stateBefore, Graph graph) { + super(CiKind.Void, object, field, stateBefore, INPUT_COUNT, SUCCESSOR_COUNT, graph); + setValue(value); } @Override diff -r e4395464810e -r f713d83b5a6b graal/GraalCompiler/src/com/sun/c1x/ir/StoreIndexed.java --- a/graal/GraalCompiler/src/com/sun/c1x/ir/StoreIndexed.java Thu May 05 16:22:59 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/ir/StoreIndexed.java Thu May 05 16:23:17 2011 +0200 @@ -22,21 +22,41 @@ */ 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.*; /** * The {@code StoreIndexed} instruction represents a write to an array element. - * - * @author Ben L. Titzer */ public final class StoreIndexed extends AccessIndexed { + private static final int INPUT_COUNT = 1; + private static final int INPUT_VALUE = 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 value to store. + * The instruction that produces the value that is to be stored into the array. */ - Value value; + public Value value() { + return (Value) inputs().get(super.inputCount() + INPUT_VALUE); + } + + public Value setValue(Value n) { + return (Value) inputs().set(super.inputCount() + INPUT_VALUE, n); + } /** * Creates a new StoreIndexed instruction. @@ -46,24 +66,11 @@ * @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); - this.value = value; - } - - /** - * Gets the instruction that produces the value that is to be stored into the array. - * @return the value to write into the array - */ - public Value value() { - return value; - } - - @Override - public void inputValuesDo(ValueClosure closure) { - super.inputValuesDo(closure); - value = closure.apply(value); + 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); + setValue(value); } @Override diff -r e4395464810e -r f713d83b5a6b graal/GraalCompiler/src/com/sun/c1x/lir/FrameMap.java --- a/graal/GraalCompiler/src/com/sun/c1x/lir/FrameMap.java Thu May 05 16:22:59 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/lir/FrameMap.java Thu May 05 16:23:17 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 e4395464810e -r f713d83b5a6b graal/GraalRuntime/src/com/oracle/graal/runtime/VMExitsNative.java --- a/graal/GraalRuntime/src/com/oracle/graal/runtime/VMExitsNative.java Thu May 05 16:22:59 2011 +0200 +++ b/graal/GraalRuntime/src/com/oracle/graal/runtime/VMExitsNative.java Thu May 05 16:23:17 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()); diff -r e4395464810e -r f713d83b5a6b runscimark.sh --- a/runscimark.sh Thu May 05 16:22:59 2011 +0200 +++ b/runscimark.sh Thu May 05 16:23:17 2011 +0200 @@ -15,7 +15,11 @@ echo "SCIMARK is not defined. It must point to a SciMark benchmark directory." exit 1; fi -for (( i = 1; i <= 5000; i++ )) ### Outer for loop ### +COUNT=$1 +if [ -z "${COUNT}" ]; then + COUNT=5000 +fi +for (( i = 1; i <= ${COUNT}; i++ )) ### Outer for loop ### do echo "$i " ${JDK7}/jre/bin/java -client -graal -esa -ea -Xms32m -Xmx100m -Xbootclasspath/a:${SCIMARK} -C1X:+PrintTimers jnt.scimark2.commandline -large