@Override public void visitSelect(Select ins) { isBranch = true; // Add non-default switch edges. InstructionHandle[] targets = ins.getTargets(); for (InstructionHandle target : targets) { targetList.add(new Target(target, SWITCH_EDGE)); } // Add default switch edge. InstructionHandle defaultTarget = ins.getTarget(); if (defaultTarget == null) { throw new IllegalStateException(); } targetList.add(new Target(defaultTarget, SWITCH_DEFAULT_EDGE)); }
InstructionHandle[] itargets = ((Select)bi).getTargets(); InstructionHandle[] ctargets = ((Select)bc).getTargets();
@Override public void visitSelect(Select ins) { isBranch = true; // Add non-default switch edges. InstructionHandle[] targets = ins.getTargets(); for (InstructionHandle target : targets) { targetList.add(new Target(target, SWITCH_EDGE)); } // Add default switch edge. InstructionHandle defaultTarget = ins.getTarget(); if (defaultTarget == null) { throw new IllegalStateException(); } targetList.add(new Target(defaultTarget, SWITCH_DEFAULT_EDGE)); }
private void updateBranchTargets() { for(Iterator i = branches.iterator(); i.hasNext(); ) { BranchInstruction bi = (BranchInstruction)i.next(); BranchHandle bh = (BranchHandle)branch_map.get(bi); int pos = bh.getPosition(); String name = bi.getName() + "_" + pos; int t_pos = bh.getTarget().getPosition(); _out.println(" " + name + ".setTarget(ih_" + t_pos + ");"); if(bi instanceof Select) { InstructionHandle[] ihs = ((Select)bi).getTargets(); for(int j = 0; j < ihs.length; j++) { t_pos = ihs[j].getPosition(); _out.println(" " + name + ".setTarget(" + j + ", ih_" + t_pos + ");"); } } } }
private void updateBranchTargets() { for (final BranchInstruction bi : branches) { final BranchHandle bh = (BranchHandle) branch_map.get(bi); final int pos = bh.getPosition(); final String name = bi.getName() + "_" + pos; int t_pos = bh.getTarget().getPosition(); _out.println(" " + name + ".setTarget(ih_" + t_pos + ");"); if (bi instanceof Select) { final InstructionHandle[] ihs = ((Select) bi).getTargets(); for (int j = 0; j < ihs.length; j++) { t_pos = ihs[j].getPosition(); _out.println(" " + name + ".setTarget(" + j + ", ih_" + t_pos + ");"); } } } }
InstructionHandle[] itargets = ((Select)bi).getTargets(); InstructionHandle[] ctargets = ((Select)bc).getTargets();
public boolean equals(Instruction i1, Instruction i2) { if(i1.opcode == i2.opcode) { if(i1 instanceof Select) { InstructionHandle[] t1 = ((Select)i1).getTargets(); InstructionHandle[] t2 = ((Select)i2).getTargets();
/** * Redirect all references from old_target to new_target, i.e., update targets * of branch instructions. * * @param old_target the old target instruction handle * @param new_target the new target instruction handle */ public void redirectBranches(InstructionHandle old_target, InstructionHandle new_target) { for(InstructionHandle ih = start; ih != null; ih = ih.next) { Instruction i = ih.getInstruction(); if(i instanceof BranchInstruction) { BranchInstruction b = (BranchInstruction)i; InstructionHandle target = b.getTarget(); if(target == old_target) b.setTarget(new_target); if(b instanceof Select) { // Either LOOKUPSWITCH or TABLESWITCH InstructionHandle[] targets = ((Select)b).getTargets(); for(int j=0; j < targets.length; j++) // Update targets if(targets[j] == old_target) ((Select)b).setTarget(j, new_target); } } } }
final InstructionHandle[] itargets = ((Select) bi).getTargets(); final InstructionHandle[] ctargets = ((Select) bc).getTargets(); for (int j = 0; j < itargets.length; j++) { // Update all targets ctargets[j] = map.get(itargets[j]);
/** * Redirect all references from old_target to new_target, i.e., update targets of branch instructions. * * @param old_target * the old target instruction handle * @param new_target * the new target instruction handle */ public void redirectBranches(final InstructionHandle old_target, final InstructionHandle new_target) { for (InstructionHandle ih = start; ih != null; ih = ih.getNext()) { final Instruction i = ih.getInstruction(); if (i instanceof BranchInstruction) { final BranchInstruction b = (BranchInstruction) i; final InstructionHandle target = b.getTarget(); if (target == old_target) { b.setTarget(new_target); } if (b instanceof Select) { // Either LOOKUPSWITCH or TABLESWITCH final InstructionHandle[] targets = ((Select) b).getTargets(); for (int j = 0; j < targets.length; j++) { if (targets[j] == old_target) { ((Select) b).setTarget(j, new_target); } } } } } }
final InstructionHandle[] matchTargets = ((Select) inst).getTargets(); final InstructionHandle[] ret = new InstructionHandle[matchTargets.length+1]; ret[0] = ((Select) inst).getTarget();
InstructionHandle[] matchTargets = ((Select) inst).getTargets(); InstructionHandle[] ret = new InstructionHandle[matchTargets.length+1]; ret[0] = ((Select) inst).getTarget();
InstructionHandle[] targets = ((Select)i).getTargets();
InstructionHandle[] matchTargets = ((Select) inst).getTargets(); InstructionHandle[] ret = new InstructionHandle[matchTargets.length+1]; ret[0] = ((Select) inst).getTarget();
final InstructionHandle[] matchTargets = ((Select) inst).getTargets(); final InstructionHandle[] ret = new InstructionHandle[matchTargets.length+1]; ret[0] = ((Select) inst).getTarget();
InstructionHandle[] itargets = ((Select)bi).getTargets(); InstructionHandle[] ctargets = ((Select)bc).getTargets();
InstructionHandle[] itargets = ((Select)bi).getTargets(); InstructionHandle[] ctargets = ((Select)bc).getTargets();
InstructionHandle[] targets = select.getTargets(); for (int i = 0; i < targets.length; i++) branchTargets.push(targets[i], stackDepth);
final InstructionHandle[] targets = select.getTargets(); for (final InstructionHandle target : targets) { branchTargets.push(target, stackDepth);
final InstructionHandle[] targets = ((Select) i).getTargets(); for (final InstructionHandle target : targets) { inst = target.getInstruction();