Ejemplo n.º 1
0
        public Value[] CollectRecursiveValues()
        {
            HashSet <Value> visitedValues = new HashSet <Value>();
            List <Value>    values        = new List <Value>();

            ValueTable currentTable = TopTable;

            while (currentTable != null)
            {
                foreach (var currentValue in currentTable.Values)
                {
                    if (currentValue.IsConstant || visitedValues.Contains(currentValue))
                    {
                        continue;
                    }

                    if (currentValue.IsLocal || currentValue.UsedRecursively || currentValue.HasCOWReferences())
                    {
                        values.Add(currentValue);
                        visitedValues.Add(currentValue);
                    }
                }

                currentTable = currentTable.ParentTable;
            }

            // values.AddRange(GetMethodLinkage(CurrentEmitMethod, false).ParameterValues);
            values.AddRange(_openCows.Where(e => e.Value != null && e.ReferenceCount > 0 && !e.Value.IsConstant && !visitedValues.Contains(e.Value)).Select(e => e.Value));

            return(values.ToArray());
        }
Ejemplo n.º 2
0
        private void OpenScope()
        {
        #if UDONSHARP_DEBUG
            _scopeDepth += 1;
        #endif

            ValueTable newTable = new ValueTable(Module, TopTable);

            TopTable.AddChildTable(newTable);

            _valueTableStack.Push(newTable);
        }
Ejemplo n.º 3
0
        public Value(ValueTable parentTable, string uniqueID, TypeSymbol userType, ValueFlags flags)
        {
        #if UDONSHARP_DEBUG
            if (parentTable == null)
            {
                throw new NullReferenceException();
            }
        #endif

            _parentTable = parentTable;
            UserType     = userType;
            Flags        = flags;
            UniqueID     = uniqueID;
        }
Ejemplo n.º 4
0
        public void DirtyAllValues()
        {
            ValueTable currentTable = this;

            while (currentTable != null)
            {
                if (currentTable._values != null)
                {
                    Value[] iterationArray = currentTable._values.ToArray(); // Needed since dirtying can modify the _values list

                    foreach (Value val in iterationArray)
                    {
                        if (val.IsConstant || val.IsLocal || val.IsInternal)
                        {
                            continue;
                        }

                        val.MarkDirty();
                    }
                }

                currentTable = currentTable.ParentTable;
            }
        }
Ejemplo n.º 5
0
 public void AddChildTable(ValueTable child)
 {
     LazyInitTable();
     _childTables.Add(child);
 }
Ejemplo n.º 6
0
 public ValueTable(AssemblyModule module, ValueTable parent)
 {
     Module                 = module;
     ParentTable            = parent;
     _nameCollisionCheckSet = ParentTable != null ? new HashSet <string>(ParentTable._nameCollisionCheckSet) : new HashSet <string>();
 }