Package org.teavm.model.util

Examples of org.teavm.model.util.InstructionTransitionExtractor


    private boolean hasProperLastInstruction(BasicBlock basicBlock) {
        Instruction lastInsn = basicBlock.getLastInstruction();
        if (lastInsn == null) {
            return false;
        }
        InstructionTransitionExtractor extractor = new InstructionTransitionExtractor();
        lastInsn.acceptVisitor(extractor);
        return extractor.getTargets() != null;
    }
View Full Code Here


public class UnreachableBasicBlockEliminator {
    public void optimize(Program program) {
        if (program.basicBlockCount() == 0) {
            return;
        }
        InstructionTransitionExtractor transitionExtractor = new InstructionTransitionExtractor();
        boolean[] reachable = new boolean[program.basicBlockCount()];
        IntegerStack stack = new IntegerStack(program.basicBlockCount());
        stack.push(0);
        while (!stack.isEmpty()) {
            int i = stack.pop();
            if (reachable[i]) {
                continue;
            }
            reachable[i] = true;
            BasicBlock block = program.basicBlockAt(i);
            block.getLastInstruction().acceptVisitor(transitionExtractor);
            for (BasicBlock successor : transitionExtractor.getTargets()) {
                if (!reachable[successor.getIndex()]) {
                    stack.push(successor.getIndex());
                }
            }
            for (TryCatchBlock tryCatch : block.getTryCatchBlocks()) {
View Full Code Here

TOP

Related Classes of org.teavm.model.util.InstructionTransitionExtractor

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.