public static IntPair make(int x, int y) { return new IntPair(x, y); } }
/** * TODO: optimize this * * @return set of node numbers that are reached by any fact */ public IntSet getReachedNodeNumbers() { MutableSparseIntSet result = MutableSparseIntSet.makeEmpty(); if (paths.size() > 0) { for (IBinaryNaturalRelation R : paths) { for (IntPair p : R) { result.add(p.getX()); } } } if (identityPaths.size() > 0) { for (IntSet s : identityPaths) { result.addAll(s); } } if (zeroPaths.size() > 0) { for (IntSet s : zeroPaths) { result.addAll(s); } } return result; } }
/** * TODO: optimize this * * @return set of node numbers that are reached by any fact */ public IntSet getReachedNodeNumbers() { MutableSparseIntSet result = MutableSparseIntSet.makeEmpty(); if (paths.size() > 0) { for (IBinaryNaturalRelation R : paths) { for (IntPair p : R) { result.add(p.getX()); } } } if (identityPaths.size() > 0) { for (IntSet s : identityPaths) { result.addAll(s); } } if (zeroPaths.size() > 0) { for (IntSet s : zeroPaths) { result.addAll(s); } } return result; } }
/** * Record the beginning of a new range, starting at the given program counter, in which a particular value number corresponds to * a particular local number */ void startRange(int pc, int localNumber, int valueNumber) { localStoreMap[pc] = new IntPair(valueNumber, localNumber); }
public static IntPair make(int x, int y) { return new IntPair(x, y); } }
@Override public AbstractStatement next() { IntPair p = innerDelegate.next(); int lhs = p.getX(); int rhs = p.getY(); UnaryStatement result = currentOperator.makeEquation((PointsToSetVariable) delegateGraph.getNode(lhs), (PointsToSetVariable) delegateGraph.getNode(rhs)); if (!innerDelegate.hasNext()) { advanceOuter(); } return result; }
/** * Record the beginning of a new range, starting at the given program counter, in which a particular value number corresponds to * a particular local number */ void startRange(int pc, int localNumber, int valueNumber) { localStoreMap[pc] = new IntPair(valueNumber, localNumber); }
@Override public AbstractStatement next() { IntPair p = innerDelegate.next(); int lhs = p.getX(); int rhs = p.getY(); UnaryStatement result = currentOperator.makeEquation((PointsToSetVariable) delegateGraph.getNode(lhs), (PointsToSetVariable) delegateGraph.getNode(rhs)); if (!innerDelegate.hasNext()) { advanceOuter(); } return result; }
public static IntPair make(int x, int y) { return new IntPair(x, y); } }
/** * Note: This is inefficient. Use with care. * * @param s_p local block number an entry * @param x local block number of an exit block * @param d2 target dataflow fact * @return set of d1 s.t. d1 -> d2 recorded as a summary edge for (s_p,x), or null if none */ public IntSet getInvertedSummaryEdgesForTarget(int s_p, int x, int d2) { int n = getIndexForEntryExitPair(s_p, x); IBinaryNaturalRelation R = summaries.get(n); if (R == null) { return null; } else { MutableSparseIntSet result = MutableSparseIntSet.makeEmpty(); for (IntPair p : R) { if (p.getY() == d2) { result.add(p.getX()); } } return result; } }
/** * Record the beginning of a new range, starting at the given program counter, in which a particular value number corresponds to * a particular local number */ @SuppressWarnings("unused") void startRange(int pc, int localNumber, int valueNumber) { int max = ((DexIMethod)dexCFG.getMethod()).getMaxLocals(); if (localNumber >= max) { assert false : "invalid local " + localNumber + '>' + max; } localStoreMap[pc] = new IntPair(valueNumber, localNumber); }
/** * Note: This is inefficient. Use with care. * * @param s_p local block number an entry * @param x local block number of an exit block * @param d2 target dataflow fact * @return set of d1 s.t. d1 -> d2 recorded as a summary edge for (s_p,x), or null if none */ public IntSet getInvertedSummaryEdgesForTarget(int s_p, int x, int d2) { int n = getIndexForEntryExitPair(s_p, x); IBinaryNaturalRelation R = summaries.get(n); if (R == null) { return null; } else { MutableSparseIntSet result = MutableSparseIntSet.makeEmpty(); for (IntPair p : R) { if (p.getY() == d2) { result.add(p.getX()); } } return result; } }
/** * Record the beginning of a new range, starting at the given program counter, in which a particular value number corresponds to * a particular local number */ @SuppressWarnings("unused") void startRange(int pc, int localNumber, int valueNumber) { int max = ((DexIMethod)dexCFG.getMethod()).getMaxLocals(); if (localNumber >= max) { assert false : "invalid local " + localNumber + '>' + max; } localStoreMap[pc] = new IntPair(valueNumber, localNumber); }
/** * @param pc a program counter (index into ShrikeBT instruction array) * @param vn a value number * @return if we know that immediately after the given program counter, v_vn corresponds to some set of locals, then return an * array of the local numbers. else return null. */ private int[] findLocalsForValueNumber(int pc, int vn) { IBasicBlock<Instruction> bb = dexCFG.getBlockForInstruction(pc); int firstInstruction = bb.getFirstInstructionIndex(); // walk forward from the first instruction to reconstruct the // state of the locals at this pc int[] locals = block2LocalState[bb.getNumber()]; if (locals == null) { locals = allocateNewLocalsArray(); } for (int i = firstInstruction; i <= pc; i++) { if (localStoreMap[i] != null) { IntPair p = localStoreMap[i]; locals[p.getY()] = p.getX(); } } return extractIndices(locals, vn); }
@Override public IntPair next() { IntPair result = null; if (nextIndex == smallStore.length) { int y = delegateIterator.next(); result = new IntPair(nextX, y); if (!delegateIterator.hasNext()) { advanceX(); } } else { result = new IntPair(nextX, smallStore[nextIndex].get(nextX)); if (nextIndex == (smallStore.length - 1) || smallStore[nextIndex + 1].get(nextX) == EMPTY_CODE) { advanceX(); } else { nextIndex++; } } return result; }
/** * @param pc a program counter (index into ShrikeBT instruction array) * @param vn a value number * @return if we know that immediately after the given program counter, v_vn corresponds to some set of locals, then return an * array of the local numbers. else return null. */ private int[] findLocalsForValueNumber(int pc, int vn) { if (vn < 0) { return null; } IBasicBlock bb = shrikeCFG.getBlockForInstruction(pc); int firstInstruction = bb.getFirstInstructionIndex(); // walk forward from the first instruction to reconstruct the // state of the locals at this pc int[] locals = block2LocalState[bb.getNumber()]; for (int i = firstInstruction; i <= pc; i++) { if (localStoreMap[i] != null) { IntPair p = localStoreMap[i]; locals = setLocal(locals, p.getY(), p.getX()); } } return locals == null ? null : extractIndices(locals, vn); }
@Override public IntPair next() { IntPair result = null; if (nextIndex == smallStore.length) { int y = delegateIterator.next(); result = new IntPair(nextX, y); if (!delegateIterator.hasNext()) { advanceX(); } } else { result = new IntPair(nextX, smallStore[nextIndex].get(nextX)); if (nextIndex == (smallStore.length - 1) || smallStore[nextIndex + 1].get(nextX) == EMPTY_CODE) { advanceX(); } else { nextIndex++; } } return result; }