Java 类org.objectweb.asm.tree.LookupSwitchInsnNode 实例源码

项目:thesis-disassembler    文件:SwitchInsnNodeHandler.java   
private void visitLookupSwitchInsnNode(LookupSwitchInsnNode node) {
    ExpressionStack stack = mState.getActiveStack();
    int defaultLabel = stack.getLabelId(node.dflt.getLabel());
    Map<Integer, String> labelCaseMap = new HashMap<>();
    for (int i = 0; i < node.labels.size(); i++) {
        int labelId = stack.getLabelId(((LabelNode) node.labels.get(i)).getLabel());
        String caseKey = String.valueOf(node.keys.get(i));
        labelCaseMap.put(labelId, caseKey);
    }
    labelCaseMap.put(defaultLabel, SwitchExpression.CaseExpression.DEFAULT);

    SwitchExpression switchExp = new SwitchExpression(node.getOpcode());
    mState.moveNode();
    updateSwitchWithCases(switchExp, defaultLabel, labelCaseMap);
    stack.push(switchExp);
}
项目:QuickTheories    文件:ControlFlowAnalyser.java   
private static Set<AbstractInsnNode> findJumpTargets(final InsnList instructions) {
  final Set<AbstractInsnNode> jumpTargets = new HashSet<AbstractInsnNode>();
  final ListIterator<AbstractInsnNode> it = instructions.iterator();
  while (it.hasNext()) {
    final AbstractInsnNode o = it.next();
    if (o instanceof JumpInsnNode) {
      jumpTargets.add(((JumpInsnNode) o).label);
    } else if (o instanceof TableSwitchInsnNode) {
      final TableSwitchInsnNode twn = (TableSwitchInsnNode) o;
      jumpTargets.add(twn.dflt);
      jumpTargets.addAll(twn.labels);
    } else if (o instanceof LookupSwitchInsnNode) {
      final LookupSwitchInsnNode lsn = (LookupSwitchInsnNode) o;
      jumpTargets.add(lsn.dflt);
      jumpTargets.addAll(lsn.labels);
    }
  }
  return jumpTargets;
}
项目:evosuite    文件:BranchPool.java   
private void registerSwitchInstruction(BytecodeInstruction v) {
    if (!v.isSwitch())
        throw new IllegalArgumentException("expect a switch instruction");

    LabelNode defaultLabel = null;

    switch (v.getASMNode().getOpcode()) {
    case Opcodes.TABLESWITCH:
        TableSwitchInsnNode tableSwitchNode = (TableSwitchInsnNode) v.getASMNode();
        registerTableSwitchCases(v, tableSwitchNode);
        defaultLabel = tableSwitchNode.dflt;

        break;
    case Opcodes.LOOKUPSWITCH:
        LookupSwitchInsnNode lookupSwitchNode = (LookupSwitchInsnNode) v.getASMNode();
        registerLookupSwitchCases(v, lookupSwitchNode);
        defaultLabel = lookupSwitchNode.dflt;
        break;
    default:
        throw new IllegalStateException(
                "expect ASMNode of a switch to either be a LOOKUP- or TABLESWITCH");
    }

    registerDefaultCase(v, defaultLabel);
}
项目:jumbune    文件:CaseAdapter.java   
/**
 * <p>
 * This method finds Switch block in a method and processes it
 * </p>.
 *
 * @param scanStartIndex Start index for the scan
 * @param scanEndIndex End index for the scan
 */
