public static int parameterRefNumber(ParameterRef r) { // unique number for ParameterRef[i] (must be <0) return -1 - r.getIndex(); }
public void caseParameterRef(ParameterRef v) { String oldName = varName; Type paramType = v.getType(); suggestVariableName("paramType"); String paramTypeName = this.varName; ttp.setVariableName(paramTypeName); paramType.apply(ttp); int number = v.getIndex(); suggestVariableName("number"); p.println("int " + varName + "=" + number + ";"); p.println("Value " + oldName + " = Jimple.v().newParameterRef(" + paramTypeName + ", " + varName + ");"); varName = oldName; }
/** * Constructs a ParameterRef(SootMethod, int) grammar chunk. */ public ParameterRef newParameterRef(Type paramType, int number) { return new ParameterRef(paramType, number); }
if (ir instanceof ParameterRef) { ParameterRef pr = (ParameterRef) ir; fieldsStaticsParamsAccessed.add(InfoFlowAnalysis.getNodeForParameterRef(sm, pr.getIndex())); returnValueRef = new ParameterRef(sm.getReturnType(), -1); dataFlowGraph.addNode(InfoFlowAnalysis.getNodeForReturnRef(sm)); if (returnValueRef != null && (returnValueRef.getType() instanceof RefLikeType || dfa.includesPrimitiveInfoFlow())) { dataFlowGraph.addEdge(r, InfoFlowAnalysis.getNodeForReturnRef(sm));
returnValueRef = new ParameterRef(sm.getReturnType(), -1); dataFlowGraph.addNode(InfoFlowAnalysis.getNodeForReturnRef(sm)); if (returnValueRef != null && (returnValueRef.getType() instanceof RefLikeType || dfa.includesPrimitiveInfoFlow())) { dataFlowGraph.addEdge(r, InfoFlowAnalysis.getNodeForReturnRef(sm));
protected void internalTransform(Body b, String phaseName, Map options) { PointsToAnalysis pa = Scene.v().getPointsToAnalysis(); Set<IdentityStmt> parms = new HashSet<IdentityStmt>(); for (Iterator sIt = b.getUnits().iterator(); sIt.hasNext();) { final Stmt s = (Stmt) sIt.next(); if (!(s instanceof IdentityStmt)) { continue; } IdentityStmt is = (IdentityStmt) s; ValueBox vb = is.getRightOpBox(); if (!(vb.getValue() instanceof ParameterRef)) { continue; } ParameterRef pr = (ParameterRef) vb.getValue(); if (!(pr.getType() instanceof RefLikeType)) { continue; } parms.add(is); } int colour = 0; while (!parms.isEmpty()) { fill(parms, parms.iterator().next(), colour++, pa); } }
fieldsStaticsParamsAccessed.add(InfoFlowAnalysis.getNodeForParameterRef(sm, pr.getIndex())); if(sm.getReturnType() != VoidType.v()) returnValueRef = new ParameterRef(sm.getReturnType(), -1); dataFlowGraph.addNode(InfoFlowAnalysis.getNodeForReturnRef(sm)); dataFlowGraph.addEdge(r, s); if( returnValueRef != null && (returnValueRef.getType() instanceof RefLikeType || dfa.includesPrimitiveInfoFlow())) dataFlowGraph.addEdge(r, InfoFlowAnalysis.getNodeForReturnRef(sm));
if(sm.getReturnType() != VoidType.v()) returnValueRef = new ParameterRef(sm.getReturnType(), -1); dataFlowGraph.addNode(InfoFlowAnalysis.getNodeForReturnRef(sm)); dataFlowGraph.addEdge(r, s); if( returnValueRef != null && (returnValueRef.getType() instanceof RefLikeType || dfa.includesPrimitiveInfoFlow()) ) dataFlowGraph.addEdge(r, InfoFlowAnalysis.getNodeForReturnRef(sm));
return ((ThisRef) expr).getType(); } else if (expr instanceof ParameterRef) { return ((ParameterRef) expr).getType(); } else if (expr instanceof Local) { Local ex = (Local) expr;
public void setAllParamsLocal() { for (int i = 0; i < nodes.size(); i++) { Ref r = (Ref) ((EquivalentValue) nodes.get(i)).getValue(); if (r instanceof ParameterRef) { ParameterRef pr = (ParameterRef) r; if (pr.getIndex() != -1) { isNodeLocal.remove(i); isNodeLocal.add(i, Boolean.TRUE); } } } }
public void convertToBaf(JimpleToBafContext context, List<Unit> out) { Value currentRhs = getRightOp(); Value newRhs; if (currentRhs instanceof ThisRef) { newRhs = Baf.v().newThisRef((RefType) ((ThisRef) currentRhs).getType()); } else if (currentRhs instanceof ParameterRef) { newRhs = Baf.v().newParameterRef(((ParameterRef) currentRhs).getType(), ((ParameterRef) currentRhs).getIndex()); } else if (currentRhs instanceof CaughtExceptionRef) { Unit u = Baf.v().newStoreInst(RefType.v(), context.getBafLocalOfJimpleLocal((Local) getLeftOp())); u.addAllTagsOf(this); out.add(u); return; } else { throw new RuntimeException("Don't know how to convert unknown rhs"); } Unit u = Baf.v().newIdentityInst(context.getBafLocalOfJimpleLocal((Local) getLeftOp()), newRhs); u.addAllTagsOf(this); out.add(u); }
fieldsStaticsParamsAccessed.add(InfoFlowAnalysis.getNodeForParameterRef(sm, pr.getIndex())); if(sm.getReturnType() != VoidType.v()) returnValueRef = new ParameterRef(sm.getReturnType(), -1); dataFlowGraph.addNode(InfoFlowAnalysis.getNodeForReturnRef(sm)); dataFlowGraph.addEdge(r, s); if( returnValueRef != null && (returnValueRef.getType() instanceof RefLikeType || dfa.includesPrimitiveInfoFlow())) dataFlowGraph.addEdge(r, InfoFlowAnalysis.getNodeForReturnRef(sm));
/** * Constructs a ParameterRef(SootMethod, int) grammar chunk. */ public ParameterRef newParameterRef(Type paramType, int number) { return new ParameterRef(paramType, number); }
if(sm.getReturnType() != VoidType.v()) returnValueRef = new ParameterRef(sm.getReturnType(), -1); dataFlowGraph.addNode(InfoFlowAnalysis.getNodeForReturnRef(sm)); dataFlowGraph.addEdge(r, s); if( returnValueRef != null && (returnValueRef.getType() instanceof RefLikeType || dfa.includesPrimitiveInfoFlow()) ) dataFlowGraph.addEdge(r, InfoFlowAnalysis.getNodeForReturnRef(sm));
protected void internalTransform( Body b, String phaseName, Map options) { PointsToAnalysis pa = Scene.v().getPointsToAnalysis(); Set<IdentityStmt> parms = new HashSet<IdentityStmt>(); for( Iterator sIt = b.getUnits().iterator(); sIt.hasNext(); ) { final Stmt s = (Stmt) sIt.next(); if( !(s instanceof IdentityStmt) ) continue; IdentityStmt is = (IdentityStmt) s; ValueBox vb = is.getRightOpBox(); if( !(vb.getValue() instanceof ParameterRef) ) continue; ParameterRef pr = (ParameterRef) vb.getValue(); if( !(pr.getType() instanceof RefLikeType) ) continue; parms.add(is); } int colour = 0; while( !parms.isEmpty() ) { fill( parms, parms.iterator().next(), colour++, pa ); } } private void fill( Set<IdentityStmt> parms, IdentityStmt parm, int colour, PointsToAnalysis pa ) {
public void setParamShared(int index) { for (int i = 0; i < nodes.size(); i++) { Ref r = (Ref) ((EquivalentValue) nodes.get(i)).getValue(); if (r instanceof ParameterRef) { ParameterRef pr = (ParameterRef) r; if (pr.getIndex() == index) { isNodeLocal.remove(i); isNodeLocal.add(i, Boolean.FALSE); } } } }
if (!(param.getType() instanceof RefLikeType) && (!dfa.includesPrimitiveInfoFlow() || method.getName().equals("<init>"))) InvokeExpr ie = s.getInvokeExpr(); if (ie.getMethodRef().resolve() == method) { if (((ParameterRef) parameterRef.getValue()).getIndex() >= 0) { if (!isObjectLocal(ie.getArg(((ParameterRef) parameterRef.getValue()).getIndex()), containingMethod,
/** Create a new ParameterRef object with the same paramType and number. */ public Object clone() { return new ParameterRef(paramType, n); }
protected void internalTransform( Body b, String phaseName, Map options) { PointsToAnalysis pa = Scene.v().getPointsToAnalysis(); Set<IdentityStmt> parms = new HashSet<IdentityStmt>(); for( Iterator sIt = b.getUnits().iterator(); sIt.hasNext(); ) { final Stmt s = (Stmt) sIt.next(); if( !(s instanceof IdentityStmt) ) continue; IdentityStmt is = (IdentityStmt) s; ValueBox vb = is.getRightOpBox(); if( !(vb.getValue() instanceof ParameterRef) ) continue; ParameterRef pr = (ParameterRef) vb.getValue(); if( !(pr.getType() instanceof RefLikeType) ) continue; parms.add(is); } int colour = 0; while( !parms.isEmpty() ) { fill( parms, parms.iterator().next(), colour++, pa ); } } private void fill( Set<IdentityStmt> parms, IdentityStmt parm, int colour, PointsToAnalysis pa ) {