Author: zoltan
Date: 2005-11-17 05:57:32 -0500 (Thu, 17 Nov 2005)
New Revision: 53165
Modified:
trunk/mono/mono/metadata/ChangeLog
trunk/mono/mono/metadata/marshal.c
Log:
2005-11-17 Zoltan Varga <[EMAIL PROTECTED]>
* marshal.c (emit_ptr_to_object_conv): Get rid of the 'usize' and
'msize' parameters, use the information in 'mspec' instead.
(emit_object_to_ptr_conv): Ditto.
* marshal.c (emit_struct_conv): Handle explicit layout structs with
fields out of order. Fixes #76733.
Modified: trunk/mono/mono/metadata/ChangeLog
===================================================================
--- trunk/mono/mono/metadata/ChangeLog 2005-11-17 10:57:18 UTC (rev 53164)
+++ trunk/mono/mono/metadata/ChangeLog 2005-11-17 10:57:32 UTC (rev 53165)
@@ -1,3 +1,12 @@
+2005-11-17 Zoltan Varga <[EMAIL PROTECTED]>
+
+ * marshal.c (emit_ptr_to_object_conv): Get rid of the 'usize' and
+ 'msize' parameters, use the information in 'mspec' instead.
+ (emit_object_to_ptr_conv): Ditto.
+
+ * marshal.c (emit_struct_conv): Handle explicit layout structs with
+ fields out of order. Fixes #76733.
+
2005-11-17 Ankit Jain <[EMAIL PROTECTED]>
* metadata.c (mono_type_create_from_typespec_full): Remove unnecessary
g_assert.
Modified: trunk/mono/mono/metadata/marshal.c
===================================================================
--- trunk/mono/mono/metadata/marshal.c 2005-11-17 10:57:18 UTC (rev 53164)
+++ trunk/mono/mono/metadata/marshal.c 2005-11-17 10:57:32 UTC (rev 53165)
@@ -949,8 +949,7 @@
}
static void
-emit_ptr_to_object_conv (MonoMethodBuilder *mb, MonoType *type,
MonoMarshalConv conv,
- int usize, int msize, MonoMarshalSpec *mspec)
+emit_ptr_to_object_conv (MonoMethodBuilder *mb, MonoType *type,
MonoMarshalConv conv, MonoMarshalSpec *mspec)
{
switch (conv) {
case MONO_MARSHAL_CONV_BOOL_I4:
@@ -1152,8 +1151,7 @@
}
static void
-emit_object_to_ptr_conv (MonoMethodBuilder *mb, MonoType *type,
MonoMarshalConv conv, int usize, int msize,
- MonoMarshalSpec *mspec)
+emit_object_to_ptr_conv (MonoMethodBuilder *mb, MonoType *type,
MonoMarshalConv conv, MonoMarshalSpec *mspec)
{
int pos;
@@ -1207,13 +1205,12 @@
break;
case MONO_MARSHAL_CONV_STR_BYVALSTR:
case MONO_MARSHAL_CONV_STR_BYVALWSTR: {
- if (!usize)
- break;
+ g_assert (mspec);
mono_mb_emit_ldloc (mb, 1); /* dst */
mono_mb_emit_ldloc (mb, 0);
mono_mb_emit_byte (mb, CEE_LDIND_I); /* src String */
- mono_mb_emit_icon (mb, usize);
+ mono_mb_emit_icon (mb, mspec->data.array_data.num_elem);
mono_mb_emit_icall (mb, conv_to_icall (conv));
break;
}
@@ -1232,9 +1229,6 @@
else
esize = sizeof (gpointer);
- if (!usize)
- break;
-
mono_mb_emit_ldloc (mb, 0);
mono_mb_emit_byte (mb, CEE_LDIND_I);
mono_mb_emit_byte (mb, CEE_BRFALSE_S);
@@ -1350,12 +1344,9 @@
msize = info->fields [i + 1].field->offset -
info->fields [i].field->offset;
usize = info->fields [i + 1].offset - info->fields
[i].offset;
}
- if ((msize < 0) || (usize < 0))
- /* This happens with GC aware auto layout */
+ if ((klass->flags & TYPE_ATTRIBUTE_LAYOUT_MASK) ==
TYPE_ATTRIBUTE_AUTO_LAYOUT)
g_error ("Type %s which is passed to unmanaged code
must have a StructLayout attribute", mono_type_full_name (&klass->byval_arg));
- g_assert ((msize >= 0) && (usize >= 0));
-
switch (conv) {
case MONO_MARSHAL_CONV_NONE: {
int t;
@@ -1435,9 +1426,9 @@
}
default:
if (to_object)
- emit_ptr_to_object_conv (mb, ftype, conv,
usize, msize, info->fields [i].mspec);
+ emit_ptr_to_object_conv (mb, ftype, conv,
info->fields [i].mspec);
else
- emit_object_to_ptr_conv (mb, ftype, conv,
usize, msize, info->fields [i].mspec);
+ emit_object_to_ptr_conv (mb, ftype, conv,
info->fields [i].mspec);
}
if (to_object) {
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches