Package org.apache.bcel.generic

Examples of org.apache.bcel.generic.Select


    public void visitBranchInstruction( BranchInstruction bi ) {
        BranchHandle bh = (BranchHandle) branch_map.get(bi);
        int pos = bh.getPosition();
        String name = bi.getName() + "_" + pos;
        if (bi instanceof Select) {
            Select s = (Select) bi;
            branches.add(bi);
            StringBuffer args = new StringBuffer("new int[] { ");
            int[] matchs = s.getMatchs();
            for (int i = 0; i < matchs.length; i++) {
                args.append(matchs[i]);
                if (i < matchs.length - 1) {
                    args.append(", ");
                }
View Full Code Here


        out.println(str);
    }

      if(inst instanceof BranchInstruction) {
  if(inst instanceof Select) { // Special cases LOOKUPSWITCH and TABLESWITCH
    Select              s       = (Select)inst;
    int[]               matchs  = s.getMatchs();
    InstructionHandle[] targets = s.getTargets();
   
    if(s instanceof TABLESWITCH) {
      out.println("\ttableswitch " + matchs[0] + " " +
      matchs[matchs.length - 1]);
     
      for(int j=0; j < targets.length; j++) {
            out.println("\t\t" + get(targets[j]));
        }

    } else { // LOOKUPSWITCH
      out.println("\tlookupswitch ");

      for(int j=0; j < targets.length; j++) {
            out.println("\t\t" + matchs[j] + " : " + get(targets[j]));
        }
    }

    out.println("\t\tdefault: " + get(s.getTarget())); // Applies for both
  } else {
    BranchInstruction bi  = (BranchInstruction)inst;
    ih  = bi.getTarget();
    str = get(ih);
    out.println("\t" + Constants.OPCODE_NAMES[bi.getOpcode()] + " " + str);
View Full Code Here

  }
 
  @Override
  public void visitMultiBranchIntermediate(MultiBranchIntermediate line) {
   
    Select select = (Select)line.getInstruction().getInstruction();
   
    Set<Case> cases = new HashSet<Case>();
    InstructionHandle[] handles = select.getTargets();
    int[] matches = select.getMatchs();
   
    for(int i=0, j=handles.length; i<j; i++) {
      InstructionHandle ih = handles[i];
      int match = matches[i];

      Resolved resolved = new Resolved(line.getInstruction(), BasicType.INT, ""+match);
      Case caseEntry = new Case(line.getInstruction(), ih, resolved);
      cases.add(caseEntry);
    }
   
    if(select.getTarget()!=null) {
      DefaultCase defaultCase = new DefaultCase(line.getInstruction(), select.getTarget());
      line.setDefaultCase(defaultCase);
    }
   
    //now, create the graph.
    line.setCases(cases);
View Full Code Here

    public void visitBranchInstruction( BranchInstruction bi ) {
        BranchHandle bh = (BranchHandle) branch_map.get(bi);
        int pos = bh.getPosition();
        String name = bi.getName() + "_" + pos;
        if (bi instanceof Select) {
            Select s = (Select) bi;
            branches.add(bi);
            StringBuffer args = new StringBuffer("new int[] { ");
            int[] matchs = s.getMatchs();
            for (int i = 0; i < matchs.length; i++) {
                args.append(matchs[i]);
                if (i < matchs.length - 1) {
                    args.append(", ");
                }
View Full Code Here

TOP

Related Classes of org.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.