Author: raja
Date: 2007-05-23 09:46:29 -0400 (Wed, 23 May 2007)
New Revision: 77833
Modified:
trunk/mcs/mcs/ChangeLog
trunk/mcs/mcs/flowanalysis.cs
Log:
* flowanalysis.cs (VariableInfo.SetAssigned): When noting a
variable as assigned, note also that all its components are assigned too.
(MyBitVector.SetRange): New. Function to set multiple bits to true.
Modified: trunk/mcs/mcs/ChangeLog
===================================================================
--- trunk/mcs/mcs/ChangeLog 2007-05-23 13:24:12 UTC (rev 77832)
+++ trunk/mcs/mcs/ChangeLog 2007-05-23 13:46:29 UTC (rev 77833)
@@ -1,3 +1,10 @@
+2007-05-23 Raja R Harinath <[EMAIL PROTECTED]>
+
+ * flowanalysis.cs (VariableInfo.SetAssigned): When noting a
+ variable as assigned, note also that all its components are
+ assigned too.
+ (MyBitVector.SetRange): New. Function to set multiple bits to true.
+
2007-05-19 Marek Safar <[EMAIL PROTECTED]>
* anonymous.cs, class.cs: Emit Compiler generated attribute when
Modified: trunk/mcs/mcs/flowanalysis.cs
===================================================================
--- trunk/mcs/mcs/flowanalysis.cs 2007-05-23 13:24:12 UTC (rev 77832)
+++ trunk/mcs/mcs/flowanalysis.cs 2007-05-23 13:46:29 UTC (rev 77833)
@@ -1343,9 +1343,14 @@
if (vector [Offset])
return true;
- for (VariableInfo parent = Parent; parent != null;
parent = parent.Parent)
- if (vector [parent.Offset])
+ // FIXME: Fix SetFieldAssigned to set the whole range
like SetAssigned below. Then, get rid of this stanza
+ for (VariableInfo parent = Parent; parent != null;
parent = parent.Parent) {
+ if (vector [parent.Offset]) {
+ // 'parent' is assigned, but someone
forgot to note that all its components are assigned too
+ parent.SetAssigned (vector);
return true;
+ }
+ }
// Return unless this is a struct.
if (!TypeInfo.IsStruct)
@@ -1379,7 +1384,10 @@
public void SetAssigned (MyBitVector vector)
{
- vector [Offset] = true;
+ if (Length == 1)
+ vector [Offset] = true;
+ else
+ vector.SetRange (Offset, Length);
}
public bool IsFieldAssigned (EmitContext ec, string name,
Location loc)
@@ -1631,6 +1639,30 @@
return Count == 0 ? Empty : new MyBitVector (this,
Count);
}
+ public void SetRange (int offset, int length)
+ {
+ if (offset > Count || offset + length > Count)
+ throw new ArgumentOutOfRangeException ();
+
+ if (shared == null && vector == null)
+ return;
+
+ int i = 0;
+ if (shared != null) {
+ if (offset + length <= shared.Count) {
+ for (; i < length; ++i)
+ if (!shared [i+offset])
+ break;
+ if (i == length)
+ return;
+ }
+ initialize_vector ();
+ }
+ for (; i < length; ++i)
+ vector [i+offset] = true;
+
+ }
+
public void SetAll (bool value)
{
// Don't clobber Empty
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches