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); } }
static Local base(Stmt s) { InvokeStmt is = (InvokeStmt) s; InstanceInvokeExpr expr = (InstanceInvokeExpr) is.getInvokeExpr(); return (Local) expr.getBase(); }
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); }
private List<Register> getInstanceInvokeArgumentRegs(InstanceInvokeExpr iie) { constantV.setOrigStmt(origStmt); List<Register> argumentRegs = getInvokeArgumentRegs(iie); // always add reference to callee as first parameter (instance != // static) Local callee = (Local) iie.getBase(); Register calleeRegister = regAlloc.asLocal(callee); argumentRegs.add(0, calleeRegister); return argumentRegs; }
public boolean changeOriginalAST() { // originalDavaBody has to be changed // fix up the call within the constructorUnit....the args should be // argsOne followed by a method call to preInit if (originalConstructorExpr == null) { // hmm that means there was no call to super in the original code // System.out.println("originalConstructorExpr is null"); return false; } List thisArgList = new ArrayList(); thisArgList.addAll(argsOneValues); DStaticInvokeExpr newInvokeExpr = new DStaticInvokeExpr(newSootPreInitMethod.makeRef(), argsOneValues); thisArgList.add(newInvokeExpr); // the methodRef of themethod to be called is the new constructor we // created InstanceInvokeExpr tempExpr = new DSpecialInvokeExpr(originalConstructorExpr.getBase(), newConstructor.makeRef(), thisArgList); originalDavaBody.set_ConstructorExpr(tempExpr); // create Invoke Stmt with tempExpr as the expression GInvokeStmt s = new GInvokeStmt(tempExpr); originalDavaBody.set_ConstructorUnit(s); // originalASTMethod has to be made empty originalASTMethod.setDeclarations(new ASTStatementSequenceNode(new ArrayList<AugmentedStmt>())); originalASTMethod.replaceBody(new ArrayList<Object>()); return true; }
public void defaultFeedPtsRoutines() { switch (Parameters.seedPts) { case Constants.seedPts_allUser: setAllUserCodeVariablesUseful(); break; case Constants.seedPts_all: // All pointers will be processed for (int i = 0; i < n_var; ++i) { IVarAbstraction pn = int2var.get(i); if (pn != null && pn.getRepresentative() == pn) { pn.willUpdate = true; } } return; } // We always refine the callsites that have multiple call targets Set<Node> multiBaseptrs = new HashSet<Node>(); for (Stmt callsite : geomPTA.multiCallsites) { InstanceInvokeExpr iie = (InstanceInvokeExpr) callsite.getInvokeExpr(); VarNode vn = geomPTA.findLocalVarNode(iie.getBase()); multiBaseptrs.add(vn); } addUserDefPts(multiBaseptrs); }
SootMethod invokeMethod = ie.getMethod(); if (invokeMethod.getName().equals("start")) { RefType baseType = (RefType) iie.getBase().getType(); if (!baseType.getSootClass().isInterface()) // the start method we're looking for is NOT an interface method RefType baseType = (RefType) iie.getBase().getType(); if (!baseType.getSootClass().isInterface()) { List<SootClass> superClasses = hierarchy.getSuperclassesOfIncluding(baseType.getSootClass());
Local base = (Local) iie.getBase(); RefType concreteType = bodyToLMNAA.getUnchecked(unitToOwner.get(u)).concreteType(base, stmt); if (concreteType != null) {
/** * @param stmt * any statement containing an InvokeExpr * * @see PurityGraph.methodCall */ @Override protected void applySummary(PurityGraphBox src, Stmt stmt, PurityGraphBox summary, PurityGraphBox dst) { // extract call info InvokeExpr e = stmt.getInvokeExpr(); Local ret = null; if (stmt instanceof AssignStmt) { Local v = (Local) ((AssignStmt) stmt).getLeftOp(); if (v.getType() instanceof RefLikeType) { ret = v; } } Local obj = null; if (!(e instanceof StaticInvokeExpr)) { obj = (Local) ((InstanceInvokeExpr) e).getBase(); } List<Value> args = e.getArgs(); // call methoCall on the PurityGraph PurityGraph g = new PurityGraph(src.g); g.methodCall(summary.g, obj, args, ret); dst.g = g; }
/** * 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); } }
private void handleInvokeExpr(InvokeExpr ie, Stmt stmt) { SootMethodRef m = ie.getMethodRef(); if (ie instanceof InstanceInvokeExpr) { InstanceInvokeExpr iie = (InstanceInvokeExpr) ie; iie.setBase(this.uv.visit(iie.getBase(), m.declaringClass().getType(), stmt)); } for (int i = 0; i < ie.getArgCount(); i++) { ie.setArg(i, this.uv.visit(ie.getArg(i), m.parameterType(i), stmt)); } }
private void caseInstanceInvokeExpr(InstanceInvokeExpr expr) { result = result.add(mgr.RESOLVE_METHOD_ERRORS); result = result.add(mgr.NULL_POINTER_EXCEPTION); for (int i = 0; i < expr.getArgCount(); i++) { result = result.add(mightThrow(expr.getArg(i))); } result = result.add(mightThrow(expr.getBase())); result = result.add(mightThrow(expr.getMethodRef())); } }
Local receiver = (Local) iie.getBase(); NumberedString subSig = iie.getMethodRef().getSubSignature(); addVirtualCallSite(s, m, receiver, iie, subSig, Edge.ieToKind(iie));
protected void checkInvokeExpr(Body b, InvokeExpr ie, Stmt s) { if (ie instanceof InstanceInvokeExpr && ((InstanceInvokeExpr) ie).getBase().getType() instanceof ArrayType && ie.getMethodRef().name().equals("clone") && ie.getMethodRef().parameterTypes().size() == 0) { return; // the call is to the clone() method of an array type, which
if (ie instanceof InstanceInvokeExpr) { InstanceInvokeExpr iie = (InstanceInvokeExpr) ie; if (iie.getBase() == l) { replace = true;
Value base = (ie instanceof InstanceInvokeExpr) ? ((InstanceInvokeExpr) ie).getBase() : null;
InstanceInvokeExpr iie = (InstanceInvokeExpr) ie; Node baseNode = srcnf.getNode(iie.getBase()); baseNode = srcmpag.parameterize(baseNode, srcContext); baseNode = baseNode.getReplacement();
checkCopy(stmt, body, exception, called.declaringClass().getType(), iiexpr.getBase().getType(), " in receiver of call" + errorSuffix);
Local base = (Local) ((InstanceInvokeExpr) v).getBase(); p.println("Local base = localByName(b,\"" + base.getName() + "\");");