Package com.strobel.assembler.ir

Examples of com.strobel.assembler.ir.ExceptionBlock


                        return Integer.compare(o1.getBlockIndex(), o2.getBlockIndex());
                    }
                }
            );

            final ExceptionBlock tryBlock = new ExceptionBlock(
                instructions.atOffset(entry.getStartOffset()),
                instructions.atOffset(entry.getEndOffset())
            );

            if (entry.getCatchType() == null) {
                handlers.add(
                    ExceptionHandler.createFinally(
                        tryBlock,
                        new ExceptionBlock(handlerStart, lastOrDefault(dominatedNodes).getEnd())
                    )
                );
            }
            else {
                handlers.add(
                    ExceptionHandler.createCatch(
                        tryBlock,
                        new ExceptionBlock(handlerStart, lastOrDefault(dominatedNodes).getEnd()),
                        entry.getCatchType()
                    )
                );
            }
        }
View Full Code Here


            final ExceptionHandler handler;

            if (catchType == null) {
                handler = ExceptionHandler.createFinally(
                    new ExceptionBlock(firstInstruction, lastInstruction),
                    new ExceptionBlock(handlerFirstInstruction, handlerLastInstruction)
                );
            }
            else {
                handler = ExceptionHandler.createCatch(
                    new ExceptionBlock(firstInstruction, lastInstruction),
                    new ExceptionBlock(handlerFirstInstruction, handlerLastInstruction),
                    catchType
                );
            }

            exceptionHandlers.add(handler);
View Full Code Here

        if (catchType != null) {
            output.write(' ');
            writeType(output, catchType);
        }

        final ExceptionBlock handlerBlock = handler.getHandlerBlock();

        output.write(' ');
        writeOffsetReference(output, handlerBlock.getFirstInstruction());

        if (handlerBlock.getLastInstruction() != null) {
            output.write(" - ");
            writeEndOffsetReference(output, handlerBlock.getLastInstruction());
        }
    }
View Full Code Here

        _blockIndex = blockIndex;
        _exceptionHandler = VerifyArgument.notNull(exceptionHandler, "exceptionHandler");
        _nodeType = exceptionHandler.isFinally() ? ControlFlowNodeType.FinallyHandler : ControlFlowNodeType.CatchHandler;
        _endFinallyNode = endFinallyNode;

        final ExceptionBlock handlerBlock = exceptionHandler.getHandlerBlock();

//        _start = handlerBlock.getFirstInstruction();
//        _end = handlerBlock.getLastInstruction();
        _start = null;
        _end = null;
        _offset = handlerBlock.getFirstInstruction().getOffset(); //_start.getOffset();
    }
View Full Code Here

        return index;
    }

    private ExceptionHandler findInnermostExceptionHandler(final int offsetInTryBlock) {
        for (final ExceptionHandler handler : _exceptionHandlers) {
            final ExceptionBlock tryBlock = handler.getTryBlock();

            if (tryBlock.getFirstInstruction().getOffset() <= offsetInTryBlock &&
                offsetInTryBlock < tryBlock.getLastInstruction().getEndOffset()) {

                return handler;
            }
        }
View Full Code Here

        for (final ExceptionHandler handler : _exceptionHandlers) {
            if (!handler.isFinally()) {
                continue;
            }

            final ExceptionBlock tryBlock = handler.getTryBlock();

            if (tryBlock.getFirstInstruction().getOffset() <= offsetInTryBlock &&
                offsetInTryBlock < tryBlock.getLastInstruction().getEndOffset()) {

                return handler;
            }
        }
View Full Code Here

        return null;
    }

    private ControlFlowNode findInnermostHandlerBlock(final int instructionOffset) {
        for (final ExceptionHandler handler : _exceptionHandlers) {
            final ExceptionBlock tryBlock = handler.getTryBlock();
            final ExceptionBlock handlerBlock = handler.getHandlerBlock();

            if ((tryBlock.getFirstInstruction().getOffset() <= instructionOffset &&
                 instructionOffset < tryBlock.getLastInstruction().getEndOffset()) ||
                (handlerBlock.getFirstInstruction().getOffset() <= instructionOffset &&
                 instructionOffset < handlerBlock.getLastInstruction().getEndOffset())) {

                for (final ControlFlowNode node : _nodes) {
                    if (node.getExceptionHandler() == handler && node.getCopyFrom() == null) {
                        return node;
                    }
View Full Code Here

            if (!handler.isCatch()) {
                continue;
            }

            final ExceptionBlock tryBlock = handler.getTryBlock();
            final ExceptionBlock handlerBlock = handler.getHandlerBlock();

            for (int j = i + 1; j < copy.size(); j++) {
                final ExceptionHandler other = copy.get(j);

                if (!other.isCatch()) {
                    continue;
                }

                final ExceptionBlock otherTry = other.getTryBlock();
                final ExceptionBlock otherHandler = other.getHandlerBlock();

                if (otherTry.getFirstInstruction().getOffset() == tryBlock.getFirstInstruction().getOffset() &&
                    otherTry.getLastInstruction().getOffset() == tryBlock.getLastInstruction().getOffset() &&
                    otherHandler.getFirstInstruction().getOffset() == handlerBlock.getFirstInstruction().getOffset() &&
                    otherHandler.getLastInstruction().getOffset() == handlerBlock.getLastInstruction().getOffset()) {

                    copy.set(
                        i,
                        ExceptionHandler.createCatch(
                            tryBlock,
View Full Code Here

TOP

Related Classes of com.strobel.assembler.ir.ExceptionBlock

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.