public static int parameterRefNumber(ParameterRef r) { // unique number for ParameterRef[i] (must be <0) return -1 - r.getIndex(); }
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 setParamLocal(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.TRUE); } } } }
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); } } } }
public void setAllParamsShared() { 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.FALSE); } } } }
@Override final public void caseParameterRef(ParameterRef pr) { setResult(caseParm(pr.getIndex())); }
public void identityRef(IdentityRef r) { handleIndent(); if (r instanceof ThisRef) { literal("@this"); } else if (r instanceof ParameterRef) { ParameterRef pr = (ParameterRef) r; literal("@parameter" + pr.getIndex()); } else if (r instanceof CaughtExceptionRef) { literal("@caughtexception"); } else { throw new RuntimeException(); } }
sourcesnamelength = lastnamelength; logger.debug("@parameter" + pr.getIndex()); } else { String name = v.toString();
/** * Returns the list of parameter references used in this body. The list is as long as the number of parameters declared in * the associated method's signature. The list may have <code>null</code> entries for parameters not referenced in the * body. The returned list is of fixed size. */ public List<Value> getParameterRefs() { Value[] res = new Value[getMethod().getParameterCount()]; for (Unit s : getUnits()) { if (s instanceof IdentityStmt) { Value rightOp = ((IdentityStmt) s).getRightOp(); if (rightOp instanceof ParameterRef) { ParameterRef parameterRef = (ParameterRef) rightOp; res[parameterRef.getIndex()] = parameterRef; } } } return Arrays.asList(res); }
/** Return LHS of the first identity stmt assigning from \@parameter i. **/ public Local getParameterLocal(int i) { for (Unit s : getUnits()) { if (s instanceof IdentityStmt && ((IdentityStmt) s).getRightOp() instanceof ParameterRef) { IdentityStmt is = (IdentityStmt) s; ParameterRef pr = (ParameterRef) is.getRightOp(); if (pr.getIndex() == i) { return (Local) is.getLeftOp(); } } } throw new RuntimeException("couldn't find parameterref" + i + "! in " + getMethod()); }
if (param.getIndex() == -1) { continue; source = ie.getArg(param.getIndex()); // Immediate } else if (node instanceof StaticFieldRef) { if (sink instanceof ParameterRef) { ParameterRef param = (ParameterRef) sink; if (param.getIndex() == -1) { returnValueSources.add(source); } else { handleFlowsToDataStructure(ie.getArg(param.getIndex()), source, fs);
/** * Get all the LHS of the identity statements assigning from parameter references. * * @return a list of size as per <code>getMethod().getParameterCount()</code> with all elements ordered as per the * parameter index. * @throws RuntimeException * if a parameterref is missing */ public List<Local> getParameterLocals() { final int numParams = getMethod().getParameterCount(); final List<Local> retVal = new ArrayList<Local>(numParams); // Parameters are zero-indexed, so the keeping of the index is safe for (Unit u : getUnits()) { if (u instanceof IdentityStmt) { IdentityStmt is = ((IdentityStmt) u); if (is.getRightOp() instanceof ParameterRef) { ParameterRef pr = (ParameterRef) is.getRightOp(); retVal.add(pr.getIndex(), (Local) is.getLeftOp()); } } } if (retVal.size() != numParams) { throw new RuntimeException("couldn't find parameterref! in " + getMethod()); } return retVal; }
if (dataFlowGraph.getPredsOf(nodeEqVal).size() > 0 || dataFlowGraph.getSuccsOf(nodeEqVal).size() > 0) { ParameterRef pr = (ParameterRef) node; if (pr.getIndex() != -1) { if (!isObjectLocalToContext(ie.getArg(pr.getIndex()), containingMethod, context)) { return true; if (dataFlowGraph.getPredsOf(nodeEqVal).size() > 0 || dataFlowGraph.getSuccsOf(nodeEqVal).size() > 0) { ParameterRef pr = (ParameterRef) node; if (pr.getIndex() != -1) { if (!isObjectLocalToContext(ie.getArg(pr.getIndex()), containingMethod, context)) { return true; if (dataFlowGraph.getPredsOf(nodeEqVal).size() > 0 || dataFlowGraph.getSuccsOf(nodeEqVal).size() > 0) { ParameterRef pr = (ParameterRef) node; if (pr.getIndex() != -1) { if (!isObjectLocalToContext(ie.getArg(pr.getIndex()), containingMethod, context)) { return true;
public void identityRef(IdentityRef r) { handleIndent(); if (r instanceof ThisRef) { literal("@this: "); type(r.getType()); } else if (r instanceof ParameterRef) { ParameterRef pr = (ParameterRef) r; literal("@parameter" + pr.getIndex() + ": "); type(r.getType()); } else if (r instanceof CaughtExceptionRef) { literal("@caughtexception"); } else { throw new RuntimeException(); } }
if (pr.getIndex() != 0) { continue;
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; }
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); }
slot = paramSlots[((ParameterRef) identity).getIndex()]; } else {