BasicBlockList toBasicBlocks() { if (!localsInitialized) { initializeLocals(); } cleanUpLabels(); BasicBlockList result = new BasicBlockList(labels.size()); for (int i = 0; i < labels.size(); i++) { result.set(i, labels.get(i).toBasicBlock()); } return result; }
/** * Extracts the resulting {@link RopMethod} from the instance. * * @return {@code non-null;} the method object */ private RopMethod getRopMethod() { // Construct the final list of blocks. int sz = result.size(); BasicBlockList bbl = new BasicBlockList(sz); for (int i = 0; i < sz; i++) { bbl.set(i, result.get(i)); } bbl.setImmutable(); // Construct the method object to wrap it all up. /* * Note: The parameter assignment block is always the first * that should be executed, hence the second argument to the * constructor. */ return new RopMethod(bbl, getSpecialLabel(PARAM_ASSIGNMENT)); }
/** * Extracts the resulting {@link RopMethod} from the instance. * * @return {@code non-null;} the method object */ private RopMethod getRopMethod() { // Construct the final list of blocks. int sz = result.size(); BasicBlockList bbl = new BasicBlockList(sz); for (int i = 0; i < sz; i++) { bbl.set(i, result.get(i)); } bbl.setImmutable(); // Construct the method object to wrap it all up. /* * Note: The parameter assignment block is always the first * that should be executed, hence the second argument to the * constructor. */ return new RopMethod(bbl, getSpecialLabel(PARAM_ASSIGNMENT)); }
BasicBlockList toBasicBlocks() { if (!localsInitialized) { initializeLocals(); } cleanUpLabels(); BasicBlockList result = new BasicBlockList(labels.size()); for (int i = 0; i < labels.size(); i++) { result.set(i, labels.get(i).toBasicBlock()); } return result; }
/** * Extracts the resulting {@link RopMethod} from the instance. * * @return {@code non-null;} the method object */ private RopMethod getRopMethod() { // Construct the final list of blocks. int sz = result.size(); BasicBlockList bbl = new BasicBlockList(sz); for (int i = 0; i < sz; i++) { bbl.set(i, result.get(i)); } bbl.setImmutable(); // Construct the method object to wrap it all up. /* * Note: The parameter assignment block is always the first * that should be executed, hence the second argument to the * constructor. */ return new RopMethod(bbl, getSpecialLabel(PARAM_ASSIGNMENT)); }
BasicBlockList toBasicBlocks() { if (!localsInitialized) { initializeLocals(); } cleanUpLabels(); BasicBlockList result = new BasicBlockList(labels.size()); for (int i = 0; i < labels.size(); i++) { result.set(i, labels.get(i).toBasicBlock()); } return result; }
/** * Extracts the resulting {@link RopMethod} from the instance. * * @return {@code non-null;} the method object */ private RopMethod getRopMethod() { // Construct the final list of blocks. int sz = result.size(); BasicBlockList bbl = new BasicBlockList(sz); for (int i = 0; i < sz; i++) { bbl.set(i, result.get(i)); } bbl.setImmutable(); // Construct the method object to wrap it all up. /* * Note: The parameter assignment block is always the first * that should be executed, hence the second argument to the * constructor. */ return new RopMethod(bbl, getSpecialLabel(PARAM_ASSIGNMENT)); }
BasicBlockList toBasicBlocks() { if (!localsInitialized) { initializeLocals(); } cleanUpLabels(); BasicBlockList result = new BasicBlockList(labels.size()); for (int i = 0; i < labels.size(); i++) { result.set(i, labels.get(i).toBasicBlock()); } return result; }
/** * Extracts the resulting {@link RopMethod} from the instance. * * @return {@code non-null;} the method object */ private RopMethod getRopMethod() { // Construct the final list of blocks. int sz = result.size(); BasicBlockList bbl = new BasicBlockList(sz); for (int i = 0; i < sz; i++) { bbl.set(i, result.get(i)); } bbl.setImmutable(); // Construct the method object to wrap it all up. /* * Note: The parameter assignment block is always the first * that should be executed, hence the second argument to the * constructor. */ return new RopMethod(bbl, getSpecialLabel(PARAM_ASSIGNMENT)); }
/** * Replaces one of a block's successors with a different label. Constructs * an updated BasicBlock instance and places it in {@code newBlocks}. * * @param block block to replace * @param oldLabel label of successor to replace * @param newLabel label of new successor */ private void replaceSucc(BasicBlock block, int oldLabel, int newLabel) { IntList newSuccessors = block.getSuccessors().mutableCopy(); int newPrimarySuccessor; newSuccessors.set(newSuccessors.indexOf(oldLabel), newLabel); newPrimarySuccessor = block.getPrimarySuccessor(); if (newPrimarySuccessor == oldLabel) { newPrimarySuccessor = newLabel; } newSuccessors.setImmutable(); BasicBlock newBB = new BasicBlock(block.getLabel(), block.getInsns(), newSuccessors, newPrimarySuccessor); newBlocks.set(newBlocks.indexOfLabel(block.getLabel()), newBB); } }
/** * Extracts the resulting {@link RopMethod} from the instance. * * @return {@code non-null;} the method object */ private RopMethod getRopMethod() { // Construct the final list of blocks. int sz = result.size(); BasicBlockList bbl = new BasicBlockList(sz); for (int i = 0; i < sz; i++) { bbl.set(i, result.get(i)); } bbl.setImmutable(); // Construct the method object to wrap it all up. /* * Note: The parameter assignment block is always the first * that should be executed, hence the second argument to the * constructor. */ return new RopMethod(bbl, getSpecialLabel(PARAM_ASSIGNMENT)); }
/** * Replaces one of a block's successors with a different label. Constructs * an updated BasicBlock instance and places it in {@code newBlocks}. * * @param block block to replace * @param oldLabel label of successor to replace * @param newLabel label of new successor */ private void replaceSucc(BasicBlock block, int oldLabel, int newLabel) { IntList newSuccessors = block.getSuccessors().mutableCopy(); int newPrimarySuccessor; newSuccessors.set(newSuccessors.indexOf(oldLabel), newLabel); newPrimarySuccessor = block.getPrimarySuccessor(); if (newPrimarySuccessor == oldLabel) { newPrimarySuccessor = newLabel; } newSuccessors.setImmutable(); BasicBlock newBB = new BasicBlock(block.getLabel(), block.getInsns(), newSuccessors, newPrimarySuccessor); newBlocks.set(newBlocks.indexOfLabel(block.getLabel()), newBB); } }
/** * Returns an instance that is identical to this one, except that * the registers in each instruction are offset by the given * amount. Mutability of the result is inherited from the * original. * * @param delta the amount to offset register numbers by * @return {@code non-null;} an appropriately-constructed instance */ public BasicBlockList withRegisterOffset(int delta) { int sz = size(); BasicBlockList result = new BasicBlockList(sz); for (int i = 0; i < sz; i++) { BasicBlock one = (BasicBlock) get0(i); if (one != null) { result.set(i, one.withRegisterOffset(delta)); } } if (isImmutable()) { result.setImmutable(); } return result; }
/** * Replaces one of a block's successors with a different label. Constructs * an updated BasicBlock instance and places it in {@code newBlocks}. * * @param block block to replace * @param oldLabel label of successor to replace * @param newLabel label of new successor */ private void replaceSucc(BasicBlock block, int oldLabel, int newLabel) { IntList newSuccessors = block.getSuccessors().mutableCopy(); int newPrimarySuccessor; newSuccessors.set(newSuccessors.indexOf(oldLabel), newLabel); newPrimarySuccessor = block.getPrimarySuccessor(); if (newPrimarySuccessor == oldLabel) { newPrimarySuccessor = newLabel; } newSuccessors.setImmutable(); BasicBlock newBB = new BasicBlock(block.getLabel(), block.getInsns(), newSuccessors, newPrimarySuccessor); newBlocks.set(newBlocks.indexOfLabel(block.getLabel()), newBB); } }
/** * Returns an instance that is identical to this one, except that * the registers in each instruction are offset by the given * amount. Mutability of the result is inherited from the * original. * * @param delta the amount to offset register numbers by * @return {@code non-null;} an appropriately-constructed instance */ public BasicBlockList withRegisterOffset(int delta) { int sz = size(); BasicBlockList result = new BasicBlockList(sz); for (int i = 0; i < sz; i++) { BasicBlock one = (BasicBlock) get0(i); if (one != null) { result.set(i, one.withRegisterOffset(delta)); } } if (isImmutable()) { result.setImmutable(); } return result; }
/** * Replaces one of a block's successors with a different label. Constructs * an updated BasicBlock instance and places it in {@code newBlocks}. * * @param block block to replace * @param oldLabel label of successor to replace * @param newLabel label of new successor */ private void replaceSucc(BasicBlock block, int oldLabel, int newLabel) { IntList newSuccessors = block.getSuccessors().mutableCopy(); int newPrimarySuccessor; newSuccessors.set(newSuccessors.indexOf(oldLabel), newLabel); newPrimarySuccessor = block.getPrimarySuccessor(); if (newPrimarySuccessor == oldLabel) { newPrimarySuccessor = newLabel; } newSuccessors.setImmutable(); BasicBlock newBB = new BasicBlock(block.getLabel(), block.getInsns(), newSuccessors, newPrimarySuccessor); newBlocks.set(newBlocks.indexOfLabel(block.getLabel()), newBB); } }
/** * Returns an instance that is identical to this one, except that * the registers in each instruction are offset by the given * amount. Mutability of the result is inherited from the * original. * * @param delta the amount to offset register numbers by * @return {@code non-null;} an appropriately-constructed instance */ public BasicBlockList withRegisterOffset(int delta) { int sz = size(); BasicBlockList result = new BasicBlockList(sz); for (int i = 0; i < sz; i++) { BasicBlock one = (BasicBlock) get0(i); if (one != null) { result.set(i, one.withRegisterOffset(delta)); } } if (isImmutable()) { result.setImmutable(); } return result; }
/** * Replaces one of a block's successors with a different label. Constructs * an updated BasicBlock instance and places it in {@code newBlocks}. * * @param block block to replace * @param oldLabel label of successor to replace * @param newLabel label of new successor */ private void replaceSucc(BasicBlock block, int oldLabel, int newLabel) { IntList newSuccessors = block.getSuccessors().mutableCopy(); int newPrimarySuccessor; newSuccessors.set(newSuccessors.indexOf(oldLabel), newLabel); newPrimarySuccessor = block.getPrimarySuccessor(); if (newPrimarySuccessor == oldLabel) { newPrimarySuccessor = newLabel; } newSuccessors.setImmutable(); BasicBlock newBB = new BasicBlock(block.getLabel(), block.getInsns(), newSuccessors, newPrimarySuccessor); newBlocks.set(newBlocks.indexOfLabel(block.getLabel()), newBB); } }
/** * Returns an instance that is identical to this one, except that * the registers in each instruction are offset by the given * amount. Mutability of the result is inherited from the * original. * * @param delta the amount to offset register numbers by * @return {@code non-null;} an appropriately-constructed instance */ public BasicBlockList withRegisterOffset(int delta) { int sz = size(); BasicBlockList result = new BasicBlockList(sz); for (int i = 0; i < sz; i++) { BasicBlock one = (BasicBlock) get0(i); if (one != null) { result.set(i, one.withRegisterOffset(delta)); } } if (isImmutable()) { result.setImmutable(); } return result; }
/** * Replaces one of a block's successors with a different label. Constructs * an updated BasicBlock instance and places it in {@code newBlocks}. * * @param block block to replace * @param oldLabel label of successor to replace * @param newLabel label of new successor */ private void replaceSucc(BasicBlock block, int oldLabel, int newLabel) { IntList newSuccessors = block.getSuccessors().mutableCopy(); int newPrimarySuccessor; newSuccessors.set(newSuccessors.indexOf(oldLabel), newLabel); newPrimarySuccessor = block.getPrimarySuccessor(); if (newPrimarySuccessor == oldLabel) { newPrimarySuccessor = newLabel; } newSuccessors.setImmutable(); BasicBlock newBB = new BasicBlock(block.getLabel(), block.getInsns(), newSuccessors, newPrimarySuccessor); newBlocks.set(newBlocks.indexOfLabel(block.getLabel()), newBB); } }