本文整理汇总了Java中soot.jimple.InstanceInvokeExpr.getBase方法的典型用法代码示例。如果您正苦于以下问题:Java InstanceInvokeExpr.getBase方法的具体用法?Java InstanceInvokeExpr.getBase怎么用?Java InstanceInvokeExpr.getBase使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类soot.jimple.InstanceInvokeExpr
的用法示例。
在下文中一共展示了InstanceInvokeExpr.getBase方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: generateAtConstructor
import soot.jimple.InstanceInvokeExpr; //导入方法依赖的package包/类
protected Collection<Pair<AccessGraph, EdgeFunction<TypestateDomainValue>>> generateAtConstructor(Unit unit,
Collection<SootMethod> calledMethod, MatcherTransition initialTrans) {
boolean matches = false;
for (SootMethod method : calledMethod) {
if (initialTrans.matches(method)) {
matches = true;
}
}
if (!matches)
return Collections.emptySet();
if (unit instanceof Stmt) {
Stmt stmt = (Stmt) unit;
if (stmt.containsInvokeExpr())
if (stmt.getInvokeExpr() instanceof InstanceInvokeExpr) {
InstanceInvokeExpr iie = (InstanceInvokeExpr) stmt.getInvokeExpr();
if (iie.getBase() instanceof Local) {
Local l = (Local) iie.getBase();
Set<Pair<AccessGraph, EdgeFunction<TypestateDomainValue>>> out = new HashSet<>();
out.add(new Pair<AccessGraph, EdgeFunction<TypestateDomainValue>>(
new AccessGraph(l, l.getType()), new TransitionFunction(initialTrans)));
return out;
}
}
}
return Collections.emptySet();
}
示例2: generateThisAtAnyCallSitesOf
import soot.jimple.InstanceInvokeExpr; //导入方法依赖的package包/类
protected Collection<Pair<AccessGraph, EdgeFunction<TypestateDomainValue>>> generateThisAtAnyCallSitesOf(Unit unit,
Collection<SootMethod> calledMethod, Set<SootMethod> hasToCall, MatcherTransition initialTrans) {
for (SootMethod callee : calledMethod) {
if (hasToCall.contains(callee)) {
if (unit instanceof Stmt) {
if (((Stmt) unit).getInvokeExpr() instanceof InstanceInvokeExpr) {
InstanceInvokeExpr iie = (InstanceInvokeExpr) ((Stmt) unit).getInvokeExpr();
Local thisLocal = (Local) iie.getBase();
Set<Pair<AccessGraph, EdgeFunction<TypestateDomainValue>>> out = new HashSet<>();
out.add(new Pair<AccessGraph, EdgeFunction<TypestateDomainValue>>(
new AccessGraph(thisLocal, thisLocal.getType()), new TransitionFunction(initialTrans)));
return out;
}
}
}
}
return Collections.emptySet();
}
示例3: getCallTargets
import soot.jimple.InstanceInvokeExpr; //导入方法依赖的package包/类
/**
* Obtain the set of possible call targets at given @param callsite.
*/
private void getCallTargets(IVarAbstraction pn, SootMethod src,
Stmt callsite, ChunkedQueue<SootMethod> targetsQueue)
{
InstanceInvokeExpr iie = (InstanceInvokeExpr)callsite.getInvokeExpr();
Local receiver = (Local)iie.getBase();
NumberedString subSig = iie.getMethodRef().getSubSignature();
// We first build the set of possible call targets
for (AllocNode an : pn.get_all_points_to_objects()) {
Type type = an.getType();
if (type == null) continue;
VirtualCalls.v().resolve(type,
receiver.getType(), subSig, src,
targetsQueue);
}
}
示例4: getCallToReturnFlowFunction
import soot.jimple.InstanceInvokeExpr; //导入方法依赖的package包/类
@Override
public FlowFunction<WrappedAccessGraph> getCallToReturnFlowFunction(WrappedAccessGraph sourceFact, final Unit callStmt,
Unit returnSite, boolean hasCallees) {
if (!hasCallees) {
return Identity.v();
}
if (!(callStmt instanceof Stmt)) {
return Identity.v();
}
Stmt callSite = (Stmt) callStmt;
if (!callSite.containsInvokeExpr()) {
return Identity.v();
}
final InvokeExpr invokeExpr = callSite.getInvokeExpr();
final SootMethod callee = invokeExpr.getMethod();
return new FlowFunction<WrappedAccessGraph>() {
@Override
public Set<WrappedAccessGraph> computeTargets(WrappedAccessGraph source) {
for (int i = 0; i < invokeExpr.getArgCount(); i++) {
if (source.baseMatches(invokeExpr.getArg(i))) {
return Collections.emptySet();
}
}
if (invokeExpr instanceof InstanceInvokeExpr) {
InstanceInvokeExpr iie = (InstanceInvokeExpr) invokeExpr;
Value base = iie.getBase();
if (source.baseMatches(base)) {
return Collections.emptySet();
}
}
return Collections.singleton(source);
}
};
}
示例5: generate
import soot.jimple.InstanceInvokeExpr; //导入方法依赖的package包/类
@Override
public Collection<Pair<AccessGraph, EdgeFunction<TypestateDomainValue>>> generate(Unit unit,
Collection<SootMethod> calledMethod) {
boolean matches = false;
for (SootMethod method : calledMethod) {
if (initialTrans.matches(method) && !initialTrans.matches(icfg.getMethodOf(unit))) {
matches = true;
}
}
if (!matches || icfg.getMethodOf(unit).getSignature().equals("<java.lang.ClassLoader: void <clinit>()>"))
return Collections.emptySet();
if (unit instanceof Stmt) {
Stmt stmt = (Stmt) unit;
if (stmt.containsInvokeExpr())
if (stmt.getInvokeExpr() instanceof InstanceInvokeExpr) {
InstanceInvokeExpr iie = (InstanceInvokeExpr) stmt.getInvokeExpr();
if (iie.getBase() instanceof Local) {
Local l = (Local) iie.getBase();
Set<Pair<AccessGraph, EdgeFunction<TypestateDomainValue>>> out = new HashSet<>();
out.add(new Pair<AccessGraph, EdgeFunction<TypestateDomainValue>>(
new AccessGraph(l, l.getType()), new TransitionFunction(initialTrans)));
return out;
}
}
}
return Collections.emptySet();
}
示例6: replaceStart
import soot.jimple.InstanceInvokeExpr; //导入方法依赖的package包/类
private void replaceStart(Body b, Unit unit) {
System.out.println("replace start: " + unit);
// Suppose we have r1.<Thread start()>
// The first step is to find parameter p in
// r1.<Thread <init>(p)>
Stmt stmt = (Stmt) unit;
InvokeExpr iexpr = stmt.getInvokeExpr();
InstanceInvokeExpr iiexpr = (InstanceInvokeExpr) iexpr;
Value base = iiexpr.getBase();
Type bType = getTypeOfBase(b, (Local) base, unit);
if (bType == null) {
System.out.println("warning: null thread type, just removing start().");
}
Util.removeUnit(b, unit);
return;
// if (bType.toString().equals("java.lang.Thread")) {
// System.out.println("find runnable type:");
// // findRunnableType();
// }
//
//
//
// // p is of type runnable, so the second step
// // is to find the real type of p
}
示例7: findRunnableType
import soot.jimple.InstanceInvokeExpr; //导入方法依赖的package包/类
private void findRunnableType(Body b, Unit newThread) {
AssignStmt ass = (AssignStmt) newThread;
Local base = (Local) ass.getLeftOp();
Unit tu = null;
Value runnableArg = null;
for (Unit u : b.getUnits()) {
Stmt s = (Stmt) u;
if (s.containsInvokeExpr()) {
InvokeExpr ie = s.getInvokeExpr();
String ieSig = ie.getMethodRef().getSignature();
if (ieSig.startsWith(threadInitSSig)) {
InstanceInvokeExpr iie = (InstanceInvokeExpr) ie;
if (iie.getBase() == base) {
System.out.println("same base for init...");
int i = 0;
for (Type pt : iie.getMethod().getParameterTypes()) {
System.out.println("type: " + pt);
if (pt.toString().equals("java.lang.Runnable")) {
tu = u;
runnableArg = iie.getArg(i);
break;
}
i++;
}
}
}
}
}
// we do this outside the loop so we can add units
if (tu != null && runnableArg != null && runnableArg instanceof Local) {
findRunnableDef(b, (Local) runnableArg, tu);
}
}
示例8: handleInvokeExpr
import soot.jimple.InstanceInvokeExpr; //导入方法依赖的package包/类
private void handleInvokeExpr(InvokeExpr invokeExpr,AnalysisInfo out) {
if(invokeExpr instanceof InstanceInvokeExpr) {
InstanceInvokeExpr instanceInvokeExpr = (InstanceInvokeExpr) invokeExpr;
//here we know that the receiver must point to an object
Value base = instanceInvokeExpr.getBase();
out.put(base,NON_NULL);
}
//but the returned object might point to everything
// out.put(invokeExpr, TOP);
}
示例9: handleInvokeExpr
import soot.jimple.InstanceInvokeExpr; //导入方法依赖的package包/类
private void handleInvokeExpr(InvokeExpr invokeExpr,AnalysisInfo out) {
if(invokeExpr instanceof InstanceInvokeExpr) {
InstanceInvokeExpr instanceInvokeExpr = (InstanceInvokeExpr) invokeExpr;
//here we know that the receiver must point to an object
Value base = instanceInvokeExpr.getBase();
out.put(base,NON_NULL);
}
}
示例10: load
import soot.jimple.InstanceInvokeExpr; //导入方法依赖的package包/类
@Override
public Set<SootMethod> load(Unit u) throws Exception {
Stmt stmt = (Stmt)u;
InvokeExpr ie = stmt.getInvokeExpr();
FastHierarchy fastHierarchy = Scene.v().getFastHierarchy();
//FIXME Handle Thread.start etc.
if(ie instanceof InstanceInvokeExpr) {
if(ie instanceof SpecialInvokeExpr) {
//special
return Collections.singleton(ie.getMethod());
} else {
//virtual and interface
InstanceInvokeExpr iie = (InstanceInvokeExpr) ie;
Local base = (Local) iie.getBase();
RefType concreteType = bodyToLMNAA.getUnchecked(unitToOwner.get(u)).concreteType(base, stmt);
if(concreteType!=null) {
//the base variable definitely points to a single concrete type
SootMethod singleTargetMethod = fastHierarchy.resolveConcreteDispatch(concreteType.getSootClass(), iie.getMethod());
return Collections.singleton(singleTargetMethod);
} else {
SootClass baseTypeClass;
if(base.getType() instanceof RefType) {
RefType refType = (RefType) base.getType();
baseTypeClass = refType.getSootClass();
} else if(base.getType() instanceof ArrayType) {
baseTypeClass = Scene.v().getSootClass("java.lang.Object");
} else if(base.getType() instanceof NullType) {
//if the base is definitely null then there is no call target
return Collections.emptySet();
} else {
throw new InternalError("Unexpected base type:"+base.getType());
}
return fastHierarchy.resolveAbstractDispatch(baseTypeClass, iie.getMethod());
}
}
} else {
//static
return Collections.singleton(ie.getMethod());
}
}
示例11: getInstanceInvokeArgumentRegs
import soot.jimple.InstanceInvokeExpr; //导入方法依赖的package包/类
private List<Register> getInstanceInvokeArgumentRegs(InstanceInvokeExpr iie) {
constantV.setOrigStmt(origStmt);
List<Register> argumentRegs = getInvokeArgumentRegs(iie);
// always add reference to callee as first parameter (instance != static)
Value callee = iie.getBase();
Register calleeRegister = regAlloc.asLocal(callee);
argumentRegs.add(0, calleeRegister);
return argumentRegs;
}
示例12: load
import soot.jimple.InstanceInvokeExpr; //导入方法依赖的package包/类
@Override
public Set<SootMethod> load(Unit u) throws Exception {
Stmt stmt = (Stmt) u;
InvokeExpr ie = stmt.getInvokeExpr();
FastHierarchy fastHierarchy = Scene.v().getFastHierarchy();
// FIXME Handle Thread.start etc.
if (ie instanceof InstanceInvokeExpr) {
if (ie instanceof SpecialInvokeExpr) {
// special
return Collections.singleton(ie.getMethod());
} else {
// virtual and interface
InstanceInvokeExpr iie = (InstanceInvokeExpr) ie;
Local base = (Local) iie.getBase();
RefType concreteType = bodyToLMNAA.getUnchecked(unitToOwner.get(u)).concreteType(base,
stmt);
if (concreteType != null) {
// the base variable definitely points to a
// single concrete type
SootMethod singleTargetMethod = fastHierarchy
.resolveConcreteDispatch(concreteType.getSootClass(), iie.getMethod());
return Collections.singleton(singleTargetMethod);
} else {
SootClass baseTypeClass;
if (base.getType() instanceof RefType) {
RefType refType = (RefType) base.getType();
baseTypeClass = refType.getSootClass();
} else if (base.getType() instanceof ArrayType) {
baseTypeClass = Scene.v().getSootClass("java.lang.Object");
} else if (base.getType() instanceof NullType) {
// if the base is definitely null then there
// is no call target
return Collections.emptySet();
} else {
throw new InternalError("Unexpected base type:" + base.getType());
}
return fastHierarchy.resolveAbstractDispatch(baseTypeClass, iie.getMethod());
}
}
} else {
// static
return Collections.singleton(ie.getMethod());
}
}
示例13: getReturnFlowFunction
import soot.jimple.InstanceInvokeExpr; //导入方法依赖的package包/类
@Override
public FlowFunction<AccessGraph> getReturnFlowFunction(IPathEdge<Unit, AccessGraph> edge,
final Unit callStmt, final SootMethod callee, final Unit returnSite) {
final Local[] paramLocals = new Local[callee.getParameterCount()];
for (int i = 0; i < callee.getParameterCount(); i++)
paramLocals[i] = callee.getActiveBody().getParameterLocal(i);
final Unit exitStmt = edge.getTarget();
final Local thisLocal = callee.isStatic() ? null : callee.getActiveBody().getThisLocal();
return new FlowFunction<AccessGraph>() {
@Override
public Set<AccessGraph> computeTargets(AccessGraph source) {
HashSet<AccessGraph> out = new HashSet<AccessGraph>();
// mapping of fields of AccessPath those will be killed in
// callToReturn
if (context.trackStaticFields() && source.isStatic())
return Collections.singleton(source);
if (callStmt instanceof Stmt) {
Stmt is = (Stmt) callStmt;
if (is.containsInvokeExpr()) {
InvokeExpr ie = is.getInvokeExpr();
for (int i = 0; i < paramLocals.length; i++) {
if (paramLocals[i] == source.getBase()) {
Value arg = ie.getArg(i);
if (arg instanceof Local) {
if (typeCompatible(((Local) arg).getType(), source.getBaseType())) {
AccessGraph deriveWithNewLocal =
source.deriveWithNewLocal((Local) arg, source.getBaseType());
out.add(deriveWithNewLocal);
}
}
}
}
if (!callee.isStatic() && ie instanceof InstanceInvokeExpr) {
if (source.baseMatches(thisLocal)) {
InstanceInvokeExpr iIExpr = (InstanceInvokeExpr) is.getInvokeExpr();
Local newBase = (Local) iIExpr.getBase();
if (typeCompatible(newBase.getType(), source.getBaseType())) {
AccessGraph possibleAccessPath =
source.deriveWithNewLocal((Local) iIExpr.getBase(), source.getBaseType());
out.add(possibleAccessPath);
}
}
}
}
}
if (callStmt instanceof AssignStmt && exitStmt instanceof ReturnStmt) {
AssignStmt as = (AssignStmt) callStmt;
Value leftOp = as.getLeftOp();
// mapping of return value
ReturnStmt returnStmt = (ReturnStmt) exitStmt;
Value returns = returnStmt.getOp();
// d = return out;
if (leftOp instanceof Local) {
if (returns instanceof Local && source.getBase() == returns) {
out.add(source.deriveWithNewLocal((Local) leftOp, source.getBaseType()));
}
}
}
return out;
}
};
}