Ejemplo n.º 1
0
        private AllocatorStats Recurse(Namespace ns)
        {
            var result = (AllocatorStats)memoizedInfo[ns];

            if (result != null)
            {
                return(result);
            }
            var innerStats    = ns.Inner == null ? new AllocatorStats(initialRegisterMask, 0) : Recurse(ns.Inner);
            var variableNames = (ArrayList)nsToLiveVariables[ns];

            if (variableNames == null)
            {
                result = innerStats;
            }
            else
            {
                var rast = new RegisterAndStackAllocator(innerStats, variableNames.Count, (int)nsToNumRegisters[ns]);
                foreach (TerminalName variableName in variableNames)
                {
                    var newRepresentation = rast.AllocateRepresentation(variableName);
                    variableNameToRepresentation.Add(variableName, newRepresentation);
                }
                result = rast.MakeNewStats();
            }
            memoizedInfo.Add(ns, result);
            return(result);
        }
        private AllocatorStats Recurse(Namespace ns)
        {
            var result=(AllocatorStats)memoizedInfo[ns];
              if(result!=null) {
            return result;
              }
              var innerStats=ns.Inner==null ? new AllocatorStats(initialRegisterMask, 0) : Recurse(ns.Inner);
              var variableNames=(ArrayList)nsToLiveVariables[ns];

              if(variableNames==null) {
            result=innerStats;
              } else {
            var rast=new RegisterAndStackAllocator(innerStats, variableNames.Count, (int)nsToNumRegisters[ns]);
            foreach(TerminalName variableName in variableNames) {
              var newRepresentation=rast.AllocateRepresentation(variableName);
              variableNameToRepresentation.Add(variableName, newRepresentation);
            }
            result=rast.MakeNewStats();
              }
              memoizedInfo.Add(ns, result);
              return result;
        }