Java Code Examples for com.android.dx.rop.code.BasicBlockList#set()
The following examples show how to use
com.android.dx.rop.code.BasicBlockList#set() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Ropper.java From Box with Apache License 2.0 | 6 votes |
/** * 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)); }
Example 2
Source File: Ropper.java From Box with Apache License 2.0 | 6 votes |
/** * 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)); }
Example 3
Source File: Ropper.java From J2ME-Loader with Apache License 2.0 | 6 votes |
/** * 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)); }
Example 4
Source File: Ropper.java From buck with Apache License 2.0 | 6 votes |
/** * 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)); }
Example 5
Source File: SsaToRop.java From Box with Apache License 2.0 | 5 votes |
/** * @return rop-form basic block list */ private BasicBlockList convertBasicBlocks() { ArrayList<SsaBasicBlock> blocks = ssaMeth.getBlocks(); // Exit block may be null. SsaBasicBlock exitBlock = ssaMeth.getExitBlock(); BitSet reachable = ssaMeth.computeReachability(); int ropBlockCount = reachable.cardinality(); // Don't count the exit block, if it exists and is reachable. if (exitBlock != null && reachable.get(exitBlock.getIndex())) { ropBlockCount -= 1; } BasicBlockList result = new BasicBlockList(ropBlockCount); // Convert all the reachable blocks except the exit block. int ropBlockIndex = 0; for (SsaBasicBlock b : blocks) { if (reachable.get(b.getIndex()) && b != exitBlock) { result.set(ropBlockIndex++, convertBasicBlock(b)); } } // The exit block, which is discarded, must do nothing. if (exitBlock != null && !exitBlock.getInsns().isEmpty()) { throw new RuntimeException( "Exit block must have no insns when leaving SSA form"); } return result; }
Example 6
Source File: SsaToRop.java From Box with Apache License 2.0 | 5 votes |
/** * @return rop-form basic block list */ private BasicBlockList convertBasicBlocks() { ArrayList<SsaBasicBlock> blocks = ssaMeth.getBlocks(); // Exit block may be null. SsaBasicBlock exitBlock = ssaMeth.getExitBlock(); BitSet reachable = ssaMeth.computeReachability(); int ropBlockCount = reachable.cardinality(); // Don't count the exit block, if it exists and is reachable. if (exitBlock != null && reachable.get(exitBlock.getIndex())) { ropBlockCount -= 1; } BasicBlockList result = new BasicBlockList(ropBlockCount); // Convert all the reachable blocks except the exit block. int ropBlockIndex = 0; for (SsaBasicBlock b : blocks) { if (reachable.get(b.getIndex()) && b != exitBlock) { result.set(ropBlockIndex++, convertBasicBlock(b)); } } // The exit block, which is discarded, must do nothing. if (exitBlock != null && !exitBlock.getInsns().isEmpty()) { throw new RuntimeException( "Exit block must have no insns when leaving SSA form"); } return result; }
Example 7
Source File: Code.java From lua-for-android with BSD 3-Clause "New" or "Revised" License | 5 votes |
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; }
Example 8
Source File: SsaToRop.java From J2ME-Loader with Apache License 2.0 | 5 votes |
/** * @return rop-form basic block list */ private BasicBlockList convertBasicBlocks() { ArrayList<SsaBasicBlock> blocks = ssaMeth.getBlocks(); // Exit block may be null. SsaBasicBlock exitBlock = ssaMeth.getExitBlock(); ssaMeth.computeReachability(); int ropBlockCount = ssaMeth.getCountReachableBlocks(); // Don't count the exit block, if it exists and is reachable. ropBlockCount -= (exitBlock != null && exitBlock.isReachable()) ? 1 : 0; BasicBlockList result = new BasicBlockList(ropBlockCount); // Convert all the reachable blocks except the exit block. int ropBlockIndex = 0; for (SsaBasicBlock b : blocks) { if (b.isReachable() && b != exitBlock) { result.set(ropBlockIndex++, convertBasicBlock(b)); } } // The exit block, which is discarded, must do nothing. if (exitBlock != null && exitBlock.getInsns().size() != 0) { throw new RuntimeException( "Exit block must have no insns when leaving SSA form"); } return result; }
Example 9
Source File: Code.java From dexmaker with Apache License 2.0 | 5 votes |
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; }
Example 10
Source File: SsaToRop.java From buck with Apache License 2.0 | 5 votes |
/** * @return rop-form basic block list */ private BasicBlockList convertBasicBlocks() { ArrayList<SsaBasicBlock> blocks = ssaMeth.getBlocks(); // Exit block may be null. SsaBasicBlock exitBlock = ssaMeth.getExitBlock(); ssaMeth.computeReachability(); int ropBlockCount = ssaMeth.getCountReachableBlocks(); // Don't count the exit block, if it exists and is reachable. ropBlockCount -= (exitBlock != null && exitBlock.isReachable()) ? 1 : 0; BasicBlockList result = new BasicBlockList(ropBlockCount); // Convert all the reachable blocks except the exit block. int ropBlockIndex = 0; for (SsaBasicBlock b : blocks) { if (b.isReachable() && b != exitBlock) { result.set(ropBlockIndex++, convertBasicBlock(b)); } } // The exit block, which is discarded, must do nothing. if (exitBlock != null && exitBlock.getInsns().size() != 0) { throw new RuntimeException( "Exit block must have no insns when leaving SSA form"); } return result; }