private void instrumentswitchBlock(int scanStartIndex,
        int scanEndIndex) {
    for (scanIndexForswitch = scanStartIndex; scanIndexForswitch <= scanEndIndex; scanIndexForswitch++) {
        AbstractInsnNode currentInsnNode = insnArr[scanIndexForswitch];

        if (currentInsnNode instanceof TableSwitchInsnNode
                && Opcodes.TABLESWITCH == currentInsnNode.getOpcode()) {
            processTableSwitchBlock((TableSwitchInsnNode) currentInsnNode);
        } else if (currentInsnNode instanceof LookupSwitchInsnNode
                && Opcodes.LOOKUPSWITCH == currentInsnNode.getOpcode()) {
            processLookupSwitchBlock((LookupSwitchInsnNode) currentInsnNode);
        }

    }
}
项目:pitest    文件:ControlFlowAnalyser.java   
private static Set<AbstractInsnNode> findJumpTargets(final InsnList instructions) {
  final Set<AbstractInsnNode> jumpTargets = new HashSet<>();
  final ListIterator<AbstractInsnNode> it = instructions.iterator();
  while (it.hasNext()) {
    final AbstractInsnNode o = it.next();
    if (o instanceof JumpInsnNode) {
      jumpTargets.add(((JumpInsnNode) o).label);
    } else if (o instanceof TableSwitchInsnNode) {
      final TableSwitchInsnNode twn = (TableSwitchInsnNode) o;
      jumpTargets.add(twn.dflt);
      jumpTargets.addAll(twn.labels);
    } else if (o instanceof LookupSwitchInsnNode) {
      final LookupSwitchInsnNode lsn = (LookupSwitchInsnNode) o;
      jumpTargets.add(lsn.dflt);
      jumpTargets.addAll(lsn.labels);
    }
  }
  return jumpTargets;
}
项目:r8    文件:JarSourceCode.java   
private void build(LookupSwitchInsnNode insn, IRBuilder builder) {
  processLocalVariablesAtControlEdge(insn, builder);
  int[] keys = new int[insn.keys.size()];
  for (int i = 0; i < insn.keys.size(); i++) {
    keys[i] = (int) insn.keys.get(i);
  }
  buildSwitch(insn.dflt, insn.labels, keys, builder);
}
项目:drift    文件:MethodDefinition.java   
public MethodDefinition switchStatement(String defaultCase, List<CaseStatement> cases)
{
    LabelNode defaultLabel = getLabel(defaultCase);

    int[] keys = new int[cases.size()];
    LabelNode[] labels = new LabelNode[cases.size()];
    for (int i = 0; i < cases.size(); i++) {
        keys[i] = cases.get(i).getKey();
        labels[i] = getLabel(cases.get(i).getLabel());
    }

    instructionList.add(new LookupSwitchInsnNode(defaultLabel, keys, labels));
    return this;
}
项目:JAADAS    文件:AsmMethodSource.java   
private void convertLookupSwitchInsn(LookupSwitchInsnNode insn) {
    StackFrame frame = getFrame(insn);
    if (units.containsKey(insn)) {
        frame.mergeIn(pop());
        return;
    }
    Operand key = popImmediate();
    UnitBox dflt = Jimple.v().newStmtBox(null);

    List<UnitBox> targets = new ArrayList<UnitBox>(insn.labels.size());
    labels.put(insn.dflt, dflt);
    for (LabelNode ln : insn.labels) {
        UnitBox box = Jimple.v().newStmtBox(null);
        targets.add(box);
        labels.put(ln, box);
    }

    List<IntConstant> keys = new ArrayList<IntConstant>(insn.keys.size());
    for (Integer i : insn.keys)
        keys.add(IntConstant.v(i));

    LookupSwitchStmt lss = Jimple.v().newLookupSwitchStmt(key.stackOrValue(),
            keys, targets, dflt);
    key.addBox(lss.getKeyBox());
    frame.in(key);
    frame.boxes(lss.getKeyBox());
    setUnit(insn, lss);
}
项目:thesis-disassembler    文件:SwitchInsnNodeHandler.java   
@Override
public void handle(AbstractInsnNode node) throws IncorrectNodeException {
    super.handle(node);
    LOG.debug(logNode(node));
    if (node instanceof TableSwitchInsnNode) {
        visitTableSwitchInsnNode((TableSwitchInsnNode) node);
    } else if (node instanceof LookupSwitchInsnNode) {
        visitLookupSwitchInsnNode((LookupSwitchInsnNode) node);
    } else {
        throw new IncorrectNodeException("Incorrect node type, expected switch but was " + node.getClass().getSimpleName());
    }
}
项目:fst-jit    文件:FstCompiler.java   
private void testSwitch() {
    InsnList insnList = new InsnList();
    LabelNode defaultLabelNode = new LabelNode(new Label());
    LabelNode[] nodes = new LabelNode[2];
    nodes[0] = new LabelNode(new Label());
    nodes[1] = new LabelNode(new Label());
    nodes[0].accept(ga);
    ga.push(42);
    nodes[1].accept(ga);
    ga.push(43);
    LookupSwitchInsnNode lookupSwitchInsnNode = new LookupSwitchInsnNode(defaultLabelNode, new int[]{1, 2}, nodes);
    insnList.add(lookupSwitchInsnNode);
    insnList.accept(ga);
}
项目:evosuite    文件:BranchPool.java   
private void registerLookupSwitchCases(BytecodeInstruction v,
        LookupSwitchInsnNode lookupSwitchNode) {

    for (int i = 0; i < lookupSwitchNode.keys.size(); i++) {
        LabelNode targetLabel = (LabelNode) lookupSwitchNode.labels.get(i);
        Branch switchBranch = createSwitchCaseBranch(v,
                                                     (Integer) lookupSwitchNode.keys.get(i),
                                                     targetLabel);
        if (!switchBranch.isSwitchCaseBranch() || !switchBranch.isActualCase())
            throw new IllegalStateException(
                    "expect created branch to be an actual case branch of a switch");
    }
}
项目:jumbune    文件:CaseAdapter.java   
/**
 * <p>
 * This method Handled the Switch cases of LookupSwitchInsnNode type in a
 * method
 * </p>.
 *
 * @param currentTableSwithInsn Type of switch block
 */
