本文整理汇总了Java中com.android.dx.util.IntList.add方法的典型用法代码示例。如果您正苦于以下问题:Java IntList.add方法的具体用法?Java IntList.add怎么用?Java IntList.add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.android.dx.util.IntList
的用法示例。
在下文中一共展示了IntList.add方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: mergeSubroutineLists
import com.android.dx.util.IntList; //导入方法依赖的package包/类
/**
* Merges this frame's subroutine lists with another. The result
* is the deepest common nesting (effectively, the common prefix of the
* two lists).
*
* @param otherSubroutines label list of subroutine start blocks, from
* least-nested to most-nested.
* @return {@code non-null;} merged subroutine nest list as described above
*/
private IntList mergeSubroutineLists(IntList otherSubroutines) {
if (subroutines.equals(otherSubroutines)) {
return subroutines;
}
IntList resultSubroutines = new IntList();
int szSubroutines = subroutines.size();
int szOthers = otherSubroutines.size();
for (int i = 0; i < szSubroutines && i < szOthers
&& (subroutines.get(i) == otherSubroutines.get(i)); i++) {
resultSubroutines.add(i);
}
resultSubroutines.setImmutable();
return resultSubroutines;
}
示例2: getSuccessors
import com.android.dx.util.IntList; //导入方法依赖的package包/类
/**
* Generates a list of subroutine successors. Note: successor blocks
* could be listed more than once. This is ok, because this successor
* list (and the block it's associated with) will be copied and inlined
* before we leave the ropper. Redundent successors will result in
* redundent (no-op) merges.
*
* @return all currently known successors
* (return destinations) for that subroutine
*/
IntList getSuccessors() {
IntList successors = new IntList(callerBlocks.size());
/*
* For each subroutine caller, get it's target. If the
* target is us, add the ret target (subroutine successor)
* to our list
*/
for (int label = callerBlocks.nextSetBit(0); label >= 0;
label = callerBlocks.nextSetBit(label+1)) {
BasicBlock subCaller = labelToBlock(label);
successors.add(subCaller.getSuccessors().get(0));
}
successors.setImmutable();
return successors;
}
示例3: toTargetList
import com.android.dx.util.IntList; //导入方法依赖的package包/类
/**
* Returns a target list corresponding to this instance. The result
* is a list of all the exception handler addresses, with the given
* {@code noException} address appended if appropriate. The
* result is automatically made immutable.
*
* @param noException {@code >= -1;} the no-exception address to append, or
* {@code -1} not to append anything
* @return {@code non-null;} list of exception targets, with
* {@code noException} appended if necessary
*/
public IntList toTargetList(int noException) {
if (noException < -1) {
throw new IllegalArgumentException("noException < -1");
}
boolean hasDefault = (noException >= 0);
int sz = size();
if (sz == 0) {
if (hasDefault) {
/*
* The list is empty, but there is a no-exception
* address; so, the result is just that address.
*/
return IntList.makeImmutable(noException);
}
/*
* The list is empty and there isn't even a no-exception
* address.
*/
return IntList.EMPTY;
}
IntList result = new IntList(sz + (hasDefault ? 1 : 0));
for (int i = 0; i < sz; i++) {
result.add(get(i).getHandlerPc());
}
if (hasDefault) {
result.add(noException);
}
result.setImmutable();
return result;
}
示例4: getRopLabelSuccessorList
import com.android.dx.util.IntList; //导入方法依赖的package包/类
/**
* @return successor list of rop labels
*/
public IntList getRopLabelSuccessorList() {
IntList result = new IntList(successorList.size());
int sz = successorList.size();
for (int i = 0; i < sz; i++) {
result.add(parent.blockIndexToRopLabel(successorList.get(i)));
}
return result;
}
示例5: indexListFromLabelList
import com.android.dx.util.IntList; //导入方法依赖的package包/类
/**
* Builds an IntList of block indices from a basic block list and a list
* of labels taken from Rop form.
*
* @param ropBlocks Rop blocks
* @param labelList list of rop block labels
* @return IntList of block indices
*/
public static IntList indexListFromLabelList(BasicBlockList ropBlocks,
IntList labelList) {
IntList result = new IntList(labelList.size());
for (int i = 0, sz = labelList.size(); i < sz; i++) {
result.add(ropBlocks.indexOfLabel(labelList.get(i)));
}
return result;
}
示例6: mergeWithSubroutineCaller
import com.android.dx.util.IntList; //导入方法依赖的package包/类
/**
* Merges this frame with the frame of a subroutine caller at
* {@code predLabel}. Only called on the frame at the first
* block of a subroutine.
*
* @param other {@code non-null;} another frame
* @param subLabel label of subroutine start block
* @param predLabel label of calling block
* @return {@code non-null;} the result of merging the two frames
*/
public Frame mergeWithSubroutineCaller(Frame other, int subLabel,
int predLabel) {
LocalsArray resultLocals;
ExecutionStack resultStack;
resultLocals = getLocals().mergeWithSubroutineCaller(
other.getLocals(), predLabel);
resultStack = getStack().merge(other.getStack());
IntList newOtherSubroutines = other.subroutines.mutableCopy();
newOtherSubroutines.add(subLabel);
newOtherSubroutines.setImmutable();
if ((resultLocals == getLocals())
&& (resultStack == getStack())
&& subroutines.equals(newOtherSubroutines)) {
return this;
}
IntList resultSubroutines;
if (subroutines.equals(newOtherSubroutines)) {
resultSubroutines = subroutines;
} else {
/*
* The new subroutines list should be the deepest of the two
* lists being merged, but the postfix of the resultant list
* must be equal to the shorter list.
*/
IntList nonResultSubroutines;
if (subroutines.size() > newOtherSubroutines.size()) {
resultSubroutines = subroutines;
nonResultSubroutines = newOtherSubroutines;
} else {
resultSubroutines = newOtherSubroutines;
nonResultSubroutines = subroutines;
}
int szResult = resultSubroutines.size();
int szNonResult = nonResultSubroutines.size();
for (int i = szNonResult - 1; i >=0; i-- ) {
if (nonResultSubroutines.get(i)
!= resultSubroutines.get(
i + (szResult - szNonResult))) {
throw new
RuntimeException("Incompatible merged subroutines");
}
}
}
return new Frame(resultLocals, resultStack, resultSubroutines);
}
示例7: process
import com.android.dx.util.IntList; //导入方法依赖的package包/类
/**
* Runs algorithm. TODO: This is n^2, and could be made linear-ish with
* a hash. In particular, hash the contents of each block and only
* compare blocks with the same hash.
*
* @return {@code non-null;} new method that has been processed
*/
public RopMethod process() {
int szBlocks = blocks.size();
// indexed by label
BitSet toDelete = new BitSet(blocks.getMaxLabel());
// For each non-deleted block...
for (int bindex = 0; bindex < szBlocks; bindex++) {
BasicBlock b = blocks.get(bindex);
if (toDelete.get(b.getLabel())) {
// doomed block
continue;
}
IntList preds = ropMethod.labelToPredecessors(b.getLabel());
// ...look at all of it's predecessors that have only one succ...
int szPreds = preds.size();
for (int i = 0; i < szPreds; i++) {
int iLabel = preds.get(i);
BasicBlock iBlock = blocks.labelToBlock(iLabel);
if (toDelete.get(iLabel)
|| iBlock.getSuccessors().size() > 1
|| iBlock.getFirstInsn().getOpcode().getOpcode() ==
RegOps.MOVE_RESULT) {
continue;
}
IntList toCombine = new IntList();
// ...and see if they can be combined with any other preds...
for (int j = i + 1; j < szPreds; j++) {
int jLabel = preds.get(j);
BasicBlock jBlock = blocks.labelToBlock(jLabel);
if (jBlock.getSuccessors().size() == 1
&& compareInsns(iBlock, jBlock)) {
toCombine.add(jLabel);
toDelete.set(jLabel);
}
}
combineBlocks(iLabel, toCombine);
}
}
for (int i = szBlocks - 1; i >= 0; i--) {
if (toDelete.get(newBlocks.get(i).getLabel())) {
newBlocks.set(i, null);
}
}
newBlocks.shrinkToFit();
newBlocks.setImmutable();
return new RopMethod(newBlocks, ropMethod.getFirstLabel());
}
示例8: SsaRenamer
import com.android.dx.util.IntList; //导入方法依赖的package包/类
/**
* Constructs an instance of the renamer
*
* @param ssaMeth {@code non-null;} un-renamed SSA method that will
* be renamed.
*/
public SsaRenamer(SsaMethod ssaMeth) {
ropRegCount = ssaMeth.getRegCount();
this.ssaMeth = ssaMeth;
/*
* Reserve the first N registers in the SSA register space for
* "version 0" registers.
*/
nextSsaReg = ropRegCount;
threshold = 0;
startsForBlocks = new RegisterSpec[ssaMeth.getBlocks().size()][];
ssaRegToLocalItems = new ArrayList<LocalItem>();
if (DEBUG) {
ssaRegToRopReg = new IntList(ropRegCount);
}
/*
* Appel 19.7
*
* Initialization:
* for each variable a // register i
* Count[a] <- 0 // nextSsaReg, flattened
* Stack[a] <- 0 // versionStack
* push 0 onto Stack[a]
*
*/
// top entry for the version stack is version 0
RegisterSpec[] initialRegMapping = new RegisterSpec[ropRegCount];
for (int i = 0; i < ropRegCount; i++) {
// everyone starts with a version 0 register
initialRegMapping[i] = RegisterSpec.make(i, Type.VOID);
if (DEBUG) {
ssaRegToRopReg.add(i);
}
}
// Initial state for entry block
startsForBlocks[ssaMeth.getEntryBlockIndex()] = initialRegMapping;
}
示例9: makeNewSubroutineStartFrame
import com.android.dx.util.IntList; //导入方法依赖的package包/类
/**
* Makes a frame for a subroutine start block, given that this is the
* ending frame of one of the subroutine's calling blocks. Subroutine
* calls may be nested and thus may have nested locals state, so we
* start with an initial state as seen by the subroutine, but keep track
* of the individual locals states that will be expected when the individual
* subroutine calls return.
*
* @param subLabel label of subroutine start block
* @param callerLabel {@code >=0;} label of the caller block where this frame
* came from.
* @return a new instance to begin a called subroutine.
*/
public Frame makeNewSubroutineStartFrame(int subLabel, int callerLabel) {
IntList newSubroutines = subroutines.mutableCopy();
newSubroutines.add(subLabel);
Frame newFrame = new Frame(locals.getPrimary(), stack,
IntList.makeImmutable(subLabel));
return newFrame.mergeWithSubroutineCaller(this, subLabel, callerLabel);
}