コード例 #1
0
        public void Unify(RootEnvironment rootEnv, StackEntryState other, BoolRef changed)
        {
            var type = Type.Lub(rootEnv, other.Type, changed);

            var upperBound = default(TypeRef);

            if (UpperBound != null && other.UpperBound != null)
            {
                upperBound = UpperBound.Glb(rootEnv, other.UpperBound, changed);
            }
            else if (other.UpperBound != null)
            {
                upperBound = other.UpperBound;
                changed.Set();
            }
            else
            {
                upperBound = UpperBound;
            }

            if (upperBound != null && !type.IsAssignableTo(rootEnv, upperBound))
            {
                throw new InvalidOperationException("stack entries are not unifiable");
            }

            var pointsTo = PointsTo.Lub(other.PointsTo, changed);

            UpperBound = upperBound;
            Type       = type;
            PointsTo   = pointsTo;
        }
コード例 #2
0
        public MachineState PopPush(int n, StackEntryState entry)
        {
            if (n > Depth)
            {
                throw new InvalidOperationException("stack is too shallow");
            }
            var stack = new Seq <StackEntryState>(Depth - n + 1);

            stack.Add(entry);
            for (var i = n; i < Depth; i++)
            {
                stack.Add(innerState.Value.Stack[i]);
            }
            return(CloneForward(stack));
        }
コード例 #3
0
ファイル: MachineState.cs プロジェクト: modulexcite/IL2JS
        public void Unify(RootEnvironment rootEnv, StackEntryState other, BoolRef changed)
        {
            var type = Type.Lub(rootEnv, other.Type, changed);

            var upperBound = default(TypeRef);
            if (UpperBound != null && other.UpperBound != null)
                upperBound = UpperBound.Glb(rootEnv, other.UpperBound, changed);
            else if (other.UpperBound != null)
            {
                upperBound = other.UpperBound;
                changed.Set();
            }
            else
                upperBound = UpperBound;

            if (upperBound != null && !type.IsAssignableTo(rootEnv, upperBound))
                throw new InvalidOperationException("stack entries are not unifiable");

            var pointsTo = PointsTo.Lub(other.PointsTo, changed);

            UpperBound = upperBound;
            Type = type;
            PointsTo = pointsTo;
        }
コード例 #4
0
 public bool IsEquivalentTo(RootEnvironment rootEnv, StackEntryState other)
 {
     return(Type.IsEquivalentTo(rootEnv, other.Type) && PointsTo.Lte(other.PointsTo) &&
            other.PointsTo.Lte(PointsTo));
 }
コード例 #5
0
 public MachineState Push(StackEntryState entry)
 {
     return(PopPush(0, entry));
 }
コード例 #6
0
ファイル: MachineState.cs プロジェクト: modulexcite/IL2JS
 public MachineState Push(StackEntryState entry)
 {
     return PopPush(0, entry);
 }
コード例 #7
0
ファイル: MachineState.cs プロジェクト: modulexcite/IL2JS
 public MachineState PopPush(int n, StackEntryState entry)
 {
     if (n > Depth)
         throw new InvalidOperationException("stack is too shallow");
     var stack = new Seq<StackEntryState>(Depth - n + 1);
     stack.Add(entry);
     for (var i = n; i < Depth; i++)
         stack.Add(innerState.Value.Stack[i]);
     return CloneForward(stack);
 }
コード例 #8
0
ファイル: MachineState.cs プロジェクト: modulexcite/IL2JS
 public bool IsEquivalentTo(RootEnvironment rootEnv, StackEntryState other)
 {
     return Type.IsEquivalentTo(rootEnv, other.Type) && PointsTo.Lte(other.PointsTo) &&
            other.PointsTo.Lte(PointsTo);
 }