本文整理汇总了Java中soot.toolkits.scalar.Pair类的典型用法代码示例。如果您正苦于以下问题:Java Pair类的具体用法?Java Pair怎么用?Java Pair使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Pair类属于soot.toolkits.scalar包,在下文中一共展示了Pair类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: ValidMatches
import soot.toolkits.scalar.Pair; //导入依赖的package包/类
public ValidMatches(PAG pag, FieldToEdgesMap fieldToStores) {
for (Iterator iter = pag.loadSources().iterator(); iter.hasNext();) {
FieldRefNode loadSource = (FieldRefNode) iter.next();
SparkField field = loadSource.getField();
VarNode loadBase = loadSource.getBase();
ArraySet<Pair<VarNode, VarNode>> storesOnField = fieldToStores.get(field);
for (Pair<VarNode, VarNode> store : storesOnField) {
VarNode storeBase = store.getO2();
if (loadBase.getP2Set().hasNonEmptyIntersection(storeBase.getP2Set())) {
VarNode matchSrc = store.getO1();
Node[] loadTargets = pag.loadLookup(loadSource);
for (int i = 0; i < loadTargets.length; i++) {
VarNode matchTgt = (VarNode) loadTargets[i];
vMatchEdges.put(matchSrc, matchTgt);
vMatchBarEdges.put(matchTgt, matchSrc);
}
}
}
}
}
示例2: buildStoreMap
import soot.toolkits.scalar.Pair; //导入依赖的package包/类
public static FieldAccessMap buildStoreMap(PAG pag) {
FieldAccessMap ret = new FieldAccessMap();
Iterator frNodeIter = pag.storeInvSourcesIterator();
while (frNodeIter.hasNext()) {
FieldRefNode frNode = (FieldRefNode) frNodeIter.next();
SparkField field = frNode.getField();
Node[] targets = pag.storeInvLookup(frNode);
for (int i = 0; i < targets.length; i++) {
VarNode target = (VarNode) targets[i];
if (target instanceof GlobalVarNode)
continue;
ret.put(field, new Pair<FieldRefNode, LocalVarNode>(frNode, (LocalVarNode) target));
}
}
return ret;
}
示例3: checkContextsForAllocsCache
import soot.toolkits.scalar.Pair; //导入依赖的package包/类
protected PointsToSetInternal checkContextsForAllocsCache(
VarAndContext varAndContext, AllocAndContextSet ret,
PointsToSetInternal locs) {
PointsToSetInternal retSet = null;
if (contextsForAllocsCache.containsKey(varAndContext)) {
for (AllocAndContext allocAndContext : contextsForAllocsCache.get(
varAndContext).getO2()) {
if (locs.contains(allocAndContext.alloc)) {
ret.add(allocAndContext);
}
}
final PointsToSetInternal oldLocs = contextsForAllocsCache.get(
varAndContext).getO1();
final PointsToSetInternal tmpSet = new HybridPointsToSet(locs
.getType(), pag);
locs.forall(new P2SetVisitor() {
@Override
public void visit(Node n) {
if (!oldLocs.contains(n)) {
tmpSet.add(n);
}
}
});
retSet = tmpSet;
oldLocs.addAll(tmpSet, null);
} else {
PointsToSetInternal storedSet = new HybridPointsToSet(locs
.getType(), pag);
storedSet.addAll(locs, null);
contextsForAllocsCache.put(varAndContext,
new Pair<PointsToSetInternal, AllocAndContextSet>(
storedSet, new AllocAndContextSet()));
retSet = locs;
}
return retSet;
}
示例4: caseNewMultiArrayExpr
import soot.toolkits.scalar.Pair; //导入依赖的package包/类
@Override
final public void caseNewMultiArrayExpr( NewMultiArrayExpr nmae ) {
ArrayType type = (ArrayType) nmae.getType();
AllocNode prevAn = pag.makeAllocNode(
new Pair<Expr, Integer>( nmae, new Integer( type.numDimensions ) ), type, method );
VarNode prevVn = pag.makeLocalVarNode( prevAn, prevAn.getType(), method );
mpag.addInternalEdge( prevAn, prevVn );
setResult( prevAn );
while( true ) {
Type t = type.getElementType();
if( !( t instanceof ArrayType ) ) break;
type = (ArrayType) t;
AllocNode an = pag.makeAllocNode(
new Pair<Expr, Integer>( nmae, new Integer( type.numDimensions ) ), type, method );
VarNode vn = pag.makeLocalVarNode( an, an.getType(), method );
mpag.addInternalEdge( an, vn );
mpag.addInternalEdge( vn, pag.makeFieldRefNode( prevVn, ArrayElement.v() ) );
prevAn = an;
prevVn = vn;
}
}
示例5: isParamVulnAndStore
import soot.toolkits.scalar.Pair; //导入依赖的package包/类
@Override
public void isParamVulnAndStore(SootMethod originMethod, Stmt originStmt, Value reachedValue) { //avoid sideeffect
//constant already guaranteed by caller
System.out.println(originStmt);
String funcSig = originStmt.getInvokeExpr().getMethod().getSignature();
String valueString = reachedValue.toString();
if (evaluateResult(funcSig, valueString)) {
if(DEBUG) {
System.out.println("result found");
System.out.println("originstmt: " + originStmt + " reachedValue: " + reachedValue);
}
this.results.add(new Pair<>(originMethod, new Pair<>(originStmt, valueString)));
}
if(DEBUG) {
if (reachedValue instanceof Constant || reachedValue instanceof StaticFieldRef) {
System.out.println("originstmt: " + originStmt + " reachedValue: " + reachedValue);
}
}
}
示例6: isParamNode
import soot.toolkits.scalar.Pair; //导入依赖的package包/类
public static boolean isParamNode(VarNode node) {
if (node.getVariable() instanceof soot.toolkits.scalar.Pair) {
soot.toolkits.scalar.Pair pair = (soot.toolkits.scalar.Pair) node.getVariable();
return (pair.getO1() instanceof SootMethod && (pair.getO2() instanceof Integer || pair.getO2() == PointsToAnalysis.THIS_NODE));
}
return false;
}
示例7: isThisNode
import soot.toolkits.scalar.Pair; //导入依赖的package包/类
/**
*
* @param node
* @return <code>true</code> if <code>node</code> represents the this
* parameter of a method; <code>false</code> otherwise
*/
public static boolean isThisNode(VarNode node) {
if (node.getVariable() instanceof soot.toolkits.scalar.Pair) {
soot.toolkits.scalar.Pair pair = (soot.toolkits.scalar.Pair) node.getVariable();
return (pair.getO1() instanceof SootMethod) && (pair.getO2() == PointsToAnalysis.THIS_NODE);
}
return false;
}
示例8: addInterproceduralAssignment
import soot.toolkits.scalar.Pair; //导入依赖的package包/类
public Pair<Node, Node> addInterproceduralAssignment(Node from, Node to, Edge e)
{
Pair<Node, Node> val = new Pair<Node, Node>(from, to);
if ( runGeomPTA ) {
Set<Edge> sets = assign2edges.get(val);
if ( sets == null ) {
sets = new HashSet<Edge>();
assign2edges.put(val, sets);
}
sets.add(e);
}
return val;
}
示例9: isThisPtr
import soot.toolkits.scalar.Pair; //导入依赖的package包/类
/** Returns true if this VarNode represents the THIS pointer */
public boolean isThisPtr()
{
if ( variable instanceof Pair ) {
Pair o = (Pair)variable;
return o.isThisParameter();
}
return false;
}
示例10: v
import soot.toolkits.scalar.Pair; //导入依赖的package包/类
public static Parm v( SootMethod m, int index ) {
Pair<SootMethod, Integer> p = new Pair<SootMethod, Integer>( m, new Integer(index) );
Parm ret = (Parm) G.v().Parm_pairToElement.get( p );
if( ret == null ) {
G.v().Parm_pairToElement.put( p, ret = new Parm( m, index ) );
}
return ret;
}
示例11: assignObjectToImpl
import soot.toolkits.scalar.Pair; //导入依赖的package包/类
protected void assignObjectToImpl(ReferenceVariable lhs, AbstractObject obj) {
AllocNode objNode = pag.makeAllocNode(
new Pair( "AbstractObject", obj.getType() ),
obj.getType(), null );
VarNode var;
if( lhs instanceof FieldRefNode ) {
var = pag.makeGlobalVarNode( objNode, objNode.getType() );
pag.addEdge( (Node) lhs, var );
} else {
var = (VarNode) lhs;
}
pag.addEdge( objNode, var );
}
示例12: caseNewInstance
import soot.toolkits.scalar.Pair; //导入依赖的package包/类
final public Node caseNewInstance( VarNode cls ) {
if( cls instanceof ContextVarNode ) cls = pag.findLocalVarNode( cls.getVariable() );
VarNode local = pag.makeGlobalVarNode( cls, RefType.v( "java.lang.Object" ) );
for (SootClass cl : Scene.v().dynamicClasses()) {
AllocNode site = pag.makeAllocNode( new Pair<VarNode, SootClass>(cls, cl), cl.getType(), null );
pag.addEdge( site, local );
}
return local;
}
示例13: caseThis
import soot.toolkits.scalar.Pair; //导入依赖的package包/类
final public Node caseThis() {
VarNode ret = pag.makeLocalVarNode(
new Pair<SootMethod, String>( method, PointsToAnalysis.THIS_NODE ),
method.getDeclaringClass().getType(), method );
ret.setInterProcTarget();
return ret;
}
示例14: caseParm
import soot.toolkits.scalar.Pair; //导入依赖的package包/类
final public Node caseParm( int index ) {
VarNode ret = pag.makeLocalVarNode(
new Pair<SootMethod, Integer>( method, new Integer( index ) ),
method.getParameterType( index ), method );
ret.setInterProcTarget();
return ret;
}
示例15: casePhiExpr
import soot.toolkits.scalar.Pair; //导入依赖的package包/类
final public void casePhiExpr(PhiExpr e) {
Pair<Expr, String> phiPair = new Pair<Expr, String>( e, PointsToAnalysis.PHI_NODE );
Node phiNode = pag.makeLocalVarNode( phiPair, e.getType(), method );
for (Value op : e.getValues()) {
op.apply( MethodNodeFactory.this );
Node opNode = getNode();
mpag.addInternalEdge( opNode, phiNode );
}
setResult( phiNode );
}