[Pkg-mono-svn-commits] [SCM] mono branch, master-experimental, updated. debian/2.6.3-4-34-gd1bf954
Mirco Bauer
meebey at meebey.net
Thu Aug 12 01:18:33 UTC 2010
The following commit has been merged in the master-experimental branch:
commit cedada611460dcf95b0579988539a737b358abab
Merge: 254b5e0c29e428623f84bc64d406ca1c248bc08a 74149949b4693ac9828f5fabca8b939e32285d42
Author: Mirco Bauer <meebey at meebey.net>
Date: Tue Aug 3 01:08:27 2010 +0200
Merge branch 'debian/patches/dont_assert_on_empty_DGC_field' into merge/2.6.7
diff --combined mono/metadata/reflection.c
index 66a34e6,161523b..989a2a0
--- a/mono/metadata/reflection.c
+++ b/mono/metadata/reflection.c
@@@ -2611,16 -2611,29 +2611,29 @@@ is_field_on_inst (MonoClassField *field
static MonoType*
get_field_on_inst_generic_type (MonoClassField *field)
{
+ MonoClass *class, *gtd;
MonoDynamicGenericClass *dgclass;
int field_index;
g_assert (is_field_on_inst (field));
dgclass = (MonoDynamicGenericClass*)field->parent->generic_class;
- field_index = field - dgclass->fields;
- g_assert (field_index >= 0 && field_index < dgclass->count_fields);
- return dgclass->field_generic_types [field_index];
+ if (field >= dgclass->fields && field - dgclass->fields < dgclass->count_fields) {
+ field_index = field - dgclass->fields;
+ return dgclass->field_generic_types [field_index];
+ }
+
+ class = field->parent;
+ gtd = class->generic_class->container_class;
+
+ if (field >= class->fields && field - class->fields < class->field.count) {
+ field_index = field - class->fields;
+ return gtd->fields [field_index].type;
+ }
+
+ g_assert_not_reached ();
+ return 0;
}
#ifndef DISABLE_REFLECTION_EMIT
@@@ -7131,8 -7144,7 +7144,8 @@@ _mono_reflection_parse_type (char *name
if (!_mono_reflection_parse_type (p, &p, TRUE, subinfo))
return 0;
- if (fqname) {
+ /*MS is lenient on [] delimited parameters that aren't fqn - and F# uses them.*/
+ if (fqname && (*p != ']')) {
char *aname;
if (*p != ',')
@@@ -7157,8 -7169,6 +7170,8 @@@
if (!*aname ||
!assembly_name_to_aname (&subinfo->assembly, aname))
return 0;
+ } else if (fqname && (*p == ']')) {
+ *p++ = 0;
}
if (i + 1 < arity) {
@@@ -9566,7 -9576,6 +9579,7 @@@ mono_reflection_create_generic_class (M
/*Make sure we are a diferent type instance */
klass->generic_container->type_params [i].param.owner = klass->generic_container;
klass->generic_container->type_params [i].info.pklass = NULL;
+ klass->generic_container->type_params [i].info.flags = gparam->attrs;
g_assert (klass->generic_container->type_params [i].param.owner);
}
@@@ -10472,45 -10481,6 +10485,45 @@@ ensure_runtime_vtable (MonoClass *klass
*/
}
+static MonoMethod*
+mono_reflection_method_get_handle (MonoObject *method)
+{
+ MonoClass *class = mono_object_class (method);
+ if (is_sr_mono_method (class) || is_sr_mono_generic_method (class)) {
+ MonoReflectionMethod *sr_method = (MonoReflectionMethod*)method;
+ return sr_method->method;
+ }
+ if (is_sre_method_builder (class)) {
+ MonoReflectionMethodBuilder *mb = (MonoReflectionMethodBuilder*)method;
+ return mb->mhandle;
+ }
+ if (is_sre_method_on_tb_inst (class)) {
+ MonoReflectionMethodOnTypeBuilderInst *m = (MonoReflectionMethodOnTypeBuilderInst*)method;
+ MonoMethod *result;
+ /*FIXME move this to a proper method and unify with resolve_object*/
+ if (m->method_args) {
+ result = mono_reflection_method_on_tb_inst_get_handle (m);
+ } else {
+ MonoType *type = mono_reflection_type_get_handle ((MonoReflectionType*)m->inst);
+ MonoClass *inflated_klass = mono_class_from_mono_type (type);
+ MonoMethod *mono_method;
+
+ if (is_sre_method_builder (mono_object_class (m->mb)))
+ mono_method = ((MonoReflectionMethodBuilder *)m->mb)->mhandle;
+ else if (is_sr_mono_method (mono_object_class (m->mb)))
+ mono_method = ((MonoReflectionMethod *)m->mb)->method;
+ else
+ g_error ("resolve_object:: can't handle a MTBI with base_method of type %s", mono_type_get_full_name (mono_object_class (m->mb)));
+
+ result = inflate_mono_method (inflated_klass, mono_method, (MonoObject*)m->mb);
+ }
+ return result;
+ }
+
+ g_error ("Can't handle methods of type %s:%s", class->name_space, class->name);
+ return NULL;
+}
+
void
mono_reflection_get_dynamic_overrides (MonoClass *klass, MonoMethod ***overrides, int *num_overrides)
{
@@@ -10547,9 -10517,13 +10560,9 @@@
MonoReflectionMethodBuilder *mb =
mono_array_get (tb->methods, MonoReflectionMethodBuilder*, i);
if (mb->override_method) {
- (*overrides) [onum * 2] =
- mb->override_method->method;
- (*overrides) [onum * 2 + 1] =
- mb->mhandle;
+ (*overrides) [onum * 2] = mono_reflection_method_get_handle ((MonoObject *)mb->override_method);
+ (*overrides) [onum * 2 + 1] = mb->mhandle;
- /* FIXME: What if 'override_method' is a MethodBuilder ? */
- g_assert (mb->override_method->method);
g_assert (mb->mhandle);
onum ++;
--
mono
More information about the Pkg-mono-svn-commits
mailing list