Author: marek
Date: 2007-10-04 10:22:52 -0400 (Thu, 04 Oct 2007)
New Revision: 86881
Modified:
trunk/mcs/mcs/ChangeLog
trunk/mcs/mcs/expression.cs
Log:
2007-10-04 Marek Safar <[EMAIL PROTECTED]>
A fix for bug #325841
* expression.cs (ArrayAccess): Use full argument cloning only for
string compound concatenation.
Modified: trunk/mcs/mcs/ChangeLog
===================================================================
--- trunk/mcs/mcs/ChangeLog 2007-10-04 13:51:39 UTC (rev 86880)
+++ trunk/mcs/mcs/ChangeLog 2007-10-04 14:22:52 UTC (rev 86881)
@@ -1,3 +1,9 @@
+2007-10-04 Marek Safar <[EMAIL PROTECTED]>
+
+ A fix for bug #325841
+ * expression.cs (ArrayAccess): Use full argument cloning only for
+ string compound concatenation.
+
2007-10-03 Marek Safar <[EMAIL PROTECTED]>
A fix for bug #328774
Modified: trunk/mcs/mcs/expression.cs
===================================================================
--- trunk/mcs/mcs/expression.cs 2007-10-04 13:51:39 UTC (rev 86880)
+++ trunk/mcs/mcs/expression.cs 2007-10-04 14:22:52 UTC (rev 86881)
@@ -7520,7 +7520,7 @@
// initialized), then load the arguments the first time and
store them
// in locals. otherwise load from local variables.
//
- // prepareForLoad is used in compound assignments to cache
origal index
+ // prepareForLoad is used in compound assignments to cache
original index
// values ( label[idx++] += s )
//
LocalTemporary [] LoadArrayAndArguments (EmitContext ec, bool
prepareForLoad)
@@ -7553,15 +7553,17 @@
int rank = ea.Expr.Type.GetArrayRank ();
ILGenerator ig = ec.ig;
- if (prepared) {
+ if (prepared_value != null) {
prepared_value.Emit (ec);
+ } else if (prepared) {
+ LoadFromPtr (ig, this.type);
} else {
LoadArrayAndArguments (ec, false);
EmitLoadOpcode (ig, type, rank);
}
if (leave_copy) {
- ec.ig.Emit (OpCodes.Dup);
+ ig.Emit (OpCodes.Dup);
temp = new LocalTemporary (this.type);
temp.Store (ec);
}
@@ -7577,18 +7579,23 @@
int rank = ea.Expr.Type.GetArrayRank ();
ILGenerator ig = ec.ig;
Type t = source.Type;
- prepared = prepare_for_load;
+ prepared = prepare_for_load && !(source is
StringConcat);
- LocalTemporary[] original_indexes_values =
LoadArrayAndArguments (ec, prepare_for_load);
+ if (prepared) {
+ AddressOf (ec, AddressOp.LoadStore);
+ ec.ig.Emit (OpCodes.Dup);
+ } else {
+ LocalTemporary[] original_indexes_values =
LoadArrayAndArguments (ec,
+ prepare_for_load && (source is
StringConcat));
- if (prepared) {
- // Store prepared value, it will be used later
when index value is read
- prepared_value = new LocalTemporary (type);
- EmitLoadOpcode (ig, type, rank);
- prepared_value.Store (ec);
- foreach (LocalTemporary lt in
original_indexes_values) {
- lt.Emit (ec);
- lt.Release (ec);
+ if (original_indexes_values != null) {
+ prepared_value = new LocalTemporary
(type);
+ EmitLoadOpcode (ig, type, rank);
+ prepared_value.Store (ec);
+ foreach (LocalTemporary lt in
original_indexes_values) {
+ lt.Emit (ec);
+ lt.Release (ec);
+ }
}
}
@@ -7613,39 +7620,41 @@
temp.Store (ec);
}
- if (is_stobj)
+ if (prepared)
+ StoreFromPtr (ig, t);
+ else if (is_stobj)
ig.Emit (OpCodes.Stobj, t);
else if (has_type_arg)
ig.Emit (op, t);
else
ig.Emit (op);
} else {
- ModuleBuilder mb = CodeGen.Module.Builder;
- int arg_count = ea.Arguments.Count;
- Type [] args = new Type [arg_count + 1];
- MethodInfo set;
-
source.Emit (ec);
if (leave_copy) {
ec.ig.Emit (OpCodes.Dup);
temp = new LocalTemporary (this.type);
temp.Store (ec);
}
-
- for (int i = 0; i < arg_count; i++){
- //args [i++] = a.Type;
- args [i] = TypeManager.int32_type;
+
+ if (prepared) {
+ StoreFromPtr (ig, t);
+ } else {
+ int arg_count = ea.Arguments.Count;
+ Type [] args = new Type [arg_count + 1];
+ for (int i = 0; i < arg_count; i++) {
+ //args [i++] = a.Type;
+ args [i] =
TypeManager.int32_type;
+ }
+ args [arg_count] = type;
+
+ MethodInfo set =
CodeGen.Module.Builder.GetArrayMethod (
+ ea.Expr.Type, "Set",
+ CallingConventions.HasThis |
+ CallingConventions.Standard,
+ TypeManager.void_type, args);
+
+ ig.Emit (OpCodes.Call, set);
}
-
- args [arg_count] = type;
-
- set = mb.GetArrayMethod (
- ea.Expr.Type, "Set",
- CallingConventions.HasThis |
- CallingConventions.Standard,
- TypeManager.void_type, args);
-
- ig.Emit (OpCodes.Call, set);
}
if (temp != null) {
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches