# as NO ERROR and CS5001 is automatically ignored.
cs0118-8.cs NO ERROR
-cs0154-3.cs
cs0162-7.cs NO ERROR
cs0229-2.cs
-cs0229.cs NO ERROR
+cs0229.cs
cs0467-2.cs
cs0467-3.cs
cs0467.cs NO ERROR
# as NO ERROR and CS5001 is automatically ignored.
cs0118-8.cs NO ERROR
-cs0154-3.cs
cs0162-7.cs NO ERROR
cs0229-2.cs
-cs0229.cs NO ERROR
+cs0229.cs
cs0467-2.cs
cs0467-3.cs
cs0467.cs NO ERROR
+2006-08-08 Raja R Harinath <rharinath@novell.com>
+
+ Fix #79026
+ * codegen.cs (EmitContext.GetTemporaryLocal): Simplify. Use Stack
+ instead of ArrayList. If the hashtable has a LocalBuilder, don't
+ leave it in after returning it.
+ (EmitContext.FreeTemporaryLocal): Simplify. Update to changes.
+
2006-08-06 Marek Safar <marek.safar@seznam.cz>
* expresssion.cs (IndexerAccess.DoResolve): Fixed to report correct error
{
ILGenerator ig = ec.ig;
+ if (builder == null)
+ throw new InternalErrorException ("Emit without Store, or after Release");
+
ig.Emit (OpCodes.Ldloc, builder);
// we need to copy from the pointer
if (is_address)
/// </summary>
public LocalBuilder GetTemporaryLocal (Type t)
{
- LocalBuilder location = null;
-
- if (temporary_storage != null){
+ if (temporary_storage != null) {
object o = temporary_storage [t];
- if (o != null){
- if (o is ArrayList){
- ArrayList al = (ArrayList) o;
-
- for (int i = 0; i < al.Count; i++){
- if (al [i] != null){
- location = (LocalBuilder) al [i];
- al [i] = null;
- break;
- }
- }
- } else
- location = (LocalBuilder) o;
- if (location != null)
- return location;
+ if (o != null) {
+ if (o is Stack) {
+ Stack s = (Stack) o;
+ o = s.Count == 0 ? null : s.Pop ();
+ } else {
+ temporary_storage.Remove (t);
+ }
}
+ if (o != null)
+ return (LocalBuilder) o;
}
-
return ig.DeclareLocal (t);
}
public void FreeTemporaryLocal (LocalBuilder b, Type t)
{
- if (temporary_storage == null){
+ Stack s;
+
+ if (temporary_storage == null) {
temporary_storage = new Hashtable ();
temporary_storage [t] = b;
return;
}
object o = temporary_storage [t];
- if (o == null){
+ if (o == null) {
temporary_storage [t] = b;
return;
}
- if (o is ArrayList){
- ArrayList al = (ArrayList) o;
- for (int i = 0; i < al.Count; i++){
- if (al [i] == null){
- al [i] = b;
- return;
- }
- }
- al.Add (b);
- return;
+ if (o is Stack) {
+ s = (Stack) o;
+ } else {
+ s = new Stack ();
+ s.Push (o);
+ temporary_storage [t] = s;
}
- ArrayList replacement = new ArrayList ();
- replacement.Add (o);
- temporary_storage.Remove (t);
- temporary_storage [t] = replacement;
+ s.Push (b);
}
/// <summary>
+2006-08-08 Raja R Harinath <rharinath@novell.com>
+
+ Fix #79026
+ * codegen.cs (EmitContext.GetTemporaryLocal): Simplify. Use Stack
+ instead of ArrayList. If the hashtable has a LocalBuilder, don't
+ leave it in after returning it.
+ (EmitContext.FreeTemporaryLocal): Simplify. Update to changes.
+
2006-08-06 Marek Safar <marek.safar@seznam.cz>
* expresssion.cs (IndexerAccess.DoResolve): Fixed to report correct error
{
ILGenerator ig = ec.ig;
+ if (builder == null)
+ throw new InternalErrorException ("Emit without Store, or after Release");
+
ig.Emit (OpCodes.Ldloc, builder);
// we need to copy from the pointer
if (is_address)
/// </summary>
public LocalBuilder GetTemporaryLocal (Type t)
{
- LocalBuilder location = null;
-
- if (temporary_storage != null){
+ if (temporary_storage != null) {
object o = temporary_storage [t];
- if (o != null){
- if (o is ArrayList){
- ArrayList al = (ArrayList) o;
-
- for (int i = 0; i < al.Count; i++){
- if (al [i] != null){
- location = (LocalBuilder) al [i];
- al [i] = null;
- break;
- }
- }
- } else
- location = (LocalBuilder) o;
- if (location != null)
- return location;
+ if (o != null) {
+ if (o is Stack) {
+ Stack s = (Stack) o;
+ o = s.Count == 0 ? null : s.Pop ();
+ } else {
+ temporary_storage.Remove (t);
+ }
}
+ if (o != null)
+ return (LocalBuilder) o;
}
-
return ig.DeclareLocal (t);
}
public void FreeTemporaryLocal (LocalBuilder b, Type t)
{
- if (temporary_storage == null){
+ Stack s;
+
+ if (temporary_storage == null) {
temporary_storage = new Hashtable ();
temporary_storage [t] = b;
return;
}
object o = temporary_storage [t];
- if (o == null){
+ if (o == null) {
temporary_storage [t] = b;
return;
}
- if (o is ArrayList){
- ArrayList al = (ArrayList) o;
- for (int i = 0; i < al.Count; i++){
- if (al [i] == null){
- al [i] = b;
- return;
- }
- }
- al.Add (b);
- return;
+ if (o is Stack) {
+ s = (Stack) o;
+ } else {
+ s = new Stack ();
+ s.Push (o);
+ temporary_storage [t] = s;
}
- ArrayList replacement = new ArrayList ();
- replacement.Add (o);
- temporary_storage.Remove (t);
- temporary_storage [t] = replacement;
+ s.Push (b);
}
/// <summary>
+2006-08-08 Raja R Harinath <rharinath@novell.com>
+
+ * test-527.cs: New test from #79026.
+
2006-08-02 Raja R Harinath <rharinath@novell.com>
* gtest-282.cs: New test from #77963.
--- /dev/null
+using System;
+
+class Repro
+{
+ private int[] stack = new int[1];
+ private int cc;
+ public int fc;
+ private int sp;
+
+ static int Main()
+ {
+ Repro r = new Repro();
+ r.foo();
+ Console.WriteLine(r.stack[0]);
+ return r.stack[0] == 42 ? 0 : 1;
+ }
+
+ public void foo()
+ {
+ fc = cc = bar();
+ fc = stack[sp++] = cc;
+ }
+
+ private int bar()
+ {
+ return 42;
+ }
+}
+