Search in sources :

Example 1 with FlowSet

use of soot.toolkits.scalar.FlowSet in project soot by Sable.

the class StrayRWFinder method flowThrough.

/**
 * OUT is the same as (IN minus killSet) plus the genSet.
 */
protected void flowThrough(Object inValue, Object unit, Object outValue) {
    FlowSet in = (FlowSet) inValue, out = (FlowSet) outValue;
    RWSet stmtRead = sea.readSet(body.getMethod(), (Stmt) unit);
    RWSet stmtWrite = sea.writeSet(body.getMethod(), (Stmt) unit);
    Boolean addSelf = Boolean.FALSE;
    Iterator tnIt = tns.iterator();
    while (tnIt.hasNext()) {
        CriticalSection tn = (CriticalSection) tnIt.next();
        if (stmtRead.hasNonEmptyIntersection(tn.write) || stmtWrite.hasNonEmptyIntersection(tn.read) || stmtWrite.hasNonEmptyIntersection(tn.write))
            addSelf = Boolean.TRUE;
    }
    in.copy(out);
    if (addSelf.booleanValue()) {
        CriticalSection tn = new CriticalSection(false, body.getMethod(), 0);
        tn.entermonitor = (Stmt) unit;
        tn.units.add((Unit) unit);
        tn.read.union(stmtRead);
        tn.write.union(stmtWrite);
        out.add(tn);
    }
}
Also used : RWSet(soot.jimple.toolkits.pointer.RWSet) FlowSet(soot.toolkits.scalar.FlowSet) Iterator(java.util.Iterator)

Example 2 with FlowSet

use of soot.toolkits.scalar.FlowSet in project soot by Sable.

the class StrayRWFinder method merge.

/**
 * union, except for transactions in progress.  They get joined
 */
protected void merge(Object in1, Object in2, Object out) {
    FlowSet inSet1 = ((FlowSet) in1).clone(), inSet2 = ((FlowSet) in2).clone(), outSet = (FlowSet) out;
    /*
        boolean hasANull1 = false;
        Transaction tn1 = null;
        Iterator inIt1 = inSet1.iterator();
        while(inIt1.hasNext())
        {
            tn1 = (Transaction) inIt1.next();
            if(tn1.entermonitor == null)
            {
            	hasANull1 = true;
            	break;
            }
        }
        
        boolean hasANull2 = false;
        Transaction tn2 = null;
        Iterator inIt2 = inSet2.iterator();
        while(inIt2.hasNext())
        {
            tn2 = (Transaction) inIt2.next();
            if(tn2.entermonitor == null)
            {
            	hasANull2 = true;
            	break;
            }
        }
        if(hasANull1 && hasANull2)
        {
        	inSet1.remove(tn1);
        	Iterator itends = tn1.exitmonitors.iterator();
        	while(itends.hasNext())
        	{
        		Stmt stmt = (Stmt) itends.next();
        		if(!tn2.exitmonitors.contains(stmt))
        			tn2.exitmonitors.add(stmt);
        	}
        	tn2.read.union(tn1.read);
        	tn2.write.union(tn1.write);
        }
*/
    inSet1.union(inSet2, outSet);
}
Also used : FlowSet(soot.toolkits.scalar.FlowSet)

Example 3 with FlowSet

use of soot.toolkits.scalar.FlowSet in project soot by Sable.

the class StrayRWFinder method copy.

protected void copy(Object source, Object dest) {
    FlowSet sourceSet = (FlowSet) source, destSet = (FlowSet) dest;
    sourceSet.copy(destSet);
}
Also used : FlowSet(soot.toolkits.scalar.FlowSet)

Example 4 with FlowSet

use of soot.toolkits.scalar.FlowSet in project soot by Sable.

the class MultiCalledMethods method byMCalledS0.

private void byMCalledS0(PegCallGraph pcg) {
    Iterator it = pcg.iterator();
    while (it.hasNext()) {
        SootMethod sm = (SootMethod) it.next();
        UnitGraph graph = new CompleteUnitGraph(sm.getActiveBody());
        CallGraph callGraph = Scene.v().getCallGraph();
        MultiRunStatementsFinder finder = new MultiRunStatementsFinder(graph, sm, multiCalledMethods, callGraph);
        FlowSet fs = finder.getMultiRunStatements();
    }
}
Also used : UnitGraph(soot.toolkits.graph.UnitGraph) CompleteUnitGraph(soot.toolkits.graph.CompleteUnitGraph) CallGraph(soot.jimple.toolkits.callgraph.CallGraph) PegCallGraph(soot.jimple.toolkits.thread.mhp.pegcallgraph.PegCallGraph) FlowSet(soot.toolkits.scalar.FlowSet) SootMethod(soot.SootMethod) CompleteUnitGraph(soot.toolkits.graph.CompleteUnitGraph)

Example 5 with FlowSet

use of soot.toolkits.scalar.FlowSet in project soot by Sable.

the class StartJoinAnalysis method doFlowInsensitiveSingleIterationAnalysis.

public void doFlowInsensitiveSingleIterationAnalysis() {
    FlowSet fs = (FlowSet) newInitialFlow();
    Iterator stmtIt = graph.iterator();
    while (stmtIt.hasNext()) {
        Stmt s = (Stmt) stmtIt.next();
        flowThrough(fs, s, fs);
    }
}
Also used : FlowSet(soot.toolkits.scalar.FlowSet) Iterator(java.util.Iterator) Stmt(soot.jimple.Stmt)

Aggregations

FlowSet (soot.toolkits.scalar.FlowSet)8 Iterator (java.util.Iterator)2 Local (soot.Local)1 SootMethod (soot.SootMethod)1 ValueBox (soot.ValueBox)1 BinopExpr (soot.jimple.BinopExpr)1 Stmt (soot.jimple.Stmt)1 AbstractBinopExpr (soot.jimple.internal.AbstractBinopExpr)1 CallGraph (soot.jimple.toolkits.callgraph.CallGraph)1 RWSet (soot.jimple.toolkits.pointer.RWSet)1 PegCallGraph (soot.jimple.toolkits.thread.mhp.pegcallgraph.PegCallGraph)1 CompleteUnitGraph (soot.toolkits.graph.CompleteUnitGraph)1 UnitGraph (soot.toolkits.graph.UnitGraph)1