Package org.aspectj.apache.bcel.generic

Examples of org.aspectj.apache.bcel.generic.Instruction


        handleRangeInstruction(oldInstructionHandle, exceptionList);
        // just increment ih.
        oldInstructionHandle = oldInstructionHandle.getNext();
      } else {
        // assert map.get(ih) == jh
        Instruction oldInstruction = oldInstructionHandle.getInstruction();
        Instruction newInstruction = newInstructionHandle.getInstruction();

        if (oldInstruction instanceof InstructionBranch) {
          handleBranchInstruction(map, oldInstruction, newInstruction);
        }
View Full Code Here


    Set<InstructionHandle> forDeletion = new HashSet<InstructionHandle>();
    Set<BranchHandle> branchInstructions = new HashSet<BranchHandle>();
    // OPTIMIZE sort out in here: getRange()/insertHandler() and type of
    // exceptionList
    while (iHandle != null) {
      Instruction inst = iHandle.getInstruction();
      // InstructionHandle nextInst = iHandle.getNext();
      // OPTIMIZE remove this instructionhandle as it now points to
      // nowhere?
      if (inst == Range.RANGEINSTRUCTION) {
        Range r = Range.getRange(iHandle);
View Full Code Here

    Map<InstructionHandle, InstructionHandle> map = new HashMap<InstructionHandle, InstructionHandle>();
    for (InstructionHandle ih = getBody().getStart(); ih != null; ih = ih.getNext()) {
      if (Range.isRangeHandle(ih)) {
        continue;
      }
      Instruction inst = ih.getInstruction();
      Instruction copy = Utility.copyInstruction(inst);

      if (copy instanceof InstructionBranch) {
        map.put(ih, intoList.append((InstructionBranch) copy));
      } else {
        map.put(ih, intoList.append(copy));
View Full Code Here

      }
    }
  }

  private static void assertGoodHandle(InstructionHandle ih, Set body, Stack<Range> ranges, String from) {
    Instruction inst = ih.getInstruction();
    if ((inst instanceof InstructionBranch) ^ (ih instanceof BranchHandle)) {
      throw new BCException("bad instruction/handle pair in " + from);
    }
    if (Range.isRangeHandle(ih)) {
      assertGoodRangeHandle(ih, body, ranges, from);
View Full Code Here

    void printInstruction(InstructionHandle h, int depth) {
      printDepth(depth);
      printLabel(labelMap.get(h), depth);

      Instruction inst = h.getInstruction();
      if (inst.isConstantPoolInstruction()) {
        out.print(Constants.OPCODE_NAMES[inst.opcode].toUpperCase());
        out.print(" ");
        out.print(pool.constantToString(pool.getConstant(inst.getIndex())));
      } else if (inst instanceof InstructionSelect) {
        InstructionSelect sinst = (InstructionSelect) inst;
        out.println(Constants.OPCODE_NAMES[sinst.opcode].toUpperCase());
        int[] matches = sinst.getMatchs();
        InstructionHandle[] targets = sinst.getTargets();
        InstructionHandle defaultTarget = sinst.getTarget();
        for (int i = 0, len = matches.length; i < len; i++) {
          printDepth(depth);
          printLabel(null, depth);
          out.print("  ");
          out.print(matches[i]);
          out.print(": \t");
          out.println(labelMap.get(targets[i]));
        }
        printDepth(depth);
        printLabel(null, depth);
        out.print("  ");
        out.print("default: \t");
        out.print(labelMap.get(defaultTarget));
      } else if (inst instanceof InstructionBranch) {
        InstructionBranch brinst = (InstructionBranch) inst;
        out.print(Constants.OPCODE_NAMES[brinst.getOpcode()].toUpperCase());
        out.print(" ");
        out.print(labelMap.get(brinst.getTarget()));
      } else if (inst.isLocalVariableInstruction()) {
        // LocalVariableInstruction lvinst = (LocalVariableInstruction)
        // inst;
        out.print(inst.toString(false).toUpperCase());
        int index = inst.getIndex();
        LocalVariableTag tag = getLocalVariableTag(h, index);
        if (tag != null) {
          out.print("     // ");
          out.print(tag.getType());
          out.print(" ");
          out.print(tag.getName());
        }
      } else {
        out.print(inst.toString(false).toUpperCase());
      }
    }
View Full Code Here

        handleRangeInstruction(oldInstructionHandle, exceptionList);
        // just increment ih.
        oldInstructionHandle = oldInstructionHandle.getNext();
      } else {
        // assert map.get(ih) == jh
        Instruction oldInstruction = oldInstructionHandle.getInstruction();
        Instruction newInstruction = newInstructionHandle.getInstruction();

        if (oldInstruction instanceof InstructionBranch) {
          handleBranchInstruction(map, oldInstruction, newInstruction);
        }
View Full Code Here

    Set<InstructionHandle> forDeletion = new HashSet<InstructionHandle>();
    Set<BranchHandle> branchInstructions = new HashSet<BranchHandle>();
    // OPTIMIZE sort out in here: getRange()/insertHandler() and type of
    // exceptionList
    while (iHandle != null) {
      Instruction inst = iHandle.getInstruction();
      // InstructionHandle nextInst = iHandle.getNext();
      // OPTIMIZE remove this instructionhandle as it now points to
      // nowhere?
      if (inst == Range.RANGEINSTRUCTION) {
        Range r = Range.getRange(iHandle);
View Full Code Here

    Map<InstructionHandle, InstructionHandle> map = new HashMap<InstructionHandle, InstructionHandle>();
    for (InstructionHandle ih = getBody().getStart(); ih != null; ih = ih.getNext()) {
      if (Range.isRangeHandle(ih)) {
        continue;
      }
      Instruction inst = ih.getInstruction();
      Instruction copy = Utility.copyInstruction(inst);

      if (copy instanceof InstructionBranch) {
        map.put(ih, intoList.append((InstructionBranch) copy));
      } else {
        map.put(ih, intoList.append(copy));
View Full Code Here

      }
    }
  }

  private static void assertGoodHandle(InstructionHandle ih, Set body, Stack<Range> ranges, String from) {
    Instruction inst = ih.getInstruction();
    if ((inst instanceof InstructionBranch) ^ (ih instanceof BranchHandle)) {
      throw new BCException("bad instruction/handle pair in " + from);
    }
    if (Range.isRangeHandle(ih)) {
      assertGoodRangeHandle(ih, body, ranges, from);
View Full Code Here

    void printInstruction(InstructionHandle h, int depth) {
      printDepth(depth);
      printLabel(labelMap.get(h), depth);

      Instruction inst = h.getInstruction();
      if (inst.isConstantPoolInstruction()) {
        out.print(Constants.OPCODE_NAMES[inst.opcode].toUpperCase());
        out.print(" ");
        out.print(pool.constantToString(pool.getConstant(inst.getIndex())));
      } else if (inst instanceof InstructionSelect) {
        InstructionSelect sinst = (InstructionSelect) inst;
        out.println(Constants.OPCODE_NAMES[sinst.opcode].toUpperCase());
        int[] matches = sinst.getMatchs();
        InstructionHandle[] targets = sinst.getTargets();
        InstructionHandle defaultTarget = sinst.getTarget();
        for (int i = 0, len = matches.length; i < len; i++) {
          printDepth(depth);
          printLabel(null, depth);
          out.print("  ");
          out.print(matches[i]);
          out.print(": \t");
          out.println(labelMap.get(targets[i]));
        }
        printDepth(depth);
        printLabel(null, depth);
        out.print("  ");
        out.print("default: \t");
        out.print(labelMap.get(defaultTarget));
      } else if (inst instanceof InstructionBranch) {
        InstructionBranch brinst = (InstructionBranch) inst;
        out.print(Constants.OPCODE_NAMES[brinst.getOpcode()].toUpperCase());
        out.print(" ");
        out.print(labelMap.get(brinst.getTarget()));
      } else if (inst.isLocalVariableInstruction()) {
        // LocalVariableInstruction lvinst = (LocalVariableInstruction)
        // inst;
        out.print(inst.toString(false).toUpperCase());
        int index = inst.getIndex();
        LocalVariableTag tag = getLocalVariableTag(h, index);
        if (tag != null) {
          out.print("     // ");
          out.print(tag.getType());
          out.print(" ");
          out.print(tag.getName());
        }
      } else {
        out.print(inst.toString(false).toUpperCase());
      }
    }
View Full Code Here

TOP

Related Classes of org.aspectj.apache.bcel.generic.Instruction

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.