Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRodrigo Kumpera <kumpera@gmail.com>2012-11-05 23:13:57 +0400
committerRodrigo Kumpera <kumpera@gmail.com>2012-11-05 23:16:12 +0400
commit301b6c6fd8a42f7710bd0bdd95c6ac97efcdc559 (patch)
tree33f244a614a822fb4076193fd7eac5ef3a6ab693
parentc3e6485245c5071245542cf66a5f616f73df8bdc (diff)
Remove SRE.UnmanagedMarshal dependency from System.Reflection.mono-3.0.1
* FieldInfo.cs: * MonoMethod.cs: * ParameterInfo.cs: Remove silly dep on UnmanagedMarshal to use MarshalAsAttribute which is what we need in the end. * icall.c: * reflection.c: Use the custom attribute type instead of the SRE one. This allows FULL_AOT_RUNTIME to work with stuff that uses MarshalAs.
-rw-r--r--mcs/class/corlib/System.Reflection.Emit/UnmanagedMarshal.cs17
-rw-r--r--mcs/class/corlib/System.Reflection/FieldInfo.cs7
-rw-r--r--mcs/class/corlib/System.Reflection/MonoMethod.cs2
-rw-r--r--mcs/class/corlib/System.Reflection/ParameterInfo.cs7
-rw-r--r--mcs/class/corlib/System/Environment.cs2
-rw-r--r--mono/metadata/appdomain.c2
-rw-r--r--mono/metadata/icall-def.h2
-rw-r--r--mono/metadata/icall.c12
-rw-r--r--mono/metadata/object-internals.h2
-rw-r--r--mono/metadata/reflection.c39
10 files changed, 37 insertions, 55 deletions
diff --git a/mcs/class/corlib/System.Reflection.Emit/UnmanagedMarshal.cs b/mcs/class/corlib/System.Reflection.Emit/UnmanagedMarshal.cs
index b9ed853e902..9c123e97068 100644
--- a/mcs/class/corlib/System.Reflection.Emit/UnmanagedMarshal.cs
+++ b/mcs/class/corlib/System.Reflection.Emit/UnmanagedMarshal.cs
@@ -126,22 +126,5 @@ namespace System.Reflection.Emit {
return res;
}
-
- internal MarshalAsAttribute ToMarshalAsAttribute () {
- MarshalAsAttribute attr = new MarshalAsAttribute (t);
- attr.ArraySubType = tbase;
- attr.MarshalCookie = mcookie;
- attr.MarshalType = marshaltype;
- attr.MarshalTypeRef = marshaltyperef;
- if (count == -1)
- attr.SizeConst = 0;
- else
- attr.SizeConst = count;
- if (param_num == -1)
- attr.SizeParamIndex = 0;
- else
- attr.SizeParamIndex = (short)param_num;
- return attr;
- }
}
}
diff --git a/mcs/class/corlib/System.Reflection/FieldInfo.cs b/mcs/class/corlib/System.Reflection/FieldInfo.cs
index cd0d848fc48..93ac75de4af 100644
--- a/mcs/class/corlib/System.Reflection/FieldInfo.cs
+++ b/mcs/class/corlib/System.Reflection/FieldInfo.cs
@@ -28,7 +28,6 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
using System.Diagnostics;
-using System.Reflection.Emit;
using System.Globalization;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
@@ -191,7 +190,7 @@ namespace System.Reflection {
}
[MethodImplAttribute(MethodImplOptions.InternalCall)]
- private extern UnmanagedMarshal GetUnmanagedMarshal ();
+ private extern MarshalAsAttribute get_marshal_info ();
internal object[] GetPseudoCustomAttributes ()
{
@@ -203,7 +202,7 @@ namespace System.Reflection {
if (DeclaringType.IsExplicitLayout)
count ++;
- UnmanagedMarshal marshalAs = UMarshal;
+ MarshalAsAttribute marshalAs = get_marshal_info ();
if (marshalAs != null)
count ++;
@@ -217,7 +216,7 @@ namespace System.Reflection {
if (DeclaringType.IsExplicitLayout)
attrs [count ++] = new FieldOffsetAttribute (GetFieldOffset ());
if (marshalAs != null)
- attrs [count ++] = marshalAs.ToMarshalAsAttribute ();
+ attrs [count ++] = marshalAs;
return attrs;
}
diff --git a/mcs/class/corlib/System.Reflection/MonoMethod.cs b/mcs/class/corlib/System.Reflection/MonoMethod.cs
index 234acd90a0d..40366b43d0f 100644
--- a/mcs/class/corlib/System.Reflection/MonoMethod.cs
+++ b/mcs/class/corlib/System.Reflection/MonoMethod.cs
@@ -99,7 +99,7 @@ namespace System.Reflection {
}
[MethodImplAttribute(MethodImplOptions.InternalCall)]
- static extern UnmanagedMarshal get_retval_marshal (IntPtr handle);
+ static extern MarshalAsAttribute get_retval_marshal (IntPtr handle);
static internal ParameterInfo GetReturnParameterInfo (MonoMethod method)
{
diff --git a/mcs/class/corlib/System.Reflection/ParameterInfo.cs b/mcs/class/corlib/System.Reflection/ParameterInfo.cs
index 7ea808b8639..8d16f7e63a6 100644
--- a/mcs/class/corlib/System.Reflection/ParameterInfo.cs
+++ b/mcs/class/corlib/System.Reflection/ParameterInfo.cs
@@ -45,8 +45,7 @@ namespace System.Reflection
protected string NameImpl;
protected int PositionImpl;
protected ParameterAttributes AttrsImpl;
- private UnmanagedMarshal marshalAs;
- //ParameterInfo parent;
+ private MarshalAsAttribute marshalAs;
protected ParameterInfo () {
}
@@ -90,7 +89,7 @@ namespace System.Reflection
}
/* to build a ParameterInfo for the return type of a method */
- internal ParameterInfo (Type type, MemberInfo member, UnmanagedMarshal marshalAs) {
+ internal ParameterInfo (Type type, MemberInfo member, MarshalAsAttribute marshalAs) {
this.ClassImpl = type;
this.MemberImpl = member;
this.NameImpl = "";
@@ -244,7 +243,7 @@ namespace System.Reflection
attrs [count ++] = new OutAttribute ();
if (marshalAs != null)
- attrs [count ++] = marshalAs.ToMarshalAsAttribute ();
+ attrs [count ++] = marshalAs.Copy ();
return attrs;
}
diff --git a/mcs/class/corlib/System/Environment.cs b/mcs/class/corlib/System/Environment.cs
index 0571215dafd..3f8878b0439 100644
--- a/mcs/class/corlib/System/Environment.cs
+++ b/mcs/class/corlib/System/Environment.cs
@@ -56,7 +56,7 @@ namespace System {
* of icalls, do not require an increment.
*/
#pragma warning disable 169
- private const int mono_corlib_version = 107;
+ private const int mono_corlib_version = 108;
#pragma warning restore 169
[ComVisible (true)]
diff --git a/mono/metadata/appdomain.c b/mono/metadata/appdomain.c
index 2907af6d492..04ce7e331a5 100644
--- a/mono/metadata/appdomain.c
+++ b/mono/metadata/appdomain.c
@@ -75,7 +75,7 @@
* Changes which are already detected at runtime, like the addition
* of icalls, do not require an increment.
*/
-#define MONO_CORLIB_VERSION 107
+#define MONO_CORLIB_VERSION 108
typedef struct
{
diff --git a/mono/metadata/icall-def.h b/mono/metadata/icall-def.h
index 515b971212d..4173b721b16 100644
--- a/mono/metadata/icall-def.h
+++ b/mono/metadata/icall-def.h
@@ -572,7 +572,7 @@ ICALL(TYPEB_7, "setup_internal_class", mono_reflection_setup_internal_class)
ICALL_TYPE(FIELDI, "System.Reflection.FieldInfo", FILEDI_1)
ICALL(FILEDI_1, "GetTypeModifiers", ves_icall_System_Reflection_FieldInfo_GetTypeModifiers)
-ICALL(FILEDI_2, "GetUnmanagedMarshal", ves_icall_System_Reflection_FieldInfo_GetUnmanagedMarshal)
+ICALL(FILEDI_2, "get_marshal_info", ves_icall_System_Reflection_FieldInfo_get_marshal_info)
ICALL(FILEDI_3, "internal_from_handle_type", ves_icall_System_Reflection_FieldInfo_internal_from_handle_type)
ICALL_TYPE(MEMBERI, "System.Reflection.MemberInfo", MEMBERI_1)
diff --git a/mono/metadata/icall.c b/mono/metadata/icall.c
index e58903aa88a..8747f4c6baa 100644
--- a/mono/metadata/icall.c
+++ b/mono/metadata/icall.c
@@ -1641,8 +1641,8 @@ ves_icall_get_attributes (MonoReflectionType *type)
return klass->flags;
}
-ICALL_EXPORT MonoReflectionMarshal*
-ves_icall_System_Reflection_FieldInfo_GetUnmanagedMarshal (MonoReflectionField *field)
+ICALL_EXPORT MonoReflectionMarshalAsAttribute*
+ves_icall_System_Reflection_FieldInfo_get_marshal_info (MonoReflectionField *field)
{
MonoClass *klass = field->field->parent;
MonoMarshalType *info;
@@ -1659,7 +1659,7 @@ ves_icall_System_Reflection_FieldInfo_GetUnmanagedMarshal (MonoReflectionField *
if (!info->fields [i].mspec)
return NULL;
else
- return mono_reflection_marshal_from_marshal_spec (field->object.vtable->domain, klass, info->fields [i].mspec);
+ return mono_reflection_marshal_as_attribute_from_marshal_spec (field->object.vtable->domain, klass, info->fields [i].mspec);
}
}
@@ -1749,11 +1749,11 @@ ves_icall_get_parameter_info (MonoMethod *method, MonoReflectionMethod *member)
return mono_param_get_objects_internal (domain, method, member->reftype ? mono_class_from_mono_type (member->reftype->type) : NULL);
}
-ICALL_EXPORT MonoReflectionMarshal*
+ICALL_EXPORT MonoReflectionMarshalAsAttribute*
ves_icall_System_MonoMethodInfo_get_retval_marshal (MonoMethod *method)
{
MonoDomain *domain = mono_domain_get ();
- MonoReflectionMarshal* res = NULL;
+ MonoReflectionMarshalAsAttribute* res = NULL;
MonoMarshalSpec **mspecs;
int i;
@@ -1761,7 +1761,7 @@ ves_icall_System_MonoMethodInfo_get_retval_marshal (MonoMethod *method)
mono_method_get_marshal_info (method, mspecs);
if (mspecs [0])
- res = mono_reflection_marshal_from_marshal_spec (domain, method->klass, mspecs [0]);
+ res = mono_reflection_marshal_as_attribute_from_marshal_spec (domain, method->klass, mspecs [0]);
for (i = mono_method_signature (method)->param_count; i >= 0; i--)
if (mspecs [i])
diff --git a/mono/metadata/object-internals.h b/mono/metadata/object-internals.h
index e51f5de8764..d83c59afe16 100644
--- a/mono/metadata/object-internals.h
+++ b/mono/metadata/object-internals.h
@@ -1413,7 +1413,7 @@ MonoArray *mono_reflection_sighelper_get_signature_local (MonoReflectionSigHelp
MonoArray *mono_reflection_sighelper_get_signature_field (MonoReflectionSigHelper *sig) MONO_INTERNAL;
-MonoReflectionMarshal* mono_reflection_marshal_from_marshal_spec (MonoDomain *domain, MonoClass *klass, MonoMarshalSpec *spec) MONO_INTERNAL;
+MonoReflectionMarshalAsAttribute* mono_reflection_marshal_as_attribute_from_marshal_spec (MonoDomain *domain, MonoClass *klass, MonoMarshalSpec *spec) MONO_INTERNAL;
gpointer
mono_reflection_lookup_dynamic_token (MonoImage *image, guint32 token, gboolean valid_token, MonoClass **handle_class, MonoGenericContext *context) MONO_INTERNAL;
diff --git a/mono/metadata/reflection.c b/mono/metadata/reflection.c
index 79e285b43cf..0c3d2364822 100644
--- a/mono/metadata/reflection.c
+++ b/mono/metadata/reflection.c
@@ -6862,7 +6862,7 @@ mono_param_get_objects_internal (MonoDomain *domain, MonoMethod *method, MonoCla
}
if (mspecs [i + 1])
- MONO_OBJECT_SETREF (param, MarshalAsImpl, (MonoObject*)mono_reflection_marshal_from_marshal_spec (domain, method->klass, mspecs [i + 1]));
+ MONO_OBJECT_SETREF (param, MarshalAsImpl, (MonoObject*)mono_reflection_marshal_as_attribute_from_marshal_spec (domain, method->klass, mspecs [i + 1]));
mono_array_setref (res, i, param);
}
@@ -10019,45 +10019,46 @@ mono_marshal_spec_from_builder (MonoImage *image, MonoAssembly *assembly,
}
#endif /* !DISABLE_REFLECTION_EMIT */
-MonoReflectionMarshal*
-mono_reflection_marshal_from_marshal_spec (MonoDomain *domain, MonoClass *klass,
+MonoReflectionMarshalAsAttribute*
+mono_reflection_marshal_as_attribute_from_marshal_spec (MonoDomain *domain, MonoClass *klass,
MonoMarshalSpec *spec)
{
- static MonoClass *System_Reflection_Emit_UnmanagedMarshalClass;
- MonoReflectionMarshal *minfo;
+ static MonoClass *System_Reflection_Emit_MarshalAsAttribute;
+ MonoReflectionMarshalAsAttribute *minfo;
MonoType *mtype;
- if (!System_Reflection_Emit_UnmanagedMarshalClass) {
- System_Reflection_Emit_UnmanagedMarshalClass = mono_class_from_name (
- mono_defaults.corlib, "System.Reflection.Emit", "UnmanagedMarshal");
- g_assert (System_Reflection_Emit_UnmanagedMarshalClass);
+ if (!System_Reflection_Emit_MarshalAsAttribute) {
+ System_Reflection_Emit_MarshalAsAttribute = mono_class_from_name (
+ mono_defaults.corlib, "System.Runtime.InteropServices", "MarshalAsAttribute");
+ g_assert (System_Reflection_Emit_MarshalAsAttribute);
}
- minfo = (MonoReflectionMarshal*)mono_object_new (domain, System_Reflection_Emit_UnmanagedMarshalClass);
- minfo->type = spec->native;
+ minfo = (MonoReflectionMarshalAsAttribute*)mono_object_new (domain, System_Reflection_Emit_MarshalAsAttribute);
+ minfo->utype = spec->native;
- switch (minfo->type) {
+ switch (minfo->utype) {
case MONO_NATIVE_LPARRAY:
- minfo->eltype = spec->data.array_data.elem_type;
- minfo->count = spec->data.array_data.num_elem;
- minfo->param_num = spec->data.array_data.param_num;
+ minfo->array_subtype = spec->data.array_data.elem_type;
+ minfo->size_const = spec->data.array_data.num_elem;
+ if (spec->data.array_data.param_num != -1)
+ minfo->size_param_index = spec->data.array_data.param_num;
break;
case MONO_NATIVE_BYVALTSTR:
case MONO_NATIVE_BYVALARRAY:
- minfo->count = spec->data.array_data.num_elem;
+ minfo->size_const = spec->data.array_data.num_elem;
break;
case MONO_NATIVE_CUSTOM:
if (spec->data.custom_data.custom_name) {
mtype = mono_reflection_type_from_name (spec->data.custom_data.custom_name, klass->image);
if (mtype)
- MONO_OBJECT_SETREF (minfo, marshaltyperef, mono_type_get_object (domain, mtype));
+ MONO_OBJECT_SETREF (minfo, marshal_type_ref, mono_type_get_object (domain, mtype));
- MONO_OBJECT_SETREF (minfo, marshaltype, mono_string_new (domain, spec->data.custom_data.custom_name));
+ MONO_OBJECT_SETREF (minfo, marshal_type, mono_string_new (domain, spec->data.custom_data.custom_name));
}
if (spec->data.custom_data.cookie)
- MONO_OBJECT_SETREF (minfo, mcookie, mono_string_new (domain, spec->data.custom_data.cookie));
+ MONO_OBJECT_SETREF (minfo, marshal_cookie, mono_string_new (domain, spec->data.custom_data.cookie));
break;
default: