Mercurial > hg > graal-compiler
changeset 2644:4694daa6af3a
Removed CSE array length.
author | Thomas Wuerthinger <thomas@wuerthinger.net> |
---|---|
date | Wed, 11 May 2011 14:18:49 +0200 |
parents | 3b807c0c5eeb |
children | b2c1e959be46 |
files | graal/GraalCompiler/src/com/sun/c1x/C1XOptions.java graal/GraalCompiler/src/com/sun/c1x/graph/GraphBuilder.java |
diffstat | 2 files changed, 4 insertions(+), 44 deletions(-) [+] |
line wrap: on
line diff
--- a/graal/GraalCompiler/src/com/sun/c1x/C1XOptions.java Wed May 11 14:16:13 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/C1XOptions.java Wed May 11 14:18:49 2011 +0200 @@ -87,7 +87,6 @@ public static boolean QuietBailout = ____; // all optimization settings - public static boolean OptCSEArrayLength; public static boolean OptBlockSkipping; public static boolean OptControlFlow; @@ -156,7 +155,6 @@ OptInline = ll; // Level 3 optimizations - OptCSEArrayLength = lll; UseStackMapTableLiveness = lll; UseAssumptions = lll; OptBlockSkipping = lll;
--- a/graal/GraalCompiler/src/com/sun/c1x/graph/GraphBuilder.java Wed May 11 14:16:13 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/graph/GraphBuilder.java Wed May 11 14:18:49 2011 +0200 @@ -348,10 +348,7 @@ void genLoadIndexed(CiKind kind) { Value index = frameState.ipop(); Value array = frameState.apop(); - Value length = null; - if (cseArrayLength(array)) { - length = append(new ArrayLength(array, graph)); - } + Value length = append(new ArrayLength(array, graph)); Value v = append(new LoadIndexed(array, index, length, kind, graph)); frameState.push(kind.stackKind(), v); } @@ -360,10 +357,7 @@ Value value = frameState.pop(kind.stackKind()); Value index = frameState.ipop(); Value array = frameState.apop(); - Value length = null; - if (cseArrayLength(array)) { - length = append(new ArrayLength(array, graph)); - } + Value length = append(new ArrayLength(array, graph)); StoreIndexed result = new StoreIndexed(array, index, length, kind, value, graph); append(result); } @@ -887,15 +881,8 @@ append(new Return(x, !noSafepoints(), graph)); } - /** - * Gets the number of locks held. - */ - private int locksSize() { - return frameState.locksSize(); - } - void genMonitorEnter(Value x, int bci) { - int lockNumber = locksSize(); + int lockNumber = frameState.locksSize(); MonitorAddress lockAddress = null; if (compilation.runtime.sizeOfBasicObjectLock() != 0) { lockAddress = new MonitorAddress(lockNumber, graph); @@ -973,31 +960,6 @@ append(new LookupSwitch(frameState.ipop(), list, keys, stateBefore, isSafepoint, graph)); } - /** - * Determines whether the length of an array should be extracted out as a separate instruction - * before an array indexing instruction. This exposes it to CSE. - * @param array - * @return - */ - private boolean cseArrayLength(Value array) { - // checks whether an array length access should be generated for CSE - if (C1XOptions.OptCSEArrayLength) { - // always access the length for CSE - return true; - } else if (array.isConstant()) { - // the array itself is a constant - return true; - } else if (array instanceof LoadField && ((LoadField) array).constantValue() != null) { - // the length is derived from a constant array - return true; - } else if (array instanceof NewArray) { - // the array is derived from an allocation - final Value length = ((NewArray) array).length(); - return length != null && length.isConstant(); - } - return false; - } - private Value appendConstant(CiConstant type) { return appendWithBCI(new Constant(type, graph), bci()); } @@ -1076,7 +1038,7 @@ Value exception = appendWithoutOptimization(new ExceptionObject(graph), bci); assert lock != null; - assert frameState.locksSize() > 0 && frameState.lockAt(locksSize() - 1) == lock; + assert frameState.locksSize() > 0 && frameState.lockAt(frameState.locksSize() - 1) == lock; if (lock instanceof Instruction) { Instruction l = (Instruction) lock; if (!l.isAppended()) {