@SuppressWarnings("unchecked")
private void handleLookupSwitchCases(
        LookupSwitchInsnNode currentTableSwithInsn) {
    List<AbstractInsnNode> caseList = currentTableSwithInsn.labels;
    LabelNode currentLabel = currentTableSwithInsn.dflt;
    List<Integer> casekeys = currentTableSwithInsn.keys;

    int totalcaselogs = casekeys.size() * 2;

    String[] logMsgs = new String[totalcaselogs];
    int[] caseValues = new int[totalcaselogs];
    AbstractInsnNode abstractCaseInsnNode[] = new AbstractInsnNode[totalcaselogs];

    int index = 0;
    for (int i = 0; i < casekeys.size(); i++) {
        abstractCaseInsnNode[index] = caseList.get(i);
        caseValues[index] = casekeys.get(i);
        caseValues[index + 1] = casekeys.get(i);

        AbstractInsnNode nextNode = lookNode(caseList,
                abstractCaseInsnNode[index], currentLabel);

        abstractCaseInsnNode[index + 1] = nextNode;

        logMsgs[index] = InstrumentationMessageLoader
                .getMessage(MessageConstants.MSG_IN_SWITCHCASE);
        logMsgs[index + 1] = InstrumentationMessageLoader
                .getMessage(MessageConstants.MSG_OUT_SWITCHCASE);

        index += 2;
    }

    Integer[] lineNumbers = getLineNumbersForSwitchCase(abstractCaseInsnNode);

    InsnList[] il = getInsnForswitchCaseBlock(logMsgs, caseValues,
            lineNumbers);
    addInsnForswitchBlock(il, abstractCaseInsnNode);
}
项目:jumbune    文件:CaseAdapter.java   
/**
 * <p>
 * This method Handled the Switch block of LookupSwitchInsnNode type in a
 * method
 * </p>.
 *
 * @param currentTableSwithInsn Type of switch block
 */
