+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>
} 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 {
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;
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:
*
* 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;
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)
iresult->context = context;
}
- iresult->inflated = result;
-
return result;
}
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);
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;
}
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);
*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;
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);
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;
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;
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;
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);
context->gmethod = gmethod;
}
- return mono_class_inflate_generic_method (method, klass, context);
+ return mono_class_inflate_generic_method (method, context);
}
static MonoMethod *
+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>
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);