Author: raja
Date: 2005-10-11 08:42:26 -0400 (Tue, 11 Oct 2005)
New Revision: 51561
Modified:
trunk/mcs/gmcs/ChangeLog
trunk/mcs/gmcs/ecore.cs
trunk/mcs/gmcs/expression.cs
Log:
*** Merged revisions from mcs: 51512, 51513
Modified: trunk/mcs/gmcs/ChangeLog
===================================================================
--- trunk/mcs/gmcs/ChangeLog 2005-10-11 12:07:13 UTC (rev 51560)
+++ trunk/mcs/gmcs/ChangeLog 2005-10-11 12:42:26 UTC (rev 51561)
@@ -1,3 +1,13 @@
+2005-10-10 Raja R Harinath <[EMAIL PROTECTED]>
+
+ * ecore.cs (PropertyExpr.Emit): Use Invocation.EmitCall to emit
+ InstanceExpression.
+ (PropertyExpr.EmitCall): Likewise.
+ * expression.cs (Invocation.EmitArguments): Handle case where
+ arguments == null.
+ (Invocation.EmitCall): Avoid allocating temporary variable if
+ there are no arguments.
+
2005-10-11 Marek Safar <[EMAIL PROTECTED]>
Fix #76370.
Modified: trunk/mcs/gmcs/ecore.cs
===================================================================
--- trunk/mcs/gmcs/ecore.cs 2005-10-11 12:07:13 UTC (rev 51560)
+++ trunk/mcs/gmcs/ecore.cs 2005-10-11 12:42:26 UTC (rev 51561)
@@ -3679,9 +3679,6 @@
public void Emit (EmitContext ec, bool leave_copy)
{
- if (!prepared)
- EmitInstance (ec, false);
-
//
// Special case: length of single dimension array
property is turned into ldlen
//
@@ -3694,21 +3691,22 @@
// support invoking GetArrayRank, so test for
that case first
//
if (iet != TypeManager.array_type &&
(iet.GetArrayRank () == 1)) {
+ if (!prepared)
+ EmitInstance (ec, false);
ec.ig.Emit (OpCodes.Ldlen);
ec.ig.Emit (OpCodes.Conv_I4);
return;
}
}
- Invocation.EmitCall (ec, IsBase, IsStatic, new
EmptyAddressOf (), getter, null, loc);
+ Invocation.EmitCall (ec, IsBase, IsStatic,
InstanceExpression, getter, null, loc, prepared, false);
- if (!leave_copy)
- return;
-
- ec.ig.Emit (OpCodes.Dup);
- if (!is_static) {
- temp = new LocalTemporary (ec, this.Type);
- temp.Store (ec);
+ if (leave_copy) {
+ ec.ig.Emit (OpCodes.Dup);
+ if (!is_static) {
+ temp = new LocalTemporary (ec,
this.Type);
+ temp.Store (ec);
+ }
}
}
@@ -3717,23 +3715,32 @@
//
public void EmitAssign (EmitContext ec, Expression source, bool
leave_copy, bool prepare_for_load)
{
+ Expression my_source = source;
+
prepared = prepare_for_load;
- EmitInstance (ec, prepare_for_load);
-
- source.Emit (ec);
- if (leave_copy) {
- ec.ig.Emit (OpCodes.Dup);
+ if (prepared) {
+ source.Emit (ec);
+ if (leave_copy) {
+ ec.ig.Emit (OpCodes.Dup);
+ if (!is_static) {
+ temp = new LocalTemporary (ec,
this.Type);
+ temp.Store (ec);
+ }
+ }
+ } else if (leave_copy) {
+ source.Emit (ec);
if (!is_static) {
temp = new LocalTemporary (ec,
this.Type);
temp.Store (ec);
}
+ my_source = temp;
}
ArrayList args = new ArrayList (1);
- args.Add (new Argument (new EmptyAddressOf (),
Argument.AType.Expression));
+ args.Add (new Argument (my_source,
Argument.AType.Expression));
- Invocation.EmitCall (ec, IsBase, IsStatic, new
EmptyAddressOf (), setter, args, loc);
+ Invocation.EmitCall (ec, IsBase, IsStatic,
InstanceExpression, setter, args, loc, false, prepared);
if (temp != null)
temp.Emit (ec);
Modified: trunk/mcs/gmcs/expression.cs
===================================================================
--- trunk/mcs/gmcs/expression.cs 2005-10-11 12:07:13 UTC (rev 51560)
+++ trunk/mcs/gmcs/expression.cs 2005-10-11 12:42:26 UTC (rev 51561)
@@ -5683,34 +5683,13 @@
/// </summary>
public static void EmitArguments (EmitContext ec, MethodBase
mb, ArrayList arguments, bool dup_args, LocalTemporary this_arg)
{
- ParameterData pd;
- if (mb != null)
- pd = TypeManager.GetParameterData (mb);
- else
- pd = null;
-
+ ParameterData pd = mb == null ? null :
TypeManager.GetParameterData (mb);
+ int top = arguments == null ? 0 : arguments.Count;
LocalTemporary [] temps = null;
- if (dup_args)
- temps = new LocalTemporary [arguments.Count];
+ if (dup_args && top != 0)
+ temps = new LocalTemporary [top];
- //
- // If we are calling a params method with no arguments,
special case it
- //
- if (arguments == null){
- if (pd != null && pd.Count > 0 &&
- pd.ParameterModifier (0) ==
Parameter.Modifier.PARAMS){
- ILGenerator ig = ec.ig;
-
- IntConstant.EmitInt (ig, 0);
- ig.Emit (OpCodes.Newarr,
TypeManager.GetElementType (pd.ParameterType (0)));
- }
-
- return;
- }
-
- int top = arguments.Count;
-
for (int i = 0; i < top; i++){
Argument a = (Argument) arguments [i];
@@ -5920,9 +5899,11 @@
}
if (dup_args) {
- this_arg = new LocalTemporary
(ec, t);
ig.Emit (OpCodes.Dup);
- this_arg.Store (ec);
+ if (Arguments != null &&
Arguments.Count != 0) {
+ this_arg = new
LocalTemporary (ec, t);
+ this_arg.Store (ec);
+ }
}
}
}
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches