Java 类soot.jimple.spark.sets.EmptyPointsToSet 实例源码

项目:JAADAS    文件:DemandCSPointsTo.java   
/**
   * Computes the possibly refined set of reaching objects for l.
   */
  protected PointsToSet computeReachingObjects(Local l) {
      VarNode v = pag.findLocalVarNode(l);
if (v == null) {
  //no reaching objects
  return EmptyPointsToSet.v();
}
      PointsToSet contextSensitiveResult = computeRefinedReachingObjects(v);
      if(contextSensitiveResult == null ) {
          //had to abort; return Spark's points-to set in a wrapper
          return new WrappedPointsToSet(v.getP2Set());
      } else {
          return contextSensitiveResult;                
      }
  }
项目:JAADAS    文件:PAG.java   
/** Returns the set of objects pointed to by variable l. */
public PointsToSet reachingObjects( Local l ) {
    VarNode n = findLocalVarNode( l );
    if( n == null ) {
        return EmptyPointsToSet.v();
    }
    return n.getP2Set();
}
项目:JAADAS    文件:PAG.java   
/** Returns the set of objects pointed to by variable l in context c. */
public PointsToSet reachingObjects( Context c, Local l ) {
    VarNode n = findContextVarNode( l, c );
    if( n == null ) {
        return EmptyPointsToSet.v();
    }
    return n.getP2Set();
}
项目:JAADAS    文件:PAG.java   
/** Returns the set of objects pointed to by static field f. */
public PointsToSet reachingObjects( SootField f ) {
    if( !f.isStatic() )
        throw new RuntimeException( "The parameter f must be a *static* field." );
    VarNode n = findGlobalVarNode( f );
    if( n == null ) {
        return EmptyPointsToSet.v();
    }
    return n.getP2Set();
}
项目:JAADAS    文件:Node.java   
/** Returns the points-to set for this node. */
public PointsToSetInternal getP2Set() {
    if( p2set != null ) {
        if( replacement != this ) throw new RuntimeException(
                "Node "+this+" has replacement "+replacement+" but has p2set" );
        return p2set;
    }
    Node rep = getReplacement();
    if( rep == this ) {
        return EmptyPointsToSet.v();
    }
    return rep.getP2Set();
}
项目:JAADAS    文件:GeomPointsTo.java   
private PointsToSetInternal field_p2set( PointsToSet s, final SparkField f )
{
    if ( !(s instanceof PointsToSetInternal) )
        throw new RuntimeException( "Base pointers must be stored in *PointsToSetInternal*." );

    PointsToSetInternal bases = (PointsToSetInternal) s;
    final PointsToSetInternal ret = getSetFactory().newSet(f.getType(), this);

    bases.forall(new P2SetVisitor() {
        public final void visit(Node n) {
            Node nDotF = ((AllocNode) n).dot(f);
            if (nDotF != null) {
                //nDotF.getP2Set() has been discarded in solve()
                IVarAbstraction pn = consG.get(nDotF);
                if (pn == null
                        || hasTransformed 
                        || nDotF.getP2Set() != EmptyPointsToSet.v()) {
                    ret.addAll(nDotF.getP2Set(), null);
                    return;
                }

                pn = pn.getRepresentative();
                //PointsToSetInternal ptSet = nDotF.makeP2Set();
                for ( AllocNode obj : pn.get_all_points_to_objects() ) {
                    ret.add( obj );
                    //ptSet.add(obj);
                }
            }
        }
    });

    return ret;
}
项目:JAADAS    文件:GeomPointsTo.java   
@Override
public PointsToSet reachingObjects(Local l) 
{
    if ( !hasExecuted ) return super.reachingObjects(l);

    LocalVarNode vn = findLocalVarNode(l);
    if ( vn == null ) 
        return EmptyPointsToSet.v();

    IVarAbstraction pn = consG.get(vn);

    // In case this pointer has no geomPTA result
    // This is perhaps a bug
    if ( pn == null ) 
        return vn.getP2Set();

    // Return the cached result
    if ( hasTransformed ||
            vn.getP2Set() != EmptyPointsToSet.v() ) return vn.getP2Set();

    // Compute and cache the result
    pn = pn.getRepresentative();
    PointsToSetInternal ptSet = vn.makeP2Set();
    for ( AllocNode obj : pn.get_all_points_to_objects() ) {
        ptSet.add( obj );
    }

    return ptSet;
}
项目:JAADAS    文件:GeomPointsTo.java   
@Override
public PointsToSet reachingObjects(SootField f) 
{
    if ( !hasExecuted ) return super.reachingObjects(f);

    if( !f.isStatic() )
           throw new RuntimeException( "The parameter f must be a *static* field." );

       VarNode vn = findGlobalVarNode( f );
       if ( vn == null ) 
        return EmptyPointsToSet.v();

       IVarAbstraction pn = consG.get(vn);
       if( pn == null ) 
        return vn.getP2Set();

       // Lookup the cache
       if ( hasTransformed ||
        vn.getP2Set() != EmptyPointsToSet.v() ) return vn.getP2Set();   

       // We transform and cache the result for the next query
    pn = pn.getRepresentative();
    PointsToSetInternal ptSet = vn.makeP2Set();
    for ( AllocNode obj : pn.getRepresentative().get_all_points_to_objects() ) {
        ptSet.add( obj );
    }

    return ptSet;
}
项目:JAADAS    文件:GeomPointsTo.java   
public PointsToSet reachingObjects(AllocNode an, SootField f)
{
    AllocDotField adf = an.dot(f);
    IVarAbstraction pn = consG.get(adf);

    // No such pointer seen by SPARK
    if ( adf == null )
        return EmptyPointsToSet.v();

    // Not seen by geomPTA
    if ( pn == null )
        return adf.getP2Set();

    if ( hasTransformed ||
            adf.getP2Set() != EmptyPointsToSet.v() ) return adf.getP2Set(); 

        // We transform and cache the result for the next query
        pn = pn.getRepresentative();
        PointsToSetInternal ptSet = adf.makeP2Set();
        for ( AllocNode obj : pn.getRepresentative().get_all_points_to_objects() ) {
            ptSet.add( obj );
    }

    return ptSet;
}
项目:matos-tool    文件:CallbackResolver.java   
/** Given an invoke expression and a parameter index (0 for the
 * base, strictly positive for others), gets the pointstoset
 * abstracting the potential arguments of this call at the given
 * parameter position
 * @param ie the expression containing the invoke
 * @param index the parameter position
 * @return the pointstoset abstracting the argument contents. */
private PointsToSet getPointsTo(InvokeExpr ie, int index) {
    Value arg; 
    if (index==0)
        arg = ((InstanceInvokeExpr) ie).getBase();
    else arg = ie.getArg(index-1);
    if (arg instanceof Local) 
        return ptAnalysis.reachingObjects((Local) arg);
    else return EmptyPointsToSet.v();
}
项目:JAADAS    文件:GeomPointsTo.java   
@Override
public PointsToSet reachingObjects(Context c, Local l) 
{
    if ( !hasExecuted ) return super.reachingObjects(c, l);

    if ( hasTransformed ||
            !(c instanceof Unit) )
        return reachingObjects(l);

    LocalVarNode vn = findLocalVarNode(l);
    if ( vn == null ) 
        return EmptyPointsToSet.v();

    // Lookup the context sensitive points-to information for this pointer
    IVarAbstraction pn = consG.get(vn);
    if ( pn == null ) 
        return vn.getP2Set();

    pn = pn.getRepresentative();

    // Obtain the context sensitive points-to result
    SootMethod callee = vn.getMethod();
    Edge e = Scene.v().getCallGraph().findEdge((Unit) c, callee);
    if (e == null)
        return vn.getP2Set();

    // Compute the contexts interval
    CgEdge myEdge = getInternalEdgeFromSootEdge(e);
    if (myEdge == null)
        return vn.getP2Set();

    long low = myEdge.map_offset;
    long high = low + max_context_size_block[myEdge.s];

    // Lookup the cache
    ContextVarNode cvn = vn.context(c);
    if ( cvn != null ) {
        PointsToSetInternal ans = cvn.getP2Set();
        if ( ans != EmptyPointsToSet.v() ) return ans;
    }
    else {
        // Create a new context sensitive variable
        // The points-to vector is set to empty at start
        cvn = makeContextVarNode(vn, c);
    }

    // Fill
    PointsToSetInternal ptset = cvn.makeP2Set();
    for ( AllocNode an : pn.get_all_points_to_objects() ) {
        if ( pn.pointer_interval_points_to(low, high, an) )
            ptset.add(an);
    }

    return ptset;
}