Esempio n. 1
0
        private void DrainEqualityWorkList(WorkList wl)
        {
            while (!wl.IsEmpty())
            {
                EqPair        eqpair = (EqPair)wl.Pull();
                SymbolicValue v1rep  = Find(eqpair.v1);
                SymbolicValue v2rep  = Find(eqpair.v2);
                if (v1rep == v2rep)
                {
                    continue;
                }

                // always map new to older var
                if (v1rep.UniqueId < v2rep.UniqueId)
                {
                    SymbolicValue temp = v1rep;
                    v1rep = v2rep;
                    v2rep = temp;
                }

                // perform congruence closure here:
                foreach (IUniqueKey f in this.Functions(v1rep))
                {
                    SymbolicValue target = this.LookupWithoutManifesting(v2rep, f);
                    if (target == null)
                    {
                        this[v2rep, f] = this[v1rep, f];
                    }
                    else
                    {
                        PushEquality(wl, this[v1rep, f], target);
                    }
                }
                MathematicalLattice.Element av1 = this[v1rep];
                MathematicalLattice.Element av2 = this[v2rep];
                // merge term map of v1 into v2
                foreach (IUniqueKey eterm in this.eqTermMap.Keys2(v1rep))
                {
                    this.eqTermMap = this.eqTermMap.Add(v2rep, eterm, null);
                }
                this.forwMap = this.forwMap.Add(v1rep, v2rep);
                this[v2rep]  = this.elementLattice.Meet(av1, av2);
            }
        }
Esempio n. 2
0
 public override MathematicalLattice.Element NontrivialMeet(MathematicalLattice.Element a, MathematicalLattice.Element b)
 {
     return(AVal.Meet((AVal)a, (AVal)b));
 }