int endAddress = startAddress + tryBlock.getCodeUnitCount();
for (TryBlock<? extends ExceptionHandler> tryBlock : tryBlocks) { int startAddress = tryBlock.getStartCodeAddress(); int endAddress = tryBlock.getStartCodeAddress() + tryBlock.getCodeUnitCount(); boolean inTryBlock = (address >= startAddress && address < endAddress); if (!inTryBlock) {
Label endLabel = newLabel(codeAddressToIndex, tryBlock.getStartCodeAddress() + tryBlock.getCodeUnitCount());
if (currentTry.getStartCodeAddress() + currentTry.getCodeUnitCount() <= currentCodeAddress) { currentTry = null; triesIndex++; TryBlock<? extends ExceptionHandler> tryBlock = tries.get(triesIndex); if (tryBlock.getStartCodeAddress() <= currentCodeAddress) { assert(tryBlock.getStartCodeAddress() + tryBlock.getCodeUnitCount() > currentCodeAddress);
for (TryBlock<? extends ExceptionHandler> tryItem : tries) { int startAddress = tryItem.getStartCodeAddress(); int length = tryItem.getCodeUnitCount();// .getTryLength(); int endAddress = startAddress + length;// - 1; Unit beginStmt = instructionAtAddress(startAddress).getUnit();
int endAddress = startAddress + tryBlock.getCodeUnitCount();
@Override public int getCodeUnitCount() { return tryBlock.getCodeUnitCount(); }
@Override public int getCodeUnitCount() { return tryBlock.getCodeUnitCount(); }
@Override public int getCodeUnitCount() { return tryBlock.getCodeUnitCount(); }
public static ImmutableTryBlock of(TryBlock<? extends ExceptionHandler> tryBlock) { if (tryBlock instanceof ImmutableTryBlock) { return (ImmutableTryBlock)tryBlock; } return new ImmutableTryBlock( tryBlock.getStartCodeAddress(), tryBlock.getCodeUnitCount(), tryBlock.getExceptionHandlers()); }
public static ImmutableTryBlock of(TryBlock<? extends ExceptionHandler> tryBlock) { if (tryBlock instanceof ImmutableTryBlock) { return (ImmutableTryBlock)tryBlock; } return new ImmutableTryBlock( tryBlock.getStartCodeAddress(), tryBlock.getCodeUnitCount(), tryBlock.getExceptionHandlers()); }
public static ImmutableTryBlock of(TryBlock<? extends ExceptionHandler> tryBlock) { if (tryBlock instanceof ImmutableTryBlock) { return (ImmutableTryBlock)tryBlock; } return new ImmutableTryBlock( tryBlock.getStartCodeAddress(), tryBlock.getCodeUnitCount(), tryBlock.getExceptionHandlers()); }
@Override public boolean equals(Object o) { if (o instanceof TryBlock) { TryBlock other = (TryBlock)o; return getStartCodeAddress() == other.getStartCodeAddress() && getCodeUnitCount() == other.getCodeUnitCount() && getExceptionHandlers().equals(other.getExceptionHandlers()); } return false; } }
@Override public boolean equals(Object o) { if (o instanceof TryBlock) { TryBlock other = (TryBlock)o; return getStartCodeAddress() == other.getStartCodeAddress() && getCodeUnitCount() == other.getCodeUnitCount() && getExceptionHandlers().equals(other.getExceptionHandlers()); } return false; } }
@Override public boolean equals(Object o) { if (o instanceof TryBlock) { TryBlock other = (TryBlock)o; return getStartCodeAddress() == other.getStartCodeAddress() && getCodeUnitCount() == other.getCodeUnitCount() && getExceptionHandlers().equals(other.getExceptionHandlers()); } return false; } }
int endAddress = startAddress + tryBlock.getCodeUnitCount();
public static <EH extends ExceptionHandler> List<TryBlock<EH>> massageTryBlocks( List<? extends TryBlock<? extends EH>> tryBlocks) { TryListBuilder<EH> tlb = new TryListBuilder<EH>(); for (TryBlock<? extends EH> tryBlock: tryBlocks) { int startAddress = tryBlock.getStartCodeAddress(); int endAddress = startAddress + tryBlock.getCodeUnitCount(); for (EH exceptionHandler: tryBlock.getExceptionHandlers()) { tlb.addHandler(startAddress, endAddress, exceptionHandler); } } return tlb.getTryBlocks(); }
public static <EH extends ExceptionHandler> List<TryBlock<EH>> massageTryBlocks( List<? extends TryBlock<? extends EH>> tryBlocks) { TryListBuilder<EH> tlb = new TryListBuilder<EH>(); for (TryBlock<? extends EH> tryBlock: tryBlocks) { int startAddress = tryBlock.getStartCodeAddress(); int endAddress = startAddress + tryBlock.getCodeUnitCount(); for (EH exceptionHandler: tryBlock.getExceptionHandlers()) { tlb.addHandler(startAddress, endAddress, exceptionHandler); } } return tlb.getTryBlocks(); }
public static <EH extends ExceptionHandler> List<TryBlock<EH>> massageTryBlocks( List<? extends TryBlock<? extends EH>> tryBlocks) { TryListBuilder<EH> tlb = new TryListBuilder<EH>(); for (TryBlock<? extends EH> tryBlock: tryBlocks) { int startAddress = tryBlock.getStartCodeAddress(); int endAddress = startAddress + tryBlock.getCodeUnitCount(); for (EH exceptionHandler: tryBlock.getExceptionHandlers()) { tlb.addHandler(startAddress, endAddress, exceptionHandler); } } return tlb.getTryBlocks(); }
@Test public void testTryEndAtEndOfMethod() { MethodImplementationBuilder builder = new MethodImplementationBuilder(10); Label startLabel = builder.addLabel("start"); builder.addInstruction(new BuilderInstruction10x(Opcode.NOP)); builder.addInstruction(new BuilderInstruction10x(Opcode.NOP)); builder.addInstruction(new BuilderInstruction10x(Opcode.NOP)); builder.addInstruction(new BuilderInstruction10x(Opcode.NOP)); builder.addInstruction(new BuilderInstruction10x(Opcode.NOP)); builder.addInstruction(new BuilderInstruction32x(Opcode.MOVE_16, 0, 0)); Label endLabel = builder.addLabel("end"); builder.addCatch(startLabel, endLabel, startLabel); MethodImplementation methodImplementation = builder.getMethodImplementation(); Assert.assertEquals(0, methodImplementation.getTryBlocks().get(0).getStartCodeAddress()); Assert.assertEquals(8, methodImplementation.getTryBlocks().get(0).getCodeUnitCount()); methodImplementation = new MutableMethodImplementation(methodImplementation); Assert.assertEquals(0, methodImplementation.getTryBlocks().get(0).getStartCodeAddress()); Assert.assertEquals(8, methodImplementation.getTryBlocks().get(0).getCodeUnitCount()); }