Author: raja
Date: 2007-03-26 04:59:52 -0500 (Mon, 26 Mar 2007)
New Revision: 74970

Modified:
   trunk/mcs/mcs/ChangeLog
   trunk/mcs/mcs/flowanalysis.cs
Log:
* flowanalysis.cs (FlowBranching.Reachability): Prepare to be
replaced by a boolean.  Add boolean 'is_unreachable' field, check
and maintain invariants.


Modified: trunk/mcs/mcs/ChangeLog
===================================================================
--- trunk/mcs/mcs/ChangeLog     2007-03-26 09:57:40 UTC (rev 74969)
+++ trunk/mcs/mcs/ChangeLog     2007-03-26 09:59:52 UTC (rev 74970)
@@ -1,3 +1,9 @@
+2007-03-26  Raja R Harinath  <[EMAIL PROTECTED]>
+
+       * flowanalysis.cs (FlowBranching.Reachability): Prepare to be
+       replaced by a boolean.  Add boolean 'is_unreachable' field, check
+       and maintain invariants.
+
 2007-03-25  Marek Safar  <[EMAIL PROTECTED]>
 
        * anonymous.cs: Restored checks disabled for uninflated anonymous 
methods.

Modified: trunk/mcs/mcs/flowanalysis.cs
===================================================================
--- trunk/mcs/mcs/flowanalysis.cs       2007-03-26 09:57:40 UTC (rev 74969)
+++ trunk/mcs/mcs/flowanalysis.cs       2007-03-26 09:59:52 UTC (rev 74970)
@@ -76,13 +76,21 @@
                                Always
                        }
 
+                       bool is_unreachable;
                        TriState barrier;
 
                        Reachability (TriState barrier)
                        {
                                this.barrier = barrier;
+                               this.is_unreachable = barrier == 
TriState.Always;
                        }
 
+                       void Check ()
+                       {
+                               if (is_unreachable != (barrier == 
TriState.Always))
+                                       throw new InternalErrorException 
(is_unreachable + " vs. " + barrier);
+                       }
+
                        public Reachability Clone ()
                        {
                                return new Reachability (barrier);
@@ -105,11 +113,15 @@
                        public void Meet (Reachability b)
                        {
                                barrier = TriState_Meet (barrier, b.barrier);
+                               is_unreachable &= b.is_unreachable;
+                               Check ();
                        }
 
                        public void Or (Reachability b)
                        {
                                barrier = TriState_Max (barrier, b.barrier);
+                               is_unreachable |= b.is_unreachable;
+                               Check ();
                        }
 
                        public static Reachability Always ()
@@ -118,12 +130,13 @@
                        }
 
                        public bool IsUnreachable {
-                               get { return barrier == TriState.Always; }
+                               get { Check (); return is_unreachable; }
                        }
 
                        public void SetBarrier ()
                        {
                                barrier = TriState.Always;
+                               is_unreachable = true;
                        }
 
                        static string ShortName (TriState t)

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to