@Override public void redirectJumpsToThisTo(Unit newLocation) { List<UnitBox> boxesPointing = getBoxesPointingToThis(); UnitBox[] boxes = boxesPointing.toArray(new UnitBox[boxesPointing.size()]); // important to change this to an array to have a static copy for (UnitBox element : boxes) { UnitBox box = element; if (box.getUnit() != this) { throw new RuntimeException("Something weird's happening"); } if (box.isBranchTarget()) { box.setUnit(newLocation); } } } }
/** * Redirects PhiExpr pointers to the given Unit to the new Unit. * * <p> * Normally you should not have to call this function directly, since patching is taken care of Shimple's internal * implementation of PatchingChain. **/ public static void redirectPointers(Unit oldLocation, Unit newLocation) { List<UnitBox> boxesPointing = oldLocation.getBoxesPointingToThis(); // important to change this to an array to have a static copy UnitBox[] boxes = boxesPointing.toArray(new UnitBox[boxesPointing.size()]); for (UnitBox box : boxes) { if (box.getUnit() != oldLocation) { throw new RuntimeException("Something weird's happening"); } if (!box.isBranchTarget()) { box.setUnit(newLocation); } } } }
Unit stmt = box.getUnit(); if (box.isBranchTarget()) { labelStmts.add(stmt); } else {
if (!pointer.isBranchTarget()) { break; for (UnitBox targetBox : unit.getUnitBoxes()) { if (remove.equals(targetBox.getUnit())) { if (targetBox.isBranchTarget()) { preds.add(unit); } else {
if (boxesToTrack != null) { for (UnitBox boxToTrack : boxesToTrack) { if (!boxToTrack.isBranchTarget()) { trackedPhiToBoxes.put(boxToPhiNode.get(boxToTrack), boxToTrack);
throw new RuntimeException("Assertion failed."); if (ub.isBranchTarget()) { continue;
public void redirectJumpsToThisTo(Unit newLocation) { List boxesPointing = this.getBoxesPointingToThis(); Object[] boxes = boxesPointing.toArray(); // important to change this to an array to have a static copy for (Object element : boxes) { UnitBox box = (UnitBox) element; if(box.getUnit() != this) throw new RuntimeException("Something weird's happening"); if(box.isBranchTarget()) box.setUnit(newLocation); } } }
public void redirectJumpsToThisTo(Unit newLocation) { List boxesPointing = this.getBoxesPointingToThis(); Object[] boxes = boxesPointing.toArray(); // important to change this to an array to have a static copy for (Object element : boxes) { UnitBox box = (UnitBox) element; if(box.getUnit() != this) throw new RuntimeException("Something weird's happening"); if(box.isBranchTarget()) box.setUnit(newLocation); } } }
Unit stmt = box.getUnit(); if(box.isBranchTarget()) labelStmts.add(stmt); else
Unit stmt = box.getUnit(); if(box.isBranchTarget()) labelStmts.add(stmt); else