Author: raja
Date: 2006-08-08 10:50:59 -0400 (Tue, 08 Aug 2006)
New Revision: 63485
Modified:
trunk/mcs/gmcs/ChangeLog
trunk/mcs/gmcs/ecore.cs
trunk/mcs/gmcs/expression.cs
trunk/mcs/mcs/ChangeLog
trunk/mcs/mcs/ecore.cs
trunk/mcs/mcs/expression.cs
Log:
In mcs and gmcs:
* ecore.cs (FieldExpr.EmitAssign): Release temporary.
(PropertyExpr.EmitAssign): Likewise.
* expression.cs (Indirection.EmitAssign): Likewise.
(LocalVariableReference.EmitAssign): Likewise.
(ParameterReference.EmitAssign): Likewise.
(Invocation.EmitArguments): Likewise.
(ArrayAccess.EmitAssign): Likewise.
(IndexerAccess.EmitAssign): Likewise.
(This.EmitAssign): Likewise.
(ConditionalLogicalOperator.Emit): Likewise.
Modified: trunk/mcs/gmcs/ChangeLog
===================================================================
--- trunk/mcs/gmcs/ChangeLog 2006-08-08 14:37:37 UTC (rev 63484)
+++ trunk/mcs/gmcs/ChangeLog 2006-08-08 14:50:59 UTC (rev 63485)
@@ -1,5 +1,16 @@
2006-08-08 Raja R Harinath <[EMAIL PROTECTED]>
+ * ecore.cs (FieldExpr.EmitAssign): Release temporary.
+ (PropertyExpr.EmitAssign): Likewise.
+ * expression.cs (Indirection.EmitAssign): Likewise.
+ (LocalVariableReference.EmitAssign): Likewise.
+ (ParameterReference.EmitAssign): Likewise.
+ (Invocation.EmitArguments): Likewise.
+ (ArrayAccess.EmitAssign): Likewise.
+ (IndexerAccess.EmitAssign): Likewise.
+ (This.EmitAssign): Likewise.
+ (ConditionalLogicalOperator.Emit): Likewise.
+
Fix #79026
* codegen.cs (EmitContext.GetTemporaryLocal): Simplify. Use Stack
instead of ArrayList. If the hashtable has a LocalBuilder, don't
Modified: trunk/mcs/gmcs/ecore.cs
===================================================================
--- trunk/mcs/gmcs/ecore.cs 2006-08-08 14:37:37 UTC (rev 63484)
+++ trunk/mcs/gmcs/ecore.cs 2006-08-08 14:50:59 UTC (rev 63485)
@@ -3372,8 +3372,10 @@
else
ig.Emit (OpCodes.Stfld, FieldInfo);
- if (temp != null)
+ if (temp != null) {
temp.Emit (ec);
+ temp.Release (ec);
+ }
}
public override void Emit (EmitContext ec)
@@ -3829,8 +3831,10 @@
Invocation.EmitCall (ec, IsBase, IsStatic,
InstanceExpression, setter, args, loc, false, prepared);
- if (temp != null)
+ if (temp != null) {
temp.Emit (ec);
+ temp.Release (ec);
+ }
}
}
Modified: trunk/mcs/gmcs/expression.cs
===================================================================
--- trunk/mcs/gmcs/expression.cs 2006-08-08 14:37:37 UTC (rev 63484)
+++ trunk/mcs/gmcs/expression.cs 2006-08-08 14:50:59 UTC (rev 63485)
@@ -726,8 +726,10 @@
StoreFromPtr (ec.ig, type);
- if (temporary != null)
+ if (temporary != null) {
temporary.Emit (ec);
+ temporary.Release (ec);
+ }
}
public void AddressOf (EmitContext ec, AddressOp Mode)
@@ -756,9 +758,7 @@
#region IVariable Members
public VariableInfo VariableInfo {
- get {
- return null;
- }
+ get { return null; }
}
public bool VerifyFixed ()
@@ -797,18 +797,18 @@
PostIncrement = IsPost,
PostDecrement = IsPost | IsDecrement
}
-
+
Mode mode;
bool is_expr = false;
bool recurse = false;
-
+
Expression expr;
//
// This is expensive for the simplest case.
//
StaticCallExpr method;
-
+
public UnaryMutator (Mode m, Expression e, Location l)
{
mode = m;
@@ -821,7 +821,7 @@
return (mode == Mode.PreIncrement || mode ==
Mode.PostIncrement) ?
"++" : "--";
}
-
+
/// <summary>
/// Returns whether an object of type `t' can be incremented
/// or decremented with add/sub (ie, basically whether we can
@@ -997,7 +997,7 @@
}
}
-
+
void EmitCode (EmitContext ec, bool is_expr)
{
recurse = true;
@@ -1013,7 +1013,7 @@
// having to allocate another expression
//
if (recurse) {
- ((IAssignMethod) expr).Emit (ec, is_expr &&
(mode == Mode.PostIncrement || mode == Mode.PostDecrement));
+ ((IAssignMethod) expr).Emit (ec, is_expr &&
(mode == Mode.PostIncrement || mode == Mode.PostDecrement));
if (method == null)
LoadOneAndEmitOp (ec, expr.Type);
else
@@ -1021,10 +1021,10 @@
recurse = false;
return;
}
-
+
EmitCode (ec, true);
}
-
+
public override void EmitStatement (EmitContext ec)
{
EmitCode (ec, false);
@@ -3070,6 +3070,9 @@
ig.MarkLabel (false_target);
op.Emit (ec);
ig.MarkLabel (end_target);
+
+ // We release 'left_temp' here since 'op' may refer to
it too
+ left_temp.Release (ec);
}
}
@@ -3502,8 +3505,10 @@
temp.Store (ec);
}
ig.Emit (OpCodes.Stfld,
local_info.FieldBuilder);
- if (temp != null)
+ if (temp != null) {
temp.Emit (ec);
+ temp.Release (ec);
+ }
}
}
@@ -3805,8 +3810,10 @@
StoreFromPtr (ig, type);
- if (temp != null)
+ if (temp != null) {
temp.Emit (ec);
+ temp.Release (ec);
+ }
} else {
if (arg_idx <= 255)
ig.Emit (OpCodes.Starg_S, (byte)
arg_idx);
@@ -5160,8 +5167,10 @@
if (this_arg != null)
this_arg.Emit (ec);
- for (int i = 0; i < top; i ++)
+ for (int i = 0; i < top; i ++) {
temps [i].Emit (ec);
+ temps [i].Release (ec);
+ }
}
if (pd != null && pd.Count > top &&
@@ -6610,6 +6619,7 @@
/// <summary>
/// Represents the `this' construct
/// </summary>
+
public class This : Expression, IAssignMethod, IMemoryLocation,
IVariable {
Block block;
@@ -6717,8 +6727,10 @@
ig.Emit (OpCodes.Stobj, type);
- if (leave_copy)
+ if (leave_copy) {
t.Emit (ec);
+ t.Release (ec);
+ }
} else {
throw new Exception ("how did you get here");
}
@@ -7839,8 +7851,10 @@
}
StoreFromPtr (ec.ig, t);
- if (temp != null)
+ if (temp != null) {
temp.Emit (ec);
+ temp.Release (ec);
+ }
return;
}
@@ -7901,8 +7915,10 @@
ig.Emit (OpCodes.Call, set);
}
- if (temp != null)
+ if (temp != null) {
temp.Emit (ec);
+ temp.Release (ec);
+ }
}
public void AddressOf (EmitContext ec, AddressOp mode)
@@ -8255,8 +8271,10 @@
Invocation.EmitCall (ec, is_base_indexer, false,
instance_expr, set, set_arguments, loc, false, prepared);
- if (temp != null)
+ if (temp != null) {
temp.Emit (ec);
+ temp.Release (ec);
+ }
}
Modified: trunk/mcs/mcs/ChangeLog
===================================================================
--- trunk/mcs/mcs/ChangeLog 2006-08-08 14:37:37 UTC (rev 63484)
+++ trunk/mcs/mcs/ChangeLog 2006-08-08 14:50:59 UTC (rev 63485)
@@ -1,5 +1,16 @@
2006-08-08 Raja R Harinath <[EMAIL PROTECTED]>
+ * ecore.cs (FieldExpr.EmitAssign): Release temporary.
+ (PropertyExpr.EmitAssign): Likewise.
+ * expression.cs (Indirection.EmitAssign): Likewise.
+ (LocalVariableReference.EmitAssign): Likewise.
+ (ParameterReference.EmitAssign): Likewise.
+ (Invocation.EmitArguments): Likewise.
+ (ArrayAccess.EmitAssign): Likewise.
+ (IndexerAccess.EmitAssign): Likewise.
+ (This.EmitAssign): Likewise.
+ (ConditionalLogicalOperator.Emit): Likewise.
+
Fix #79026
* codegen.cs (EmitContext.GetTemporaryLocal): Simplify. Use Stack
instead of ArrayList. If the hashtable has a LocalBuilder, don't
Modified: trunk/mcs/mcs/ecore.cs
===================================================================
--- trunk/mcs/mcs/ecore.cs 2006-08-08 14:37:37 UTC (rev 63484)
+++ trunk/mcs/mcs/ecore.cs 2006-08-08 14:50:59 UTC (rev 63485)
@@ -3051,8 +3051,10 @@
else
ig.Emit (OpCodes.Stfld, FieldInfo);
- if (temp != null)
+ if (temp != null) {
temp.Emit (ec);
+ temp.Release (ec);
+ }
}
public override void Emit (EmitContext ec)
@@ -3507,8 +3509,10 @@
Invocation.EmitCall (ec, IsBase, IsStatic,
InstanceExpression, setter, args, loc, false, prepared);
- if (temp != null)
+ if (temp != null) {
temp.Emit (ec);
+ temp.Release (ec);
+ }
}
}
Modified: trunk/mcs/mcs/expression.cs
===================================================================
--- trunk/mcs/mcs/expression.cs 2006-08-08 14:37:37 UTC (rev 63484)
+++ trunk/mcs/mcs/expression.cs 2006-08-08 14:50:59 UTC (rev 63485)
@@ -723,8 +723,10 @@
StoreFromPtr (ec.ig, type);
- if (temporary != null)
+ if (temporary != null) {
temporary.Emit (ec);
+ temporary.Release (ec);
+ }
}
public void AddressOf (EmitContext ec, AddressOp Mode)
@@ -753,9 +755,7 @@
#region IVariable Members
public VariableInfo VariableInfo {
- get {
- return null;
- }
+ get { return null; }
}
public bool VerifyFixed ()
@@ -794,18 +794,18 @@
PostIncrement = IsPost,
PostDecrement = IsPost | IsDecrement
}
-
+
Mode mode;
bool is_expr = false;
bool recurse = false;
-
+
Expression expr;
//
// This is expensive for the simplest case.
//
StaticCallExpr method;
-
+
public UnaryMutator (Mode m, Expression e, Location l)
{
mode = m;
@@ -818,7 +818,7 @@
return (mode == Mode.PreIncrement || mode ==
Mode.PostIncrement) ?
"++" : "--";
}
-
+
/// <summary>
/// Returns whether an object of type `t' can be incremented
/// or decremented with add/sub (ie, basically whether we can
@@ -990,7 +990,7 @@
}
}
-
+
void EmitCode (EmitContext ec, bool is_expr)
{
recurse = true;
@@ -1006,7 +1006,7 @@
// having to allocate another expression
//
if (recurse) {
- ((IAssignMethod) expr).Emit (ec, is_expr &&
(mode == Mode.PostIncrement || mode == Mode.PostDecrement));
+ ((IAssignMethod) expr).Emit (ec, is_expr &&
(mode == Mode.PostIncrement || mode == Mode.PostDecrement));
if (method == null)
LoadOneAndEmitOp (ec, expr.Type);
else
@@ -1014,10 +1014,10 @@
recurse = false;
return;
}
-
+
EmitCode (ec, true);
}
-
+
public override void EmitStatement (EmitContext ec)
{
EmitCode (ec, false);
@@ -2980,6 +2980,9 @@
ig.MarkLabel (false_target);
op.Emit (ec);
ig.MarkLabel (end_target);
+
+ // We release 'left_temp' here since 'op' may refer to
it too
+ left_temp.Release (ec);
}
}
@@ -3409,8 +3412,10 @@
temp.Store (ec);
}
ig.Emit (OpCodes.Stfld,
local_info.FieldBuilder);
- if (temp != null)
+ if (temp != null) {
temp.Emit (ec);
+ temp.Release (ec);
+ }
}
}
@@ -3712,8 +3717,10 @@
StoreFromPtr (ig, type);
- if (temp != null)
+ if (temp != null) {
temp.Emit (ec);
+ temp.Release (ec);
+ }
} else {
if (arg_idx <= 255)
ig.Emit (OpCodes.Starg_S, (byte)
arg_idx);
@@ -4900,8 +4907,10 @@
if (this_arg != null)
this_arg.Emit (ec);
- for (int i = 0; i < top; i ++)
+ for (int i = 0; i < top; i ++) {
temps [i].Emit (ec);
+ temps [i].Release (ec);
+ }
}
if (pd != null && pd.Count > top &&
@@ -6295,6 +6304,7 @@
/// <summary>
/// Represents the `this' construct
/// </summary>
+
public class This : Expression, IAssignMethod, IMemoryLocation,
IVariable {
Block block;
@@ -6398,8 +6408,10 @@
ig.Emit (OpCodes.Stobj, type);
- if (leave_copy)
+ if (leave_copy) {
t.Emit (ec);
+ t.Release (ec);
+ }
} else {
throw new Exception ("how did you get here");
}
@@ -7424,8 +7436,10 @@
}
StoreFromPtr (ec.ig, t);
- if (temp != null)
+ if (temp != null) {
temp.Emit (ec);
+ temp.Release (ec);
+ }
return;
}
@@ -7483,8 +7497,10 @@
ig.Emit (OpCodes.Call, set);
}
- if (temp != null)
+ if (temp != null) {
temp.Emit (ec);
+ temp.Release (ec);
+ }
}
public void AddressOf (EmitContext ec, AddressOp mode)
@@ -7822,8 +7838,10 @@
Invocation.EmitCall (ec, is_base_indexer, false,
instance_expr, set, set_arguments, loc, false, prepared);
- if (temp != null)
+ if (temp != null) {
temp.Emit (ec);
+ temp.Release (ec);
+ }
}
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches