Package org.aspectj.apache.bcel.generic

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


          // assert this is a GOTO
          // this was a return instruction we previously replaced
        } else {
          branch.setTarget(newTarget);
          if (branch instanceof Select) {
            Select select = (Select) branch;
            InstructionHandle[] oldTargets = select.getTargets();
            for (int k = oldTargets.length - 1; k >= 0; k--) {
              select.setTarget(
                k,
                (InstructionHandle) srcToDest.get(oldTargets[k]));
            }
          }
        }
View Full Code Here


              BranchInstruction freshBranch = (BranchInstruction) freshI;
        InstructionHandle oldTarget = oldBranch.getTarget();
        oldTarget.removeTargeter(oldBranch);
        oldTarget.addTargeter(freshBranch);
        if (freshBranch instanceof Select) {
          Select oldSelect = (Select) oldI;
          Select freshSelect = (Select) freshI;
          InstructionHandle[] oldTargets = freshSelect.getTargets();
          for (int k = oldTargets.length - 1; k >= 0; k--) {
            oldTargets[k].removeTargeter(oldSelect);
            oldTargets[k].addTargeter(freshSelect);
          }
        }
View Full Code Here

      *     "use Utility.copyInstruction to work-around bug in Select.copy()";
      * </pre>
      */
  public static Instruction copyInstruction(Instruction i) {
    if (i instanceof Select) {
      Select freshSelect = (Select)i;
         
      // Create a new targets array that looks just like the existing one
      InstructionHandle[] targets = new InstructionHandle[freshSelect.getTargets().length];
      for (int ii = 0; ii < targets.length; ii++) {
        targets[ii] = freshSelect.getTargets()[ii];
      }
         
      // Create a new select statement with the new targets array
      SWITCH switchStatement =
        new SWITCH(freshSelect.getMatchs(), targets, freshSelect.getTarget());
      return (Select)switchStatement.getInstruction()
    } else {
      return i.copy(); // Use clone for shallow copy...
    }
  }
View Full Code Here

    }
    InstructionHandle target = ih.getTarget();
    assertInBody(target, body, from);
    assertTargetedBy(target, inst, from);
    if (inst instanceof Select) {
      Select sel = (Select) inst;
            InstructionHandle[] itargets = sel.getTargets();
            for (int k = itargets.length - 1; k >= 0; k--) {
        assertInBody(itargets[k], body, from);
        assertTargetedBy(itargets[k], inst, from);
            }
        }
View Full Code Here

      }
    } else if (targeter instanceof BranchInstruction) {
      BranchInstruction bi = (BranchInstruction) targeter;
      if (bi.getTarget() == target) return;
      if (targeter instanceof Select) {
        Select sel = (Select) targeter;
              InstructionHandle[] itargets = sel.getTargets();
              for (int k = itargets.length - 1; k >= 0; k--) {
          if (itargets[k] == target) return;
              }
      }     
    } else if (targeter instanceof Tag) {
View Full Code Here

                CPInstruction cpinst = (CPInstruction) inst;
                out.print(Constants.OPCODE_NAMES[cpinst.getOpcode()].toUpperCase());
                out.print(" ");
                out.print(pool.constantToString(pool.getConstant(cpinst.getIndex())));
            } else if (inst instanceof Select) {
                Select sinst = (Select) inst;
                out.println(Constants.OPCODE_NAMES[sinst.getOpcode()].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]);
View Full Code Here

TOP

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

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.