Mercurial > hg > graal-compiler
changeset 2784:e62cfea1c134
Simplified fillSyncHandler. Fixed LIRGenerator visitUnwind.
author | Thomas Wuerthinger <thomas@wuerthinger.net> |
---|---|
date | Wed, 25 May 2011 12:18:58 +0200 |
parents | 9bc0c2eb00d6 |
children | 847dcd4dbd4c |
files | graal/GraalCompiler/src/com/sun/c1x/gen/LIRGenerator.java graal/GraalCompiler/src/com/sun/c1x/graph/GraphBuilder.java |
diffstat | 2 files changed, 14 insertions(+), 18 deletions(-) [+] |
line wrap: on
line diff
--- a/graal/GraalCompiler/src/com/sun/c1x/gen/LIRGenerator.java Wed May 25 12:04:58 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/gen/LIRGenerator.java Wed May 25 12:18:58 2011 +0200 @@ -1643,11 +1643,11 @@ @Override public void visitUnwind(Unwind x) { - // TODO ls: this needs some thorough testing... - CiValue operand = resultOperandFor(x.kind); - CiValue result = force(x.exception(), operand); - ArrayList<CiValue> args = new ArrayList<CiValue>(1); - args.add(result); + // move exception oop into fixed register + CiCallingConvention callingConvention = compilation.frameMap().getCallingConvention(new CiKind[]{CiKind.Object}, RuntimeCall); + CiValue argumentOperand = callingConvention.locations[0]; + lir.move(makeOperand(x.exception()), argumentOperand); + List<CiValue> args = new ArrayList<CiValue>(1); lir.callRuntime(CiRuntimeCall.UnwindException, CiValue.IllegalValue, args, null); setNoResult(x); }
--- a/graal/GraalCompiler/src/com/sun/c1x/graph/GraphBuilder.java Wed May 25 12:04:58 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/graph/GraphBuilder.java Wed May 25 12:18:58 2011 +0200 @@ -105,7 +105,7 @@ // Exception handler list private List<ExceptionHandler> exceptionHandlers; - private final FrameStateBuilder frameState; // the current execution state + private FrameStateBuilder frameState; // the current execution state private Instruction lastInstr; // the last instruction added private final LogStream log; @@ -961,7 +961,7 @@ } } - private void genMonitorExit(Value x, int bci) { + private void genMonitorExit(Value x) { int lockNumber = frameState.locksSize() - 1; if (lockNumber < 0) { throw new CiBailout("monitor stack underflow"); @@ -1088,7 +1088,6 @@ private void fillSyncHandler(Value lock, Block syncHandler) { FrameState origState = frameState.create(-1); - Instruction origLast = lastInstr; lastInstr = syncHandler.firstInstruction; while (lastInstr.next() != null) { @@ -1096,9 +1095,7 @@ lastInstr = lastInstr.next(); } -// TTY.println("first instruction: " + syncHandler.firstInstruction); frameState.initializeFrom(((StateSplit) syncHandler.firstInstruction).stateBefore()); - int bci = Instruction.SYNCHRONIZATION_ENTRY_BCI; assert lock != null; @@ -1109,14 +1106,13 @@ lock = appendWithBCI(l); } } - // exit the monitor - genMonitorExit(lock, Instruction.SYNCHRONIZATION_ENTRY_BCI); + // Exit the monitor and unwind the stack. + genMonitorExit(lock); + append(new Unwind(frameState.apop(), graph)); - genThrow(bci); - - frameState.initializeFrom(origState); - origState.delete(); - lastInstr = origLast; + // The sync handler is always the last thing to add => we can clear the frameState. + frameState = null; + lastInstr = null; } private void iterateAllBlocks() { @@ -1436,7 +1432,7 @@ case CHECKCAST : genCheckCast(); break; case INSTANCEOF : genInstanceOf(); break; case MONITORENTER : genMonitorEnter(frameState.apop(), stream.currentBCI()); break; - case MONITOREXIT : genMonitorExit(frameState.apop(), stream.currentBCI()); break; + case MONITOREXIT : genMonitorExit(frameState.apop()); break; case MULTIANEWARRAY : genNewMultiArray(stream.readCPI()); break; case IFNULL : genIfNull(Condition.EQ); break; case IFNONNULL : genIfNull(Condition.NE); break;