Example usage for org.objectweb.asm Opcodes TABLESWITCH

List of usage examples for org.objectweb.asm Opcodes TABLESWITCH

Introduction

In this page you can find the example usage for org.objectweb.asm Opcodes TABLESWITCH.

Prototype

int TABLESWITCH

To view the source code for org.objectweb.asm Opcodes TABLESWITCH.

Click Source Link

Usage

From source file:org.sonar.java.bytecode.cfg.BytecodeCFGMethodVisitor.java

License:Open Source License

@Override
public void visitTableSwitchInsn(int min, int max, Label dflt, Label... labels) {
    currentBlock.terminator = new Instruction(Opcodes.TABLESWITCH);
    blockByLabel.computeIfAbsent(dflt, l -> currentBlock.createSuccessor());
    for (Label label : labels) {
        blockByLabel.computeIfAbsent(label, l -> currentBlock.createSuccessor());
    }//from   www  . j  a  v  a2 s. c o m
}

From source file:v6.java.preverifier.MethodRewriter.java

License:Open Source License

/**
 * Visit the specified instruction and do the right thing.
 * //from  w  ww . j a va 2s.  com
 * @param method
 * @param region
 * @param insnNode
 * @throws AnalyzerException
 */
private void visitInstruction(MethodNode method, Region region, AbstractInsnNode insnNode)
        throws AnalyzerException {
    int opcode = insnNode.getOpcode();
    switch (opcode) {
    case Opcodes.JSR:
        visitJumpToSubroutine(method, region, (JumpInsnNode) insnNode);
        break;

    case Opcodes.IFEQ:
    case Opcodes.IFNE:
    case Opcodes.IFLT:
    case Opcodes.IFGE:
    case Opcodes.IFGT:
    case Opcodes.IFLE:
    case Opcodes.IF_ICMPEQ:
    case Opcodes.IF_ICMPNE:
    case Opcodes.IF_ICMPLT:
    case Opcodes.IF_ICMPGE:
    case Opcodes.IF_ICMPGT:
    case Opcodes.IF_ICMPLE:
    case Opcodes.IF_ACMPEQ:
    case Opcodes.IF_ACMPNE:
    case Opcodes.GOTO:
    case Opcodes.IFNULL:
    case Opcodes.IFNONNULL:
        visitJump(method, region, (JumpInsnNode) insnNode);
        break;

    case Opcodes.LOOKUPSWITCH:
        visitLookupSwitch(method, region, (LookupSwitchInsnNode) insnNode);
        break;

    case Opcodes.TABLESWITCH:
        visitTableSwitch(method, region, (TableSwitchInsnNode) insnNode);
        break;

    default:
        insnNode.accept(method);
    }
}