# HG changeset patch # User Gilles Duboscq # Date 1304088390 -7200 # Node ID cc1f1d3962883f72b4094e8b052a0b2f94f37946 # Parent 274360f98f97657a2f4a5faa9fb4eb847c5adfc1 Remove inlining (3rd part) diff -r 274360f98f97 -r cc1f1d396288 graal/GraalCompiler/src/com/sun/c1x/C1XCompilation.java --- a/graal/GraalCompiler/src/com/sun/c1x/C1XCompilation.java Fri Apr 29 13:19:17 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/C1XCompilation.java Fri Apr 29 16:46:30 2011 +0200 @@ -94,7 +94,7 @@ this.method = method; this.stats = stats == null ? new CiStatistics() : stats; this.registerConfig = method == null ? compiler.globalStubRegisterConfig : runtime.getRegisterConfig(method); - this.placeholderState = method != null && method.minimalDebugInfo() ? new MutableFrameState(method, 0, 0, 0) : null; + this.placeholderState = method != null && method.minimalDebugInfo() ? new MutableFrameState(0, 0, 0) : null; if (compiler.isObserved()) { compiler.fireCompilationStarted(new CompilationEvent(this)); diff -r 274360f98f97 -r cc1f1d396288 graal/GraalCompiler/src/com/sun/c1x/alloc/LinearScan.java --- a/graal/GraalCompiler/src/com/sun/c1x/alloc/LinearScan.java Fri Apr 29 13:19:17 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/alloc/LinearScan.java Fri Apr 29 16:46:30 2011 +0200 @@ -2109,7 +2109,7 @@ } } - return new CiFrame(null, state.method, state.bci, values, state.localsSize(), state.stackSize(), state.locksSize()); + return new CiFrame(null, ir.compilation.method, state.bci, values, state.localsSize(), state.stackSize(), state.locksSize()); } private void computeDebugInfo(IntervalWalker iw, LIRInstruction op) { diff -r 274360f98f97 -r cc1f1d396288 graal/GraalCompiler/src/com/sun/c1x/debug/CFGPrinter.java --- a/graal/GraalCompiler/src/com/sun/c1x/debug/CFGPrinter.java Fri Apr 29 13:19:17 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/debug/CFGPrinter.java Fri Apr 29 16:46:30 2011 +0200 @@ -99,10 +99,6 @@ private void end(String string) { out.adjustIndentation(-2); - end("states"); - end("states"); - end("states"); - end("states"); out.println("end_" + string); } @@ -131,7 +127,6 @@ void printBlock(BlockBegin block, List successors, Iterable handlers, boolean printHIR, boolean printLIR) { begin("block"); - end("states"); out.print("name \"B").print(block.blockID).println('"'); out.print("from_bci ").println(block.bci()); out.print("to_bci ").println(block.end() == null ? -1 : block.end().bci()); @@ -163,8 +158,6 @@ } if (block.isSubroutineEntry()) { out.print("\"sr\" "); - end("states"); - end("states"); } if (block.isBackwardBranchTarget()) { out.print("\"bb\" "); @@ -216,7 +209,7 @@ if (stackSize > 0) { begin("stack"); out.print("size ").println(stackSize); - out.print("method \"").print(CiUtil.toLocation(state.method, state.bci)).println('"'); + out.print("bci ").println(state.bci); int i = 0; while (i < stackSize) { @@ -238,7 +231,7 @@ if (state.locksSize() > 0) { begin("locks"); out.print("size ").println(state.locksSize()); - out.print("method \"").print(CiUtil.toLocation(state.method, state.bci)).println('"'); + out.print("bci ").println(state.bci); for (int i = 0; i < state.locksSize(); ++i) { Value value = state.lockAt(i); @@ -253,7 +246,7 @@ begin("locals"); out.print("size ").println(state.localsSize()); - out.print("method \"").print(CiUtil.toLocation(state.method, state.bci)).println('"'); + out.print("bci ").println(state.bci); int i = 0; while (i < state.localsSize()) { Value value = state.localAt(i); @@ -282,7 +275,7 @@ } StringBuilder buf = new StringBuilder(); - buf.append(CiUtil.toLocation(state.method, state.bci)); + buf.append("[bci: ").append(state.bci).append("]"); buf.append('\n'); if (state.stackSize() > 0) { int i = 0; diff -r 274360f98f97 -r cc1f1d396288 graal/GraalCompiler/src/com/sun/c1x/graph/GraphBuilder.java --- a/graal/GraalCompiler/src/com/sun/c1x/graph/GraphBuilder.java Fri Apr 29 13:19:17 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/graph/GraphBuilder.java Fri Apr 29 16:46:30 2011 +0200 @@ -120,7 +120,7 @@ BlockBegin stdEntry = blockMap.get(0); pushRootScope(rootMethod, blockMap, startBlock); MutableFrameState initialState = stateAtEntry(rootMethod); - startBlock.mergeOrClone(initialState); + startBlock.mergeOrClone(initialState, rootMethod); BlockBegin syncHandler = null; // 3. setup internal state for appending instructions @@ -170,7 +170,7 @@ base.setStateAfter(stateAfter); startBlock.setEnd(base); assert stdEntry.stateBefore() == null; - stdEntry.mergeOrClone(stateAfter); + stdEntry.mergeOrClone(stateAfter, method()); } void pushRootScope(RiMethod method, BlockMap blockMap, BlockBegin start) { @@ -378,7 +378,7 @@ // exception handler starts with an empty expression stack curState = curState.immutableCopyWithEmptyStack(); - entry.mergeOrClone(curState); + entry.mergeOrClone(curState, method()); // add current state for correct handling of phi functions int phiOperand = entry.addExceptionState(curState); @@ -1049,7 +1049,7 @@ if (Modifier.isSynchronized(method().accessFlags())) { FrameState stateBefore = curState.immutableCopy(bci()); // unlock before exiting the method - int lockNumber = curState.totalLocksSize() - 1; + int lockNumber = curState.locksSize() - 1; MonitorAddress lockAddress = null; if (compilation.runtime.sizeOfBasicObjectLock() != 0) { lockAddress = new MonitorAddress(lockNumber); @@ -1083,7 +1083,7 @@ } void genMonitorExit(Value x, int bci) { - int lockNumber = curState.totalLocksSize() - 1; + int lockNumber = curState.locksSize() - 1; if (lockNumber < 0) { throw new CiBailout("monitor stack underflow"); } @@ -1104,6 +1104,7 @@ throw new CiBailout("recursive jsr/ret structure"); } } + System.err.println("> JSR!"); push(CiKind.Jsr, append(Constant.forJsr(nextBCI()))); tryInlineJsr(dest); } @@ -1316,7 +1317,7 @@ } MutableFrameState stateAtEntry(RiMethod method) { - MutableFrameState state = new MutableFrameState(method, -1, method.maxLocals(), method.maxStackSize()); + MutableFrameState state = new MutableFrameState(-1, method.maxLocals(), method.maxStackSize()); int index = 0; if (!isStatic(method.accessFlags())) { // add the receiver and assume it is non null @@ -1482,7 +1483,7 @@ // propagate the state for (BlockBegin succ : end.successors()) { assert succ.predecessors().contains(curBlock); - succ.mergeOrClone(end.stateAfter()); + succ.mergeOrClone(end.stateAfter(), method()); scopeData.addToWorkList(succ); } return end; diff -r 274360f98f97 -r cc1f1d396288 graal/GraalCompiler/src/com/sun/c1x/ir/BlockBegin.java --- a/graal/GraalCompiler/src/com/sun/c1x/ir/BlockBegin.java Fri Apr 29 13:19:17 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/ir/BlockBegin.java Fri Apr 29 16:46:30 2011 +0200 @@ -31,6 +31,7 @@ import com.sun.c1x.util.*; import com.sun.c1x.value.*; import com.sun.cri.ci.*; +import com.sun.cri.ri.*; /** * Denotes the beginning of a basic block, and holds information @@ -394,7 +395,7 @@ v.visitBlockBegin(this); } - public void mergeOrClone(FrameState newState) { + public void mergeOrClone(FrameState newState, RiMethod method) { FrameState existingState = stateBefore; if (existingState == null) { @@ -409,7 +410,7 @@ if (C1XOptions.UseStackMapTableLiveness) { // if a liveness map is available, use it to invalidate dead locals - CiBitMap[] livenessMap = newState.method.livenessMap(); + CiBitMap[] livenessMap = method.livenessMap(); if (livenessMap != null && bci() >= 0) { assert bci() < livenessMap.length; CiBitMap liveness = livenessMap[bci()]; @@ -426,7 +427,7 @@ stateBefore = newState; } else { - if (!C1XOptions.AssumeVerifiedBytecode && !existingState.isSameAcrossScopes(newState)) { + if (!C1XOptions.AssumeVerifiedBytecode && !existingState.isSame(newState)) { // stacks or locks do not match--bytecodes would not verify throw new CiBailout("stack or locks do not match"); } diff -r 274360f98f97 -r cc1f1d396288 graal/GraalCompiler/src/com/sun/c1x/ir/StateSplit.java --- a/graal/GraalCompiler/src/com/sun/c1x/ir/StateSplit.java Fri Apr 29 13:19:17 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/ir/StateSplit.java Fri Apr 29 16:46:30 2011 +0200 @@ -36,7 +36,7 @@ /** * Sentinel denoting an explicitly cleared state. */ - private static final FrameState CLEARED_STATE = new MutableFrameState(null, -5, 0, 0); + private static final FrameState CLEARED_STATE = new MutableFrameState(-5, 0, 0); private FrameState stateBefore; diff -r 274360f98f97 -r cc1f1d396288 graal/GraalCompiler/src/com/sun/c1x/lir/FrameMap.java --- a/graal/GraalCompiler/src/com/sun/c1x/lir/FrameMap.java Fri Apr 29 13:19:17 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/lir/FrameMap.java Fri Apr 29 16:46:30 2011 +0200 @@ -326,7 +326,7 @@ } private int offsetForMonitorBase(int index) { - assert index >= 0 && index < monitorCount : "invalid monitor index"; + 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 274360f98f97 -r cc1f1d396288 graal/GraalCompiler/src/com/sun/c1x/value/FrameState.java --- a/graal/GraalCompiler/src/com/sun/c1x/value/FrameState.java Fri Apr 29 13:19:17 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/value/FrameState.java Fri Apr 29 16:46:30 2011 +0200 @@ -28,7 +28,6 @@ import com.sun.c1x.graph.*; import com.sun.c1x.ir.*; import com.sun.cri.ci.*; -import com.sun.cri.ri.*; /** * The {@code FrameState} class encapsulates the frame state (i.e. local variables and @@ -62,10 +61,6 @@ */ protected final int maxLocals; - //XXX temporary while removing IRScope - @Deprecated - public final RiMethod method; - /** * The bytecode index to which this frame state applies. This will be {@code -1} * iff this state is mutable. @@ -94,8 +89,7 @@ * @param maxLocals maximum number of locals * @param maxStack maximum size of the stack */ - public FrameState(RiMethod method, int bci, int maxLocals, int maxStack) { - this.method = method; + public FrameState(int bci, int maxLocals, int maxStack) { this.bci = bci; this.values = new Value[maxLocals + Math.max(maxStack, MINIMUM_STACK_SLOTS)]; this.maxLocals = maxLocals; @@ -113,7 +107,7 @@ * @return a new frame state with the specified components */ public MutableFrameState copy(int bci, boolean withLocals, boolean withStack, boolean withLocks) { - final MutableFrameState other = new MutableFrameState(method, bci, localsSize(), maxStackSize()); + final MutableFrameState other = new MutableFrameState(bci, localsSize(), maxStackSize()); if (withLocals && withStack) { // fast path: use array copy int valuesSize = valuesSize(); @@ -156,7 +150,7 @@ return copy(bci, false, false, false); } - public boolean isSameAcrossScopes(FrameState other) { + public boolean isSame(FrameState other) { assert stackSize() == other.stackSize(); assert localsSize() == other.localsSize(); assert locksSize() == other.locksSize(); @@ -193,11 +187,6 @@ return locks == null ? 0 : locks.size(); } - @Deprecated - public int totalLocksSize() { - return locksSize(); - } - /** * Gets the current size (height) of the stack. */ @@ -557,7 +546,7 @@ public String toString() { StringBuilder sb = new StringBuilder(); String nl = String.format("%n"); - CiUtil.appendLocation(sb, this.method, this.bci).append(nl); + sb.append("[bci: ").append(this.bci).append("]").append(nl); for (int i = 0; i < this.localsSize(); ++i) { Value value = this.localAt(i); sb.append(String.format(" local[%d] = %-8s : %s%n", i, value == null ? "bogus" : value.kind.javaName, value)); @@ -572,8 +561,4 @@ } return sb.toString(); } - - public CiCodePos toCodePos() { - return new CiCodePos(null, method, bci); - } } diff -r 274360f98f97 -r cc1f1d396288 graal/GraalCompiler/src/com/sun/c1x/value/MutableFrameState.java --- a/graal/GraalCompiler/src/com/sun/c1x/value/MutableFrameState.java Fri Apr 29 13:19:17 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/value/MutableFrameState.java Fri Apr 29 16:46:30 2011 +0200 @@ -28,7 +28,6 @@ import com.sun.c1x.ir.*; import com.sun.c1x.util.*; import com.sun.cri.ci.*; -import com.sun.cri.ri.*; /** @@ -45,8 +44,8 @@ */ public final class MutableFrameState extends FrameState { - public MutableFrameState(RiMethod method, int bci, int maxLocals, int maxStack) { - super(method, bci, maxLocals, maxStack); + public MutableFrameState(int bci, int maxLocals, int maxStack) { + super(bci, maxLocals, maxStack); } /**