Package soot

Examples of soot.Value


   * Index (the element)
   */
  @Override
  public Value visitArrayIndex(ArrayIndex nd) {
    /* DONE: generate code for array index */
    Value index = this.wrap(nd.getIndex().accept(this));
    Value base = this.wrap(nd.getBase().accept(this)); // need wrap due to int [][] a;
    return Jimple.v().newArrayRef(base, index);
  }
View Full Code Here


    /* DONE: generate code for binary expression here; you can either use a visitor
     *       to determine the type of binary expression you are dealing with, or
     *       generate code in the more specialized visitor methods visitAddExpr,
     *       visitSubExpr, etc., instead
     */
    final Value lhsValue = this.wrap(nd.getLeft().accept(this));
    final Value rhsValue = this.wrap(nd.getRight().accept(this));
    Value binValue = this.wrap(nd.accept(new Visitor<Value>() {
      @Override
      public Value visitAddExpr(AddExpr nd) {
        return Jimple.v().newAddExpr(lhsValue, rhsValue);
      }
      @Override
View Full Code Here

  }
 
  /** Generate code for a comparison expression. */
  @Override
  public Value visitCompExpr(CompExpr nd) {
    final Value left = wrap(nd.getLeft().accept(this)),
          right = wrap(nd.getRight().accept(this));
    Value res = nd.accept(new Visitor<Value>() {
      @Override
      public Value visitEqExpr(EqExpr nd) {
        return Jimple.v().newEqExpr(left, right);
      }
      @Override
View Full Code Here

 
  /** Generate code for a negation expression. */
  @Override
  public Value visitNegExpr(NegExpr nd) {
    /* DONE: generate code for negation expression */
    Value value = this.wrap(nd.getOperand().accept(this));
    return Jimple.v().newNegExpr(value);
  }
View Full Code Here

                        if (stmt.containsInvokeExpr()) {
                            InvokeExpr expr = stmt.getInvokeExpr();
                            if (expr instanceof SpecialInvokeExpr &&
                                    expr.getMethod().getSignature().equals("<java.net.URL: void <init>(java.lang.String)>") &&
                                    expr.getArg(0) instanceof StringConstant) {
                                Value value = ((SpecialInvokeExpr)expr).getBase();
                                String url = ((StringConstant)expr.getArg(0)).value;
                                url_map.put(value, url);
                            }
                            if (expr.getMethod().getSignature().equals("<dk.brics.string.runtime.Strings: void bind(java.lang.String,java.lang.String)>")) {
                                String name = getName(expr);
View Full Code Here

            }
          }
        }
        else if (stmt instanceof IdentityStmt) {
          IdentityStmt iStmt = (IdentityStmt)stmt;
          Value rvalue = iStmt.getRightOp();
          if (rvalue instanceof ParameterRef) {
            ParameterRef parameter = (ParameterRef)rvalue;
            int index = parameter.getIndex();
            stmt.addTag(new StringTag("Type mismatch: cannot convert parameter number " + (index + 1) + " from " + from + " to " + analyzer.getDescription(a)));
          }
View Full Code Here

 
  public void createHotspotsFromInvokeExpr(Stmt stmt) {
    InvokeExpr expr = stmt.getInvokeExpr();
    SootMethod target = expr.getMethod();
    for (int i=0; i<expr.getArgCount(); i++) {
      Value value = expr.getArg(i);
      ValueBox box = expr.getArgBox(i);
      if (isStringType(value.getType())) {
        Map<Integer,Automaton> pMap = parameterAutomatonMap.get(target);
        if (pMap != null && pMap.containsKey(i)) {
          Automaton automaton = pMap.get(i);
          createHotspot(stmt, box, automaton);
        }
View Full Code Here

    }
  }
 
  @Override
  public void caseAssignStmt(AssignStmt stmt) {
    Value lvalue = stmt.getLeftOp();
    ValueBox rbox = stmt.getRightOpBox();
    if (lvalue instanceof JInstanceFieldRef) {
      JInstanceFieldRef ref = (JInstanceFieldRef)lvalue;
      SootField field = ref.getField();
      if (fieldAutomatonMap.containsKey(field)) {
View Full Code Here

    }
  }
 
  @Override
  public void caseIdentityStmt(IdentityStmt stmt) {
    Value rvalue = stmt.getRightOp();
    ValueBox rbox = stmt.getRightOpBox();
    if (rvalue instanceof ParameterRef) {
      ParameterRef parameter = (ParameterRef)rvalue;
      int index = parameter.getIndex();
      Map<Integer,Automaton> pMap = parameterAutomatonMap.get(currentMethod);
View Full Code Here

        this.hierarchy = hierarchy;
    }
   
    @SuppressWarnings("unchecked")
    public List<SootMethod> getTargetsOf(InstanceInvokeExpr expr) {
        Value v = expr.getBase();
       
        SootMethod m = expr.getMethod();
        SootClass rc;
        Type t = v.getType();
        List<SootMethod> targets;
        if (t instanceof NullType) {
          return Collections.emptyList();
        } else if (t instanceof ArrayType) {
            rc = Scene.v().getSootClass("java.lang.Object");
            targets = Collections.singletonList(hierarchy.resolveConcreteDispatch(rc, m));
        } else {
            rc = ((RefType) v.getType()).getSootClass();
            targets = hierarchy.resolveAbstractDispatch(rc, m);
        }
       
        return targets;
    }
View Full Code Here

TOP

Related Classes of soot.Value

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.