diff options
author | Raja R Harinath <harinath@hurrynot.org> | 2006-02-28 17:24:45 +0300 |
---|---|---|
committer | Raja R Harinath <harinath@hurrynot.org> | 2006-02-28 17:24:45 +0300 |
commit | 08224d944e54989a25d4f9b04ff3b852e8890fe6 (patch) | |
tree | 75a71d4fb9ee9ae86d6c806b6ba9e09491a451e6 | |
parent | b767344ef4667f639ba805438005fe727465a591 (diff) |
In metadata:
* class.h (mono_class_inflate_generic_method): Revert to two
argument version.
* class-internals.h (MonoMethodInflated): Remove 'inflated' field.
(mono_class_inflate_generic_method_full): Add.
* class.c (mono_class_inflate_generic_method_full): Rename from
'mono_class_inflate_generic_method'. Don't set 'inflated' field.
(mono_class_inflate_generic_method): New. Wrapper around ..._full.
* loader.c, reflection.c: Update to changes.
In mini:
* jit-icalls.c (helper_compile_generic_method): Revert change from
2006-02-24.
svn path=/trunk/mono/; revision=57391
-rw-r--r-- | mono/metadata/ChangeLog | 10 | ||||
-rw-r--r-- | mono/metadata/class-internals.h | 15 | ||||
-rw-r--r-- | mono/metadata/class.c | 31 | ||||
-rw-r--r-- | mono/metadata/class.h | 2 | ||||
-rw-r--r-- | mono/metadata/loader.c | 6 | ||||
-rw-r--r-- | mono/metadata/reflection.c | 4 | ||||
-rw-r--r-- | mono/mini/ChangeLog | 4 | ||||
-rw-r--r-- | mono/mini/jit-icalls.c | 2 |
8 files changed, 43 insertions, 31 deletions
diff --git a/mono/metadata/ChangeLog b/mono/metadata/ChangeLog index 1249b55fc86..e8b6e684e16 100644 --- a/mono/metadata/ChangeLog +++ b/mono/metadata/ChangeLog @@ -1,3 +1,13 @@ +2006-02-28 Raja R Harinath <rharinath@novell.com> + + * class.h (mono_class_inflate_generic_method): Revert to two + argument version. + * class-internals.h (MonoMethodInflated): Remove 'inflated' field. + (mono_class_inflate_generic_method_full): Add. + * class.c (mono_class_inflate_generic_method_full): Rename from + 'mono_class_inflate_generic_method'. Don't set 'inflated' field. + (mono_class_inflate_generic_method): New. Wrapper around ..._full. + * loader.c, reflection.c: Update to changes. Sat Feb 25 17:57:21 CET 2006 Paolo Molaro <lupus@ximian.com> diff --git a/mono/metadata/class-internals.h b/mono/metadata/class-internals.h index 030944c4e0f..72a836dc4f3 100644 --- a/mono/metadata/class-internals.h +++ b/mono/metadata/class-internals.h @@ -109,17 +109,6 @@ struct _MonoMethodInflated { } method; MonoGenericContext *context; /* The current context. */ MonoMethod *declaring; /* the generic method definition. */ - /* This is a big performance optimization: - * - * mono_class_inflate_generic_method() just creates a copy of the method - * and computes its new context, but it doesn't actually inflate the - * method's signature and header. Very often, we don't actually need them - * (for instance because the method is stored in a class'es vtable). - * - * If the `inflated' field in non-NULL, mono_get_inflated_method() already - * inflated the signature and header and stored it there. - */ - MonoMethodInflated *inflated; }; typedef struct { @@ -631,6 +620,10 @@ mono_install_get_cached_class_info (MonoGetCachedClassInfo func); MonoInflatedGenericClass* mono_get_inflated_generic_class (MonoGenericClass *gclass); +MonoMethod* +mono_class_inflate_generic_method_full (MonoMethod *method, MonoClass *klass_hint, MonoGenericContext *context); + + typedef struct { MonoImage *corlib; MonoClass *object_class; diff --git a/mono/metadata/class.c b/mono/metadata/class.c index 738326180fd..aec749bd499 100644 --- a/mono/metadata/class.c +++ b/mono/metadata/class.c @@ -576,6 +576,12 @@ inflate_generic_context (MonoGenericContext *context, MonoGenericContext *inflat return res; } +MonoMethod * +mono_class_inflate_generic_method (MonoMethod *method, MonoGenericContext *context) +{ + return mono_class_inflate_generic_method_full (method, NULL, context); +} + /** * mono_class_inflate_generic_method: * @@ -584,7 +590,7 @@ inflate_generic_context (MonoGenericContext *context, MonoGenericContext *inflat * Use mono_get_inflated_method (), mono_method_signature () and mono_method_get_header () to get the correct values. */ MonoMethod* -mono_class_inflate_generic_method (MonoMethod *method, MonoClass *klass_hint, MonoGenericContext *context) +mono_class_inflate_generic_method_full (MonoMethod *method, MonoClass *klass_hint, MonoGenericContext *context) { MonoMethod *result; MonoMethodInflated *iresult; @@ -619,8 +625,9 @@ mono_class_inflate_generic_method (MonoMethod *method, MonoClass *klass_hint, Mo iresult->context = context; iresult->declaring = method; - if (klass_hint && klass_hint->generic_class && - (klass_hint->generic_class->container_class != method->klass || klass_hint->generic_class->inst != context->gclass->inst)) + if (!klass_hint || !klass_hint->generic_class || + klass_hint->generic_class->container_class != method->klass || + klass_hint->generic_class->inst != context->gclass->inst) klass_hint = NULL; if (method->klass->generic_container) @@ -643,8 +650,6 @@ mono_class_inflate_generic_method (MonoMethod *method, MonoClass *klass_hint, Mo iresult->context = context; } - iresult->inflated = result; - return result; } @@ -1237,28 +1242,28 @@ inflate_event (MonoClass *class, MonoEvent *event, MonoInflatedGenericClass *gcl event->parent = class; if (event->add) { - MonoMethod *inflated = mono_class_inflate_generic_method ( + MonoMethod *inflated = mono_class_inflate_generic_method_full ( event->add, class, gclass->generic_class.context); event->add = mono_get_inflated_method (inflated); } if (event->remove) { - MonoMethod *inflated = mono_class_inflate_generic_method ( + MonoMethod *inflated = mono_class_inflate_generic_method_full ( event->remove, class, gclass->generic_class.context); event->remove = mono_get_inflated_method (inflated); } if (event->raise) { - MonoMethod *inflated = mono_class_inflate_generic_method ( + MonoMethod *inflated = mono_class_inflate_generic_method_full ( event->raise, class, gclass->generic_class.context); event->raise = mono_get_inflated_method (inflated); } if (event->other) { - MonoMethod *inflated = mono_class_inflate_generic_method ( + MonoMethod *inflated = mono_class_inflate_generic_method_full ( event->other, class, gclass->generic_class.context); event->other = mono_get_inflated_method (inflated); @@ -1597,7 +1602,7 @@ setup_generic_vtable (MonoClass *class) if (!m) continue; - m = mono_class_inflate_generic_method (m, class, class->generic_class->context); + m = mono_class_inflate_generic_method_full (m, class, class->generic_class->context); class->vtable [i] = m; } @@ -2140,7 +2145,7 @@ mono_class_init (MonoClass *class) class->methods = g_new0 (MonoMethod *, class->method.count); for (i = 0; i < class->method.count; i++) { - MonoMethod *inflated = mono_class_inflate_generic_method ( + MonoMethod *inflated = mono_class_inflate_generic_method_full ( gklass->methods [i], class, gclass->generic_class.context); class->methods [i] = mono_get_inflated_method (inflated); @@ -2155,10 +2160,10 @@ mono_class_init (MonoClass *class) *prop = gklass->properties [i]; if (prop->get) - prop->get = mono_class_inflate_generic_method ( + prop->get = mono_class_inflate_generic_method_full ( prop->get, class, gclass->generic_class.context); if (prop->set) - prop->set = mono_class_inflate_generic_method ( + prop->set = mono_class_inflate_generic_method_full ( prop->set, class, gclass->generic_class.context); prop->parent = class; diff --git a/mono/metadata/class.h b/mono/metadata/class.h index 2ebebe701d6..5dcf8d3dfe6 100644 --- a/mono/metadata/class.h +++ b/mono/metadata/class.h @@ -53,7 +53,7 @@ MonoType* mono_class_inflate_generic_type (MonoType *type, MonoGenericContext *context); MonoMethod* -mono_class_inflate_generic_method (MonoMethod *method, MonoClass *klass_hint, MonoGenericContext *context); +mono_class_inflate_generic_method (MonoMethod *method, MonoGenericContext *context); MonoMethod * mono_get_inflated_method (MonoMethod *method); diff --git a/mono/metadata/loader.c b/mono/metadata/loader.c index 9b9e48da4cf..fb923e442f6 100644 --- a/mono/metadata/loader.c +++ b/mono/metadata/loader.c @@ -594,7 +594,7 @@ method_from_memberref (MonoImage *image, guint32 idx, MonoGenericContext *typesp method = find_method (in_class, NULL, mname, sig); if (method && klass->generic_class) { MonoClass *klass_hint = (in_class == method->klass) ? klass : NULL; - method = mono_class_inflate_generic_method (method, klass_hint, klass->generic_class->context); + method = mono_class_inflate_generic_method_full (method, klass_hint, klass->generic_class->context); method = mono_get_inflated_method (method); } break; @@ -771,7 +771,7 @@ method_from_methodspec (MonoImage *image, MonoGenericContext *context, guint32 i mono_stats.generics_metadata_size += sizeof (MonoGenericMethod) + sizeof (MonoGenericContext) + param_count * sizeof (MonoType); - inflated = mono_class_inflate_generic_method (method, method->klass, new_context); + inflated = mono_class_inflate_generic_method_full (method, method->klass, new_context); g_hash_table_insert (container->method_hash, gmethod, inflated); return inflated; @@ -1297,7 +1297,7 @@ mono_get_method_constrained (MonoImage *image, guint32 token, MonoClass *constra image->name, token); if (gclass) - result = mono_class_inflate_generic_method (result, NULL, gclass->context); + result = mono_class_inflate_generic_method (result, gclass->context); mono_loader_unlock (); return result; diff --git a/mono/metadata/reflection.c b/mono/metadata/reflection.c index d5e17003d28..b54d903ff8c 100644 --- a/mono/metadata/reflection.c +++ b/mono/metadata/reflection.c @@ -8899,7 +8899,7 @@ mono_reflection_bind_generic_method_parameters (MonoReflectionMethod *rmethod, M if (method->is_inflated) method = ((MonoMethodInflated *) method)->declaring; - inflated = mono_class_inflate_generic_method (method, NULL, context); + inflated = mono_class_inflate_generic_method (method, context); g_hash_table_insert (container->method_hash, gmethod, inflated); return mono_method_get_object (mono_object_domain (rmethod), inflated, NULL); @@ -8944,7 +8944,7 @@ inflate_mono_method (MonoReflectionGenericClass *type, MonoMethod *method, MonoO context->gmethod = gmethod; } - return mono_class_inflate_generic_method (method, klass, context); + return mono_class_inflate_generic_method (method, context); } static MonoMethod * diff --git a/mono/mini/ChangeLog b/mono/mini/ChangeLog index a054182d2ef..a953eb1734b 100644 --- a/mono/mini/ChangeLog +++ b/mono/mini/ChangeLog @@ -1,3 +1,7 @@ +2006-02-28 Raja R Harinath <rharinath@novell.com> + + * jit-icalls.c (helper_compile_generic_method): Revert change from + 2006-02-24. Mon Feb 27 18:58:19 GMT 2006 Paolo Molaro <lupus@ximian.com> diff --git a/mono/mini/jit-icalls.c b/mono/mini/jit-icalls.c index c3d434851cf..892082d0be1 100644 --- a/mono/mini/jit-icalls.c +++ b/mono/mini/jit-icalls.c @@ -668,7 +668,7 @@ helper_compile_generic_method (MonoObject *obj, MonoMethod *method, MonoGenericC g_assert (!vmethod->klass->generic_container); g_assert (!vmethod->klass->generic_class || !vmethod->klass->generic_class->inst->is_open); g_assert (!context->gmethod || !context->gmethod->inst->is_open); - inflated = mono_class_inflate_generic_method (vmethod, vmethod->klass, context); + inflated = mono_class_inflate_generic_method (vmethod, context); inflated = mono_get_inflated_method (inflated); addr = mono_compile_method (inflated); |