Package soot.jimple

Examples of soot.jimple.Stmt


            for( Iterator mIt = c.methodIterator(); mIt.hasNext(); ) {
                SootMethod m = (SootMethod) mIt.next();
                if( !m.isConcrete() ) continue;
                if( !m.hasActiveBody() ) continue;
                for( Iterator sIt = m.getActiveBody().getUnits().iterator(); sIt.hasNext(); ) {
                    final Stmt s = (Stmt) sIt.next();
                    if( s instanceof DefinitionStmt ) {
                        Value lhs = ((DefinitionStmt) s).getLeftOp();
                        VarNode v = null;
                        if( lhs instanceof Local ) {
                            v = pag.findLocalVarNode( lhs );
View Full Code Here


     */
    private Set<Value> trackableFields() {
      Set<Value> usedFieldRefs = new HashSet<Value>();
        //add all field references that are in use boxes
        for (Unit unit : this.graph) {
      Stmt s = (Stmt) unit;
      List<ValueBox> useBoxes = s.getUseBoxes();
      for (ValueBox useBox : useBoxes) {
        Value val = useBox.getValue();
        if(val instanceof FieldRef) {
          FieldRef fieldRef = (FieldRef) val;
          if(fieldRef.getType() instanceof RefLikeType)
View Full Code Here

        }
    }
   

    protected void flowThrough(HashMap<Value,Object> in, Unit u, HashMap<Value,Object> out) {
      Stmt s = (Stmt)u;
        out.clear();

        out.putAll(in);

        if (s instanceof DefinitionStmt) {
            DefinitionStmt ds = (DefinitionStmt) s;
            Value lhs = ds.getLeftOp();
            Value rhs = ds.getRightOp();

            if (rhs instanceof CastExpr) {
              //un-box casted value
        CastExpr castExpr = (CastExpr) rhs;
              rhs = castExpr.getOp();
            }
           
            if ((lhs instanceof Local
                || (lhs instanceof FieldRef && this.localsAndFieldRefs.contains(new EquivalentValue(lhs))))
              && lhs.getType() instanceof RefLikeType) {
                if (rhs instanceof Local) {
                  //local-assignment - must be aliased...
                    out.put(lhs, in.get(rhs));
                } else if(rhs instanceof ThisRef) {
                  //ThisRef can never change; assign unique number
                  out.put(lhs, thisRefNumber());
                } else if(rhs instanceof ParameterRef) {
                  //ParameterRef can never change; assign unique number
                  out.put(lhs, parameterRefNumber((ParameterRef) rhs));
                } else {
                  //assign number for expression
                    out.put(lhs, numberOfRhs(rhs));
                }
            }
        } else {
          //which other kind of statement has def-boxes? hopefully none...
          assert s.getDefBoxes().isEmpty();
        }
    }
View Full Code Here

        getImplicitTargets( m );
        findReceivers(m, b);
    }
    private void findReceivers(SootMethod m, Body b) {
        for( Iterator sIt = b.getUnits().iterator(); sIt.hasNext(); ) {
            final Stmt s = (Stmt) sIt.next();
            if (s.containsInvokeExpr()) {
                InvokeExpr ie = s.getInvokeExpr();

                if (ie instanceof InstanceInvokeExpr) {
                    InstanceInvokeExpr iie = (InstanceInvokeExpr) ie;
                    Local receiver = (Local) iie.getBase();
                    NumberedString subSig =
View Full Code Here

        if( source.getSubSignature().indexOf( "<init>" ) >= 0 ) {
            handleInit(source, scl);
        }
        Body b = source.retrieveActiveBody();
        for( Iterator sIt = b.getUnits().iterator(); sIt.hasNext(); ) {
            final Stmt s = (Stmt) sIt.next();
            if( s.containsInvokeExpr() ) {
                InvokeExpr ie = s.getInvokeExpr();
                if( ie.getMethodRef().getSignature().equals( "<java.lang.reflect.Method: java.lang.Object invoke(java.lang.Object,java.lang.Object[])>" ) ) {
                  reflectionModel.methodInvoke(source,s);
                }
                if( ie.getMethodRef().getSignature().equals( "<java.lang.Class: java.lang.Object newInstance()>" ) ) {
                  reflectionModel.classNewInstance(source,s);
                }
                if( ie.getMethodRef().getSignature().equals( "<java.lang.reflect.Constructor: java.lang.Object newInstance(java.lang.Object[])>" ) ) {
                  reflectionModel.contructorNewInstance(source, s);
                }
                if( ie.getMethodRef().getSubSignature() == sigForName ) {
                  reflectionModel.classForName(source,s);
                }
                if( ie instanceof StaticInvokeExpr ) {
                  SootClass cl = ie.getMethodRef().declaringClass();
                  for (SootMethod clinit : EntryPoints.v().clinitsOf(cl)) {
                    addEdge( source, s, clinit, Kind.CLINIT );
                  }
                }
            }
            if( s.containsFieldRef() ) {
                FieldRef fr = s.getFieldRef();
                if( fr instanceof StaticFieldRef ) {
                    SootClass cl = fr.getFieldRef().declaringClass();
                    for (SootMethod clinit : EntryPoints.v().clinitsOf(cl)) {
                        addEdge( source, s, clinit, Kind.CLINIT );
                    }
View Full Code Here

   
    private void insertGuard(Guard guard) {
      if(options.guards().equals("ignore")) return;
     
      SootMethod container = guard.container;
      Stmt insertionPoint = guard.stmt;
      if(!container.hasActiveBody()) {
        G.v().out.println("WARNING: Tried to insert guard into "+container+" but couldn't because method has no body.");
      } else {
        Body body = container.getActiveBody();
       
View Full Code Here

                }

                // First inline all the methods that execute on Tokens.
                for (Iterator units = body.getUnits().snapshotIterator(); units
                        .hasNext();) {
                    Stmt stmt = (Stmt) units.next();

                    if (debug) {
                        System.out.println("ttn0 unit = " + stmt);
                    }

                    if (stmt.containsInvokeExpr()) {
                        ValueBox box = stmt.getInvokeExprBox();
                        Value value = box.getValue();

                        if (debug) {
                            System.out.println("value = " + value);
                        }
View Full Code Here

        Set set = new HashSet();
        List useList = localUses.getUsesOf(stmt);

        for (Iterator uses = useList.iterator(); uses.hasNext();) {
            UnitValueBoxPair pair = (UnitValueBoxPair) uses.next();
            Stmt defStmt = (Stmt) pair.getUnit();

            if (defStmt instanceof DefinitionStmt) {
                Value value = ((DefinitionStmt) defStmt).getLeftOp();

                if (PtolemyUtilities.isTokenType(value.getType())) {
View Full Code Here

                        .hasNext() && finalize);) {
                    SootMethod method = (SootMethod) methods.next();

                    if (method.getName().equals("<init>")) {
                        Chain units = method.retrieveActiveBody().getUnits();
                        Stmt stmt = (Stmt) units.getLast();

                        while (!stmt.equals(units.getFirst())) {
                            if (stmt instanceof DefinitionStmt
                                    && ((DefinitionStmt) stmt).getLeftOp() instanceof InstanceFieldRef) {
                                InstanceFieldRef ref = (InstanceFieldRef) ((DefinitionStmt) stmt)
                                        .getLeftOp();
View Full Code Here

                // for them.
                _tokenAnalysis = new TokenConstructorAnalysis(body, _localDefs);

                for (Iterator units = body.getUnits().snapshotIterator(); units
                        .hasNext();) {
                    Stmt stmt = (Stmt) units.next();

                    if (!stmt.containsInvokeExpr()) {
                        continue;
                    }

                    ValueBox box = stmt.getInvokeExprBox();
                    Value value = box.getValue();

                    if (value instanceof InstanceInvokeExpr) {
                        InstanceInvokeExpr r = (InstanceInvokeExpr) value;
View Full Code Here

TOP

Related Classes of soot.jimple.Stmt

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.