示例#1
0
        public void CollectAliases(MemoryIndex index, Snapshot snapshot, bool isMust)
        {
            if (References == null)
            {
                References = new ReferenceCollector();
            }

            IMemoryAlias aliases;

            if (snapshot.Structure.Readonly.TryGetAliases(index, out aliases))
            {
                References.CollectMay(aliases.MayAliases);

                if (isMust)
                {
                    References.CollectMust(aliases.MustAliases);
                }
                else
                {
                    References.CollectMay(aliases.MustAliases);
                }
            }

            if (isMust)
            {
                References.AddMustAlias(index);
            }
            else
            {
                References.AddMayAlias(index);
            }
        }
示例#2
0
        public void CollectAliasesFromSources(MemoryEntryCollector collector)
        {
            bool invalidateMust = !IsMust;

            foreach (SourceIndex source in SourceIndexes)
            {
                IMemoryAlias aliases;
                if (source.Snapshot.Structure.Readonly.TryGetAliases(source.Index, out aliases))
                {
                    if (References == null)
                    {
                        References = new ReferenceCollector();
                    }

                    References.CollectMust(aliases.MustAliases);
                    References.CollectMay(aliases.MayAliases);

                    if (IsMust && SourceIndexes.Count == 1)
                    {
                        References.AddMustAlias(source.Index);
                    }
                    else
                    {
                        References.AddMayAlias(source.Index);
                    }
                }
                else
                {
                    invalidateMust = true;
                }
            }

            if (invalidateMust && References != null)
            {
                References.InvalidateMust();
            }
        }