private void processLookupSwitchBlock(
        LookupSwitchInsnNode currentTableSwithInsn) {
    LabelNode currentLabel = currentTableSwithInsn.dflt;

    int switchStartIndex = CollectionUtil.getObjectIndexInArray(insnArr,
            currentTableSwithInsn);
    int switchTargetIndex = CollectionUtil.getObjectIndexInArray(insnArr,
            currentLabel);

    if (switchTargetIndex > switchStartIndex) {
        LOGGER.debug("switch block ended at: " + switchTargetIndex);
        switchCount++;

        AbstractInsnNode[] ainSwitchBlock = new AbstractInsnNode[] {
                currentTableSwithInsn.getPrevious(), currentLabel };

        Integer[] lineNumbers = getLineNumbersForSwitchBlock(ainSwitchBlock);

        InsnList[] il = getInsnForswitchBlock(switchCount, lineNumbers);
        addInsnForswitchBlock(il, ainSwitchBlock);

        scanIndexForswitch = switchTargetIndex;

        handleLookupSwitchCases(currentTableSwithInsn);
    }
}
项目:grappa    文件:CodeBlock.java   
public CodeBlock lookupswitch(final LabelNode defaultHandler,
    final int[] keys,
    final LabelNode[] handlers)
{
    instructionList.add(new LookupSwitchInsnNode(defaultHandler, keys,
        handlers));
    return this;
}
项目:grappa    文件:CodeBlock.java   
public CodeBlock visitLookupSwitchInsn(final LabelNode defaultHandler,
    final int[] keys, final LabelNode[] handlers)
{
    instructionList.add(new LookupSwitchInsnNode(defaultHandler, keys,
        handlers));
    return this;
}
项目:svm-fasttagging    文件:AsmHelper.java   
public static boolean isBranch (final AbstractInsnNode insn) {
    final int opcode = insn.getOpcode();
    return insn instanceof JumpInsnNode
            || insn instanceof LookupSwitchInsnNode
            || insn instanceof TableSwitchInsnNode
            || opcode == Opcodes.ATHROW || opcode == Opcodes.RET
            || (opcode >= Opcodes.IRETURN && opcode <= Opcodes.RETURN);
}
项目:bytecodelib    文件:MethodResolver.java   
private void interpret(LookupSwitchInsnNode insn, FrameState frame, BBInfo block) {
    assert insn.getOpcode() == Opcodes.LOOKUPSWITCH;
    ConstantFactory cf = module.constants();
    SwitchInst inst = new SwitchInst(frame.stack.pop(), blockByInsn(insn.dflt).block);
    for (int i = 0; i < insn.keys.size(); ++i)
        inst.put(cf.getConstant((Integer)insn.keys.get(i)), blockByInsn((LabelNode)insn.labels.get(i)).block);
    block.block.instructions().add(inst);
}
项目:bytecodelib    文件:MethodUnresolver.java   
private void emit(SwitchInst i, InsnList insns) {
    load(i.getValue(), insns);
    LookupSwitchInsnNode insn = new LookupSwitchInsnNode(null, null, null);
    insn.dflt = labels.get(i.getDefault());
    Iterator<Constant<Integer>> cases = i.cases().iterator();
    Iterator<BasicBlock> targets = i.successors().iterator();
    while (cases.hasNext()) {
        insn.keys.add(cases.next().getConstant());
        insn.labels.add(labels.get(targets.next()));
    }
    insns.add(insn);
}
项目:javaslicer    文件:TracingMethodInstrumenter.java   
private void transformLookupSwitchInsn(final LookupSwitchInsnNode insn) {
    final IntegerMap<LabelNode> handlers = new IntegerMap<LabelNode>(insn.keys.size()*4/3+1);
    assert insn.keys.size() == insn.labels.size();
    for (int i = 0; i < insn.keys.size(); ++i)
        handlers.put((Integer)insn.keys.get(i), (LabelNode)insn.labels.get(i));
    final LookupSwitchInstruction instr = new LookupSwitchInstruction(this.readMethod, this.currentLine, null, null);
    this.lookupSwitchInstructions.put(instr, new Pair<LabelNode, IntegerMap<LabelNode>>(insn.dflt, handlers));
    registerInstruction(instr, InstructionType.UNSAFE);
}
项目:r8    文件:JarSourceCode.java   
private void updateState(AbstractInsnNode insn) {
  switch (insn.getType()) {
    case AbstractInsnNode.INSN:
      updateState((InsnNode) insn);
      break;
    case AbstractInsnNode.INT_INSN:
      updateState((IntInsnNode) insn);
      break;
    case AbstractInsnNode.VAR_INSN:
      updateState((VarInsnNode) insn);
      break;
    case AbstractInsnNode.TYPE_INSN:
      updateState((TypeInsnNode) insn);
      break;
    case AbstractInsnNode.FIELD_INSN:
      updateState((FieldInsnNode) insn);
      break;
    case AbstractInsnNode.METHOD_INSN:
      updateState((MethodInsnNode) insn);
      break;
    case AbstractInsnNode.INVOKE_DYNAMIC_INSN:
      updateState((InvokeDynamicInsnNode) insn);
      break;
    case AbstractInsnNode.JUMP_INSN:
      updateState((JumpInsnNode) insn);
      break;
    case AbstractInsnNode.LABEL:
      updateState((LabelNode) insn);
      break;
    case AbstractInsnNode.LDC_INSN:
      updateState((LdcInsnNode) insn);
      break;
    case AbstractInsnNode.IINC_INSN:
      updateState((IincInsnNode) insn);
      break;
    case AbstractInsnNode.TABLESWITCH_INSN:
      updateState((TableSwitchInsnNode) insn);
      break;
    case AbstractInsnNode.LOOKUPSWITCH_INSN:
      updateState((LookupSwitchInsnNode) insn);
      break;
    case AbstractInsnNode.MULTIANEWARRAY_INSN:
      updateState((MultiANewArrayInsnNode) insn);
      break;
    case AbstractInsnNode.LINE:
      updateState((LineNumberNode) insn);
      break;
    default:
      throw new Unreachable("Unexpected instruction " + insn);
  }
}
项目:r8    文件:JarSourceCode.java   
private void updateState(LookupSwitchInsnNode insn) {
  state.pop();
}
项目:r8    文件:JarSourceCode.java   
private void build(AbstractInsnNode insn, IRBuilder builder) {
  switch (insn.getType()) {
    case AbstractInsnNode.INSN:
      build((InsnNode) insn, builder);
      break;
    case AbstractInsnNode.INT_INSN:
      build((IntInsnNode) insn, builder);
      break;
    case AbstractInsnNode.VAR_INSN:
      build((VarInsnNode) insn, builder);
      break;
    case AbstractInsnNode.TYPE_INSN:
      build((TypeInsnNode) insn, builder);
      break;
    case AbstractInsnNode.FIELD_INSN:
      build((FieldInsnNode) insn, builder);
      break;
    case AbstractInsnNode.METHOD_INSN:
      build((MethodInsnNode) insn, builder);
      break;
    case AbstractInsnNode.INVOKE_DYNAMIC_INSN:
      build((InvokeDynamicInsnNode) insn, builder);
      break;
    case AbstractInsnNode.JUMP_INSN:
      build((JumpInsnNode) insn, builder);
      break;
    case AbstractInsnNode.LABEL:
      build((LabelNode) insn, builder);
      break;
    case AbstractInsnNode.LDC_INSN:
      build((LdcInsnNode) insn, builder);
      break;
    case AbstractInsnNode.IINC_INSN:
      build((IincInsnNode) insn, builder);
      break;
    case AbstractInsnNode.TABLESWITCH_INSN:
      build((TableSwitchInsnNode) insn, builder);
      break;
    case AbstractInsnNode.LOOKUPSWITCH_INSN:
      build((LookupSwitchInsnNode) insn, builder);
      break;
    case AbstractInsnNode.MULTIANEWARRAY_INSN:
      build((MultiANewArrayInsnNode) insn, builder);
      break;
    case AbstractInsnNode.LINE:
      build((LineNumberNode) insn, builder);
      break;
    default:
      throw new Unreachable("Unexpected instruction " + insn);
  }
}
项目:asm-framework-full    文件:StraightLine.java   
@Override
public boolean matches(ClassMethod method) {
    return method.count(insn -> insn instanceof JumpInsnNode || insn instanceof TableSwitchInsnNode ||
        insn instanceof LookupSwitchInsnNode) == 0;
}
项目:jephyr    文件:AnalyzingMethodNode.java   
@Override
public final void visitLookupSwitchInsn(Label dflt, int[] keys, Label[] labels) {
    LookupSwitchInsnNode node = new LookupSwitchInsnNode(getLabelNode(dflt), keys, getLabelNodes(labels));
    instructions.add(node);
    addFrame(node);
}
项目:BitPlus    文件:TreeBuilder.java   
public static TreeSize getTreeSize(AbstractInsnNode ain) {
    int c = 0, p = 0;
    if (ain instanceof InsnNode || ain instanceof IntInsnNode || ain instanceof VarInsnNode
            || ain instanceof JumpInsnNode || ain instanceof TableSwitchInsnNode
            || ain instanceof LookupSwitchInsnNode) {
        c = CDS[ain.opcode()];
        p = PDS[ain.opcode()];
    } else if (ain instanceof FieldInsnNode) {
        FieldInsnNode fin = (FieldInsnNode) ain;
        char d = fin.desc.charAt(0);
        switch (fin.opcode()) {
        case GETFIELD: {
            c = 1;
            p = d == 'D' || d == 'J' ? 2 : 1;
            break;
        }
        case GETSTATIC: {
            c = 0;
            p = d == 'D' || d == 'J' ? 2 : 1;
            break;
        }
        case PUTFIELD: {
            c = d == 'D' || d == 'J' ? 3 : 2;
            p = 0;
            break;
        }
        case PUTSTATIC: {
            c = d == 'D' || d == 'J' ? 2 : 1;
            p = 0;
            break;
        }
        default: {
            c = 0;
            p = 0;
            break;
        }
        }
    } else if (ain instanceof MethodInsnNode) {
        MethodInsnNode min = (MethodInsnNode) ain;
        int as = Type.getArgumentsAndReturnSizes(min.desc);
        c = (as >> 2) - (min.opcode() == INVOKEDYNAMIC || min.opcode() == INVOKESTATIC ? 1 : 0);
        p = as & 0x03;
    } else if (ain instanceof LdcInsnNode) {
        Object cst = ((LdcInsnNode) ain).cst;
        p = cst instanceof Double || cst instanceof Long ? 2 : 1;
    } else if (ain instanceof MultiANewArrayInsnNode) {
        c = ((MultiANewArrayInsnNode) ain).dims;
        p = 1;
    }
    return new TreeSize(c, p);
}
项目:BitPlus    文件:Assembly.java   
public static boolean instructionsEqual(AbstractInsnNode insn1, AbstractInsnNode insn2) {
    if (insn1 == insn2) {
        return true;
    }
    if (insn1 == null || insn2 == null || insn1.type() != insn2.type() ||
            insn1.opcode() != insn2.opcode()) {
        return false;
    }
    int size;
    switch (insn1.type()) {
        case INSN:
            return true;
        case INT_INSN:
            IntInsnNode iin1 = (IntInsnNode) insn1, iin2 = (IntInsnNode) insn2;
            return iin1.operand == iin2.operand;
        case VAR_INSN:
            VarInsnNode vin1 = (VarInsnNode) insn1, vin2 = (VarInsnNode) insn2;
            return vin1.var == vin2.var;
        case TYPE_INSN:
            TypeInsnNode tin1 = (TypeInsnNode) insn1, tin2 = (TypeInsnNode) insn2;
            return tin1.desc.equals(tin2.desc);
        case FIELD_INSN:
            FieldInsnNode fin1 = (FieldInsnNode) insn1, fin2 = (FieldInsnNode) insn2;
            return fin1.desc.equals(fin2.desc) && fin1.name.equals(fin2.name) && fin1.owner.equals(fin2.owner);
        case METHOD_INSN:
            MethodInsnNode min1 = (MethodInsnNode) insn1, min2 = (MethodInsnNode) insn2;
            return min1.desc.equals(min2.desc) && min1.name.equals(min2.name) && min1.owner.equals(min2.owner);
        case INVOKE_DYNAMIC_INSN:
            InvokeDynamicInsnNode idin1 = (InvokeDynamicInsnNode) insn1, idin2 = (InvokeDynamicInsnNode) insn2;
            return idin1.bsm.equals(idin2.bsm) && Arrays.equals(idin1.bsmArgs, idin2.bsmArgs) &&
                    idin1.desc.equals(idin2.desc) && idin1.name.equals(idin2.name);
        case JUMP_INSN:
            JumpInsnNode jin1 = (JumpInsnNode) insn1, jin2 = (JumpInsnNode) insn2;
            return instructionsEqual(jin1.label, jin2.label);
        case LABEL:
            Label label1 = ((LabelNode) insn1).getLabel(), label2 = ((LabelNode) insn2).getLabel();
            return label1 == null ? label2 == null : label1.info == null ? label2.info == null :
                    label1.info.equals(label2.info);
        case LDC_INSN:
            LdcInsnNode lin1 = (LdcInsnNode) insn1, lin2 = (LdcInsnNode) insn2;
            return lin1.cst.equals(lin2.cst);
        case IINC_INSN:
            IincInsnNode iiin1 = (IincInsnNode) insn1, iiin2 = (IincInsnNode) insn2;
            return iiin1.incr == iiin2.incr && iiin1.var == iiin2.var;
        case TABLESWITCH_INSN:
            TableSwitchInsnNode tsin1 = (TableSwitchInsnNode) insn1, tsin2 = (TableSwitchInsnNode) insn2;
            size = tsin1.labels.size();
            if (size != tsin2.labels.size()) {
                return false;
            }
            for (int i = 0; i < size; i++) {
                if (!instructionsEqual(tsin1.labels.get(i), tsin2.labels.get(i))) {
                    return false;
                }
            }
            return instructionsEqual(tsin1.dflt, tsin2.dflt) && tsin1.max == tsin2.max && tsin1.min == tsin2.min;
        case LOOKUPSWITCH_INSN:
            LookupSwitchInsnNode lsin1 = (LookupSwitchInsnNode) insn1, lsin2 = (LookupSwitchInsnNode) insn2;
            size = lsin1.labels.size();
            if (size != lsin2.labels.size()) {
                return false;
            }
            for (int i = 0; i < size; i++) {
                if (!instructionsEqual(lsin1.labels.get(i), lsin2.labels.get(i))) {
                    return false;
                }
            }
            return instructionsEqual(lsin1.dflt, lsin2.dflt) && lsin1.keys.equals(lsin2.keys);
        case MULTIANEWARRAY_INSN:
            MultiANewArrayInsnNode manain1 = (MultiANewArrayInsnNode) insn1, manain2 = (MultiANewArrayInsnNode) insn2;
            return manain1.desc.equals(manain2.desc) && manain1.dims == manain2.dims;
        case FRAME:
            FrameNode fn1 = (FrameNode) insn1, fn2 = (FrameNode) insn2;
            return fn1.local.equals(fn2.local) && fn1.stack.equals(fn2.stack);
        case LINE:
            LineNumberNode lnn1 = (LineNumberNode) insn1, lnn2 = (LineNumberNode) insn2;
            return lnn1.line == lnn2.line && instructionsEqual(lnn1.start, lnn2.start);
    }
    return false;
}
项目:jbm    文件:LookupSwitchInstruction.java   
public LookupSwitchInstruction(MethodElement method, LookupSwitchInsnNode node) {
    super(method, node);
}
项目:bytecodelib    文件:MethodResolver.java   
private void buildInstructions(BBInfo block) {
    FrameState frame = block.entryState.copy();
    for (int i = block.start; i < block.end; ++i) {
        AbstractInsnNode insn = methodNode.instructions.get(i);
        if (insn.getOpcode() == -1) continue;//pseudo-instruction node
        if (insn instanceof FieldInsnNode)
            interpret((FieldInsnNode)insn, frame, block);
        else if (insn instanceof IincInsnNode)
            interpret((IincInsnNode)insn, frame, block);
        else if (insn instanceof InsnNode)
            interpret((InsnNode)insn, frame, block);
        else if (insn instanceof IntInsnNode)
            interpret((IntInsnNode)insn, frame, block);
        else if (insn instanceof InvokeDynamicInsnNode)
            interpret((InvokeDynamicInsnNode)insn, frame, block);
        else if (insn instanceof JumpInsnNode)
            interpret((JumpInsnNode)insn, frame, block);
        else if (insn instanceof LdcInsnNode)
            interpret((LdcInsnNode)insn, frame, block);
        else if (insn instanceof LookupSwitchInsnNode)
            interpret((LookupSwitchInsnNode)insn, frame, block);
        else if (insn instanceof MethodInsnNode)
            interpret((MethodInsnNode)insn, frame, block);
        else if (insn instanceof MultiANewArrayInsnNode)
            interpret((MultiANewArrayInsnNode)insn, frame, block);
        else if (insn instanceof TableSwitchInsnNode)
            interpret((TableSwitchInsnNode)insn, frame, block);
        else if (insn instanceof TypeInsnNode)
            interpret((TypeInsnNode)insn, frame, block);
        else if (insn instanceof VarInsnNode)
            interpret((VarInsnNode)insn, frame, block);
    }

    //If the block doesn't have a TerminatorInst, add a JumpInst to the
    //fallthrough block.  (This occurs when blocks begin due to being a
    //jump target rather than due to a terminator opcode.)
    if (block.block.getTerminator() == null)
        block.block.instructions().add(new JumpInst(blocks.get(blocks.indexOf(block)+1).block));

    for (BasicBlock b : block.block.successors())
        for (BBInfo bi : blocks)
            if (bi.block == b) {
                merge(block, frame, bi);
                break;
            }
}
项目:evosuite    文件:ASMWrapper.java   
/**
 * <p>
 * isLookupSwitch
 * </p>
 * 
 * @return a boolean.
 */
public boolean isLookupSwitch() {
    return (asmNode instanceof LookupSwitchInsnNode);
}