Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
package soot.jimple.toolkits.thread;
/*-
* #%L
* Soot - a J*va Optimization Framework
* %%
* Copyright (C) 1997 - 2018 Raja Vallée-Rai and others
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 2.1 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* .
* #L%
*/
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import soot.EquivalentValue;
import soot.SootClass;
import soot.SootMethod;
import soot.Value;
import soot.jimple.FieldRef;
import soot.jimple.InstanceFieldRef;
import soot.jimple.InvokeExpr;
import soot.jimple.Ref;
import soot.jimple.toolkits.infoflow.CallLocalityContext;
import soot.jimple.toolkits.infoflow.ClassInfoFlowAnalysis;
import soot.jimple.toolkits.infoflow.ClassLocalObjectsAnalysis;
import soot.jimple.toolkits.infoflow.InfoFlowAnalysis;
import soot.jimple.toolkits.infoflow.LocalObjectsAnalysis;
import soot.jimple.toolkits.infoflow.SmartMethodInfoFlowAnalysis;
import soot.jimple.toolkits.infoflow.SmartMethodLocalObjectsAnalysis;
import soot.jimple.toolkits.infoflow.UseFinder;
import soot.jimple.toolkits.thread.mhp.MhpTester;
// ThreadLocalObjectsAnalysis written by Richard L. Halpert, 2007-03-05
// Runs LocalObjectsAnalysis for the special case where we want to know
// if a reference is local to all threads from which it is reached.
public class ThreadLocalObjectsAnalysis extends LocalObjectsAnalysis implements IThreadLocalObjectsAnalysis {
private static final Logger logger = LoggerFactory.getLogger(ThreadLocalObjectsAnalysis.class);
MhpTester mhp;
List threads;
InfoFlowAnalysis primitiveDfa;
static boolean printDebug = false;
Map valueCache;
Map fieldCache;
Map invokeCache;
public ThreadLocalObjectsAnalysis(MhpTester mhp) // must include main class
{
super(new InfoFlowAnalysis(false, true, printDebug)); // ref-only, with inner fields
this.mhp = mhp;
this.threads = mhp.getThreads();
this.primitiveDfa = new InfoFlowAnalysis(true, true, printDebug); // ref+primitive, with inner fields
valueCache = new HashMap();
fieldCache = new HashMap();
invokeCache = new HashMap();
}
// Forces the majority of computation to take place immediately, rather than on-demand
// might occasionally compute more than is necessary
public void precompute() {
for (AbstractRuntimeThread thread : threads) {
for (Object item : thread.getRunMethods()) {
SootMethod runMethod = (SootMethod) item;
if (runMethod.getDeclaringClass().isApplicationClass()) {
getClassLocalObjectsAnalysis(runMethod.getDeclaringClass());
}
}
}
}
// override
protected ClassLocalObjectsAnalysis newClassLocalObjectsAnalysis(LocalObjectsAnalysis loa, InfoFlowAnalysis dfa,
UseFinder uf, SootClass sc) {
// find the right run methods to use for threads of type sc
List runMethods = new ArrayList();
Iterator threadsIt = threads.iterator();
while (threadsIt.hasNext()) {
AbstractRuntimeThread thread = threadsIt.next();
Iterator