Пример #1
0
        // node id, var, version
        //private HashMap<String, HashMap<Integer, FastSet<Integer>>> inVarVersions = new HashMap<String, HashMap<Integer, FastSet<Integer>>>();
        // node id, var, version (direct branch)
        //private HashMap<String, HashMap<Integer, FastSet<Integer>>> outVarVersions = new HashMap<String, HashMap<Integer, FastSet<Integer>>>();
        // node id, var, version (negative branch)
        //private HashMap<String, HashMap<Integer, FastSet<Integer>>> outNegVarVersions = new HashMap<String, HashMap<Integer, FastSet<Integer>>>();
        // node id, var, version
        //private HashMap<String, HashMap<Integer, FastSet<Integer>>> extraVarVersions = new HashMap<String, HashMap<Integer, FastSet<Integer>>>();
        // var, version
        // version, protected ranges (catch, finally)
        // version, version
        // ++ and --
        // node.id, version, version
        // finally exits
        // versions memory dependencies
        // field access vars (exprent id, var id)
        // field access counter
        // set factory
        public virtual void SplitVariables(RootStatement root, StructMethod mt)
        {
            FlattenStatementsHelper flatthelper = new FlattenStatementsHelper();
            DirectGraph             dgraph      = flatthelper.BuildDirectGraph(root);
            HashSet <int>           setInit     = new HashSet <int>();

            for (int i = 0; i < 64; i++)
            {
                setInit.Add(i);
            }
            factory = new FastSparseSetFactory <int>(setInit);
            Sharpen.Collections.Put(extraVarVersions, dgraph.first.id, CreateFirstMap(mt, root
                                                                                      ));
            SetCatchMaps(root, dgraph, flatthelper);
            //		try {
            //			DotExporter.toDotFile(dgraph, new File("c:\\Temp\\gr12_my.dot"));
            //		} catch(Exception ex) {ex.printStackTrace();}
            HashSet <string> updated = new HashSet <string>();

            do
            {
                //			System.out.println("~~~~~~~~~~~~~ \r\n"+root.toJava());
                SsaStatements(dgraph, updated, false);
            }while (!(updated.Count == 0));
            //			System.out.println("~~~~~~~~~~~~~ \r\n"+root.toJava());
            SsaStatements(dgraph, updated, true);
            ssuversions.InitDominators();
        }
Пример #2
0
 internal _T2081736913(FlattenStatementsHelper _enclosing, Statement statement, LinkedList
                       <FlattenStatementsHelper.StackEntry> stackFinally, List <Exprent> tailExprents)
 {
     this._enclosing   = _enclosing;
     this.statement    = statement;
     this.stackFinally = stackFinally;
     this.tailExprents = tailExprents;
 }
Пример #3
0
        private void SetCatchMaps(Statement stat, DirectGraph dgraph, FlattenStatementsHelper
                                  flatthelper)
        {
            SFormsFastMapDirect map;

            switch (stat.type)
            {
            case Statement.Type_Catchall:
            case Statement.Type_Trycatch:
            {
                List <VarExprent> lstVars;
                if (stat.type == Statement.Type_Catchall)
                {
                    lstVars = ((CatchAllStatement)stat).GetVars();
                }
                else
                {
                    lstVars = ((CatchStatement)stat).GetVars();
                }
                for (int i = 1; i < stat.GetStats().Count; i++)
                {
                    int varindex = lstVars[i - 1].GetIndex();
                    int version  = GetNextFreeVersion(varindex, stat);
                    // == 1
                    map = new SFormsFastMapDirect();
                    SetCurrentVar(map, varindex, version);
                    Sharpen.Collections.Put(extraVarVersions, dgraph.nodes.GetWithKey(flatthelper.GetMapDestinationNodes
                                                                                          ().GetOrNull(stat.GetStats()[i].id)[0]).id, map);
                    //ssuversions.createOrGetNode(new VarVersionPair(varindex, version));
                    ssuversions.CreateNode(new VarVersionPair(varindex, version));
                }
                break;
            }
            }
            foreach (Statement st in stat.GetStats())
            {
                SetCatchMaps(st, dgraph, flatthelper);
            }
        }