Generics API cleanup: renamed MonoGenericInst -> MonoGenericClass.
* metadata-internals.h (MonoImage): Renamed `generic_inst_cache'
to `generic_class_cache'.
* metadata.c
(mono_generic_inst_hash): Renamed to mono_generic_class_hash().
(mono_generic_inst_equal): Renamed to mono_generic_class_equal().
(mono_generic_inst_is_valuetype): Renamed to
mono_generic_class_is_valuetype().
* class-internals.h
(MonoGenericInst): Renamed to MonoGenericClass.
(MonoDynamicGenericInst): Renamed to MonoDynamicGenericClass.
(MonoClass): Renamed `generic_inst' to `generic_class'.
(MonoGenericContext): Renamed `ginst' to `gclass'.
* object-internals.h
(MonoReflectionGenericInst): Renamed to MonoReflectionGenericClass.
* reflection.c (mono_reflection_generic_inst_initialize): Renamed to
mono_reflection_generic_class_initialize().
* icall.c (icall_entries): "System.Reflection.MonoGenericInst" is
now known as "System.Reflection.MonoGenericClass".
(monogenericinst_icalls): Renamed to monogenericclass_icalls.
svn path=/trunk/mono/; revision=36854
esname = get_escaped_name (result);
g_free (result);
- if (c->generic_inst) {
- MonoGenericInst *ginst = c->generic_inst;
+ if (c->generic_class) {
+ MonoGenericClass *gclass = c->generic_class;
GString *str = g_string_new ("");
int i;
- for (i = 0; i < ginst->type_argc; i++){
- char *t = dis_stringify_type (m, ginst->type_argv [i]);
+ for (i = 0; i < gclass->type_argc; i++){
+ char *t = dis_stringify_type (m, gclass->type_argv [i]);
g_string_append (str, t);
- if (i+1 != ginst->type_argc)
+ if (i+1 != gclass->type_argc)
g_string_append (str, ", ");
g_free (t);
}
case MONO_TYPE_GENERICINST: {
GString *str = g_string_new ("");
int i;
- char *generic_type = dis_stringify_type (m, type->data.generic_inst->generic_type);
+ char *generic_type = dis_stringify_type (m, type->data.generic_class->generic_type);
- for (i = 0; i < type->data.generic_inst->type_argc; i++){
- char *t = dis_stringify_type (m, type->data.generic_inst->type_argv [i]);
+ for (i = 0; i < type->data.generic_class->type_argc; i++){
+ char *t = dis_stringify_type (m, type->data.generic_class->type_argv [i]);
g_string_append (str, t);
- if (i+1 != type->data.generic_inst->type_argc)
+ if (i+1 != type->data.generic_class->type_argc)
g_string_append (str, ", ");
g_free (t);
}
+2004-11-30 Martin Baulig <martin@ximian.com>
+
+ Generics API cleanup: renamed MonoGenericInst -> MonoGenericClass.
+
+ * metadata-internals.h (MonoImage): Renamed `generic_inst_cache'
+ to `generic_class_cache'.
+
+ * metadata.c
+ (mono_generic_inst_hash): Renamed to mono_generic_class_hash().
+ (mono_generic_inst_equal): Renamed to mono_generic_class_equal().
+ (mono_generic_inst_is_valuetype): Renamed to
+ mono_generic_class_is_valuetype().
+
+ * class-internals.h
+ (MonoGenericInst): Renamed to MonoGenericClass.
+ (MonoDynamicGenericInst): Renamed to MonoDynamicGenericClass.
+ (MonoClass): Renamed `generic_inst' to `generic_class'.
+ (MonoGenericContext): Renamed `ginst' to `gclass'.
+
+ * object-internals.h
+ (MonoReflectionGenericInst): Renamed to MonoReflectionGenericClass.
+
+ * reflection.c (mono_reflection_generic_inst_initialize): Renamed to
+ mono_reflection_generic_class_initialize().
+
+ * icall.c (icall_entries): "System.Reflection.MonoGenericInst" is
+ now known as "System.Reflection.MonoGenericClass".
+ (monogenericinst_icalls): Renamed to monogenericclass_icalls.
+
2004-11-29 Sebastien Pouliot <sebastien@ximian.com>
* class-internals.h: Added a flag field to MonoClass to cache the
MonoType this_arg;
MonoType byval_arg;
- MonoGenericInst *generic_inst;
+ MonoGenericClass *generic_class;
MonoGenericContainer *generic_container;
void *reflection_info;
/*
* Generic instantiation data type encoding.
*/
-struct _MonoGenericInst {
+struct _MonoGenericClass {
MonoGenericContainer *container;
MonoGenericContext *context;
MonoClass *klass;
int count_ifaces;
MonoType **ifaces;
MonoType *generic_type;
- MonoDynamicGenericInst *dynamic_info;
+ MonoDynamicGenericClass *dynamic_info;
int type_argc;
MonoType **type_argv;
guint is_open : 1;
guint is_dynamic : 1;
};
-struct _MonoDynamicGenericInst {
+struct _MonoDynamicGenericClass {
int count_methods;
MonoMethod **methods;
int count_ctors;
struct _MonoGenericContext {
MonoGenericContainer *container;
- MonoGenericInst *ginst;
+ MonoGenericClass *gclass;
MonoGenericMethod *gmethod;
};
mono_install_lookup_dynamic_token (MonoLookupDynamicToken func);
void
-mono_class_create_generic (MonoGenericInst *ginst);
+mono_class_create_generic (MonoGenericClass *gclass);
void
-mono_class_create_generic_2 (MonoGenericInst *ginst);
+mono_class_create_generic_2 (MonoGenericClass *gclass);
typedef struct {
MonoImage *corlib;
g_string_append (str, klass->name);
if (is_recursed)
break;
- if (klass->generic_inst) {
- MonoGenericInst *ginst = klass->generic_inst;
+ if (klass->generic_class) {
+ MonoGenericClass *gclass = klass->generic_class;
int i;
g_string_append_c (str, '[');
- for (i = 0; i < ginst->type_argc; i++) {
+ for (i = 0; i < gclass->type_argc; i++) {
if (i)
g_string_append_c (str, ',');
mono_type_get_name_recurse (
- ginst->type_argv [i], str, FALSE, include_ns, include_arity);
+ gclass->type_argv [i], str, FALSE, include_ns, include_arity);
}
g_string_append_c (str, ']');
} else if (klass->generic_container) {
return type->data.klass->enum_basetype;
break;
case MONO_TYPE_GENERICINST:
- return mono_type_get_underlying_type (type->data.generic_inst->generic_type);
+ return mono_type_get_underlying_type (type->data.generic_class->generic_type);
default:
break;
}
case MONO_TYPE_PTR:
return mono_class_is_open_constructed_type (t->data.type);
case MONO_TYPE_GENERICINST: {
- MonoGenericInst *ginst = t->data.generic_inst;
+ MonoGenericClass *gclass = t->data.generic_class;
int i;
- if (mono_class_is_open_constructed_type (ginst->generic_type))
+ if (mono_class_is_open_constructed_type (gclass->generic_type))
return TRUE;
- for (i = 0; i < ginst->type_argc; i++)
- if (mono_class_is_open_constructed_type (ginst->type_argv [i]))
+ for (i = 0; i < gclass->type_argc; i++)
+ if (mono_class_is_open_constructed_type (gclass->type_argv [i]))
return TRUE;
return FALSE;
}
else
return NULL;
case MONO_TYPE_VAR:
- if (context->ginst)
+ if (context->gclass)
return dup_type (
- context->ginst->type_argv [type->data.generic_param->num],
+ context->gclass->type_argv [type->data.generic_param->num],
type);
else
return NULL;
return nt;
}
case MONO_TYPE_GENERICINST: {
- MonoGenericInst *oginst = type->data.generic_inst;
- MonoGenericInst *nginst, *cached;
+ MonoGenericClass *ogclass = type->data.generic_class;
+ MonoGenericClass *ngclass, *cached;
MonoType *nt;
int i;
- nginst = g_new0 (MonoGenericInst, 1);
- *nginst = *oginst;
+ ngclass = g_new0 (MonoGenericClass, 1);
+ *ngclass = *ogclass;
- nginst->is_open = FALSE;
+ ngclass->is_open = FALSE;
- nginst->type_argv = g_new0 (MonoType *, oginst->type_argc);
+ ngclass->type_argv = g_new0 (MonoType *, ogclass->type_argc);
- for (i = 0; i < oginst->type_argc; i++) {
- MonoType *t = oginst->type_argv [i];
- nginst->type_argv [i] = mono_class_inflate_generic_type (t, context);
+ for (i = 0; i < ogclass->type_argc; i++) {
+ MonoType *t = ogclass->type_argv [i];
+ ngclass->type_argv [i] = mono_class_inflate_generic_type (t, context);
- if (!nginst->is_open)
- nginst->is_open = mono_class_is_open_constructed_type (nginst->type_argv [i]);
+ if (!ngclass->is_open)
+ ngclass->is_open = mono_class_is_open_constructed_type (ngclass->type_argv [i]);
};
- nginst->klass = NULL;
+ ngclass->klass = NULL;
- nginst->context = g_new0 (MonoGenericContext, 1);
- nginst->context->ginst = nginst;
+ ngclass->context = g_new0 (MonoGenericContext, 1);
+ ngclass->context->gclass = ngclass;
mono_loader_lock ();
- cached = g_hash_table_lookup (oginst->klass->image->generic_inst_cache, nginst);
+ cached = g_hash_table_lookup (ogclass->klass->image->generic_class_cache, ngclass);
if (cached) {
- g_free (nginst->type_argv);
- g_free (nginst);
+ g_free (ngclass->type_argv);
+ g_free (ngclass);
mono_loader_unlock ();
nt = dup_type (type, type);
- nt->data.generic_inst = cached;
+ nt->data.generic_class = cached;
return nt;
}
- nginst->dynamic_info = NULL;
- nginst->initialized = FALSE;
+ ngclass->dynamic_info = NULL;
+ ngclass->initialized = FALSE;
- mono_class_create_generic (nginst);
- mono_class_create_generic_2 (nginst);
+ mono_class_create_generic (ngclass);
+ mono_class_create_generic_2 (ngclass);
mono_stats.generic_instance_count++;
- mono_stats.generics_metadata_size += sizeof (MonoGenericInst) +
+ mono_stats.generics_metadata_size += sizeof (MonoGenericClass) +
sizeof (MonoGenericContext) +
- nginst->type_argc * sizeof (MonoType);
+ ngclass->type_argc * sizeof (MonoType);
nt = dup_type (type, type);
- nt->data.generic_inst = nginst;
- g_hash_table_insert (oginst->klass->image->generic_inst_cache, nginst, nginst);
+ nt->data.generic_class = ngclass;
+ g_hash_table_insert (ogclass->klass->image->generic_class_cache, ngclass, ngclass);
mono_loader_unlock ();
return nt;
}
if (context->gmethod) {
result->context = g_new0 (MonoGenericContext, 1);
result->context->gmethod = context->gmethod;
- result->context->ginst = rklass->generic_inst;
+ result->context->gclass = rklass->generic_class;
mono_stats.generics_metadata_size += sizeof (MonoGenericContext);
- } else if (rklass->generic_inst)
- result->context = rklass->generic_inst->context;
+ } else if (rklass->generic_class)
+ result->context = rklass->generic_class->context;
if (method->signature->is_inflated)
result->declaring = ((MonoMethodInflated *) method)->declaring;
g_assert (*sig == 0x06);
if (class->generic_container)
container = class->generic_container;
- else if (class->generic_inst) {
- g_assert (class->generic_inst->container);
- container = class->generic_inst->container;
+ else if (class->generic_class) {
+ g_assert (class->generic_class->container);
+ container = class->generic_class->container;
}
field->type = mono_metadata_parse_type_full (
m, container, MONO_PARSE_FIELD, cols [MONO_FIELD_FLAGS], sig + 1, &sig);
if (mono_field_is_deleted (field))
continue;
- if (class->generic_inst) {
+ if (class->generic_class) {
field->type = mono_class_inflate_generic_type (
- field->type, class->generic_inst->context);
+ field->type, class->generic_class->context);
field->type->attrs = cols [MONO_FIELD_FLAGS];
}
}
if (class->generic_container ||
- (class->generic_inst && class->generic_inst->is_open))
+ (class->generic_class && class->generic_class->is_open))
return;
mono_class_layout_fields (class);
if (vtable [io + l])
continue;
- if (ic->generic_inst) {
- MonoClass *the_ic = mono_class_from_mono_type (ic->generic_inst->generic_type);
+ if (ic->generic_class) {
+ MonoClass *the_ic = mono_class_from_mono_type (ic->generic_class->generic_type);
the_cname = _mono_type_get_name (&the_ic->byval_arg, TRUE, FALSE, TRUE);
cname = the_cname;
} else {
mono_g_hash_table_destroy (override_map);
}
- if (class->generic_inst) {
- MonoClass *gklass = mono_class_from_mono_type (class->generic_inst->generic_type);
+ if (class->generic_class) {
+ MonoClass *gklass = mono_class_from_mono_type (class->generic_class->generic_type);
mono_class_init (gklass);
class->vtable_size = gklass->vtable_size;
mono_stats.initialized_class_count++;
- if (class->generic_inst && !class->generic_inst->is_dynamic) {
- MonoGenericInst *ginst = class->generic_inst;
+ if (class->generic_class && !class->generic_class->is_dynamic) {
+ MonoGenericClass *gclass = class->generic_class;
MonoClass *gklass;
- gklass = mono_class_from_mono_type (ginst->generic_type);
+ gklass = mono_class_from_mono_type (gclass->generic_type);
mono_class_init (gklass);
if (MONO_CLASS_IS_INTERFACE (class))
for (i = 0; i < class->method.count; i++)
class->methods [i] = mono_class_inflate_generic_method (
- gklass->methods [i], ginst->context, ginst->klass);
+ gklass->methods [i], gclass->context, gclass->klass);
g_assert (class->field.count == gklass->field.count);
class->fields = g_new0 (MonoClassField, class->field.count);
class->fields [i].generic_info = ifield;
class->fields [i].parent = class;
class->fields [i].type = mono_class_inflate_generic_type (
- class->fields [i].type, ginst->context);
+ class->fields [i].type, gclass->context);
}
class->property = gklass->property;
if (prop->get)
prop->get = mono_class_inflate_generic_method (
- prop->get, ginst->context, ginst->klass);
+ prop->get, gclass->context, gclass->klass);
if (prop->set)
prop->set = mono_class_inflate_generic_method (
- prop->set, ginst->context, ginst->klass);
+ prop->set, gclass->context, gclass->klass);
prop->parent = class;
}
class->methods [1] = ctor;
}
} else {
- if (!class->generic_inst && !class->methods) {
+ if (!class->generic_class && !class->methods) {
class->methods = g_new (MonoMethod*, class->method.count);
for (i = 0; i < class->method.count; ++i) {
class->methods [i] = mono_get_method (class->image,
}
}
- if (!class->generic_inst) {
+ if (!class->generic_class) {
init_properties (class);
init_events (class);
if (!parent)
g_assert_not_reached (); /* FIXME */
- if (parent->generic_inst && !parent->name) {
+ if (parent->generic_class && !parent->name) {
/*
* If the parent is a generic instance, we may get
* called before it is fully initialized, especially
}
void
-mono_class_create_generic (MonoGenericInst *ginst)
+mono_class_create_generic (MonoGenericClass *gclass)
{
MonoClass *klass, *gklass;
- if (!ginst->klass)
- ginst->klass = g_malloc0 (sizeof (MonoClass));
- klass = ginst->klass;
+ if (!gclass->klass)
+ gclass->klass = g_malloc0 (sizeof (MonoClass));
+ klass = gclass->klass;
- gklass = mono_class_from_mono_type (ginst->generic_type);
+ gklass = mono_class_from_mono_type (gclass->generic_type);
klass->nested_in = gklass->nested_in;
klass->image = gklass->image;
klass->flags = gklass->flags;
- klass->generic_inst = ginst;
+ klass->generic_class = gclass;
klass->this_arg.type = klass->byval_arg.type = MONO_TYPE_GENERICINST;
- klass->this_arg.data.generic_inst = klass->byval_arg.data.generic_inst = ginst;
+ klass->this_arg.data.generic_class = klass->byval_arg.data.generic_class = gclass;
klass->this_arg.byref = TRUE;
klass->cast_class = klass->element_class = klass;
- if (ginst->is_dynamic) {
+ if (gclass->is_dynamic) {
klass->instance_size = gklass->instance_size;
klass->class_size = gklass->class_size;
klass->size_inited = 1;
}
void
-mono_class_create_generic_2 (MonoGenericInst *ginst)
+mono_class_create_generic_2 (MonoGenericClass *gclass)
{
MonoClass *klass, *gklass;
GList *list;
int i;
- if (ginst->is_dynamic)
+ if (gclass->is_dynamic)
return;
- klass = ginst->klass;
- gklass = mono_class_from_mono_type (ginst->generic_type);
+ klass = gclass->klass;
+ gklass = mono_class_from_mono_type (gclass->generic_type);
klass->method = gklass->method;
klass->field = gklass->field;
klass->interfaces = g_new0 (MonoClass *, klass->interface_count);
for (i = 0; i < klass->interface_count; i++) {
MonoType *it = &gklass->interfaces [i]->byval_arg;
- MonoType *inflated = mono_class_inflate_generic_type (it, ginst->context);
+ MonoType *inflated = mono_class_inflate_generic_type (it, gclass->context);
klass->interfaces [i] = mono_class_from_mono_type (inflated);
}
klass->nested_classes = g_list_append (
klass->nested_classes, list->data);
- if (ginst->parent)
- klass->parent = mono_class_from_mono_type (ginst->parent);
+ if (gclass->parent)
+ klass->parent = mono_class_from_mono_type (gclass->parent);
else if (gklass->parent) {
- MonoType *inflated = mono_class_inflate_generic_type (&gklass->parent->byval_arg, ginst->context);
+ MonoType *inflated = mono_class_inflate_generic_type (&gklass->parent->byval_arg, gclass->context);
klass->parent = mono_class_from_mono_type (inflated);
}
case MONO_TYPE_VALUETYPE:
return type->data.klass;
case MONO_TYPE_GENERICINST:
- g_assert (type->data.generic_inst->klass);
- return type->data.generic_inst->klass;
+ g_assert (type->data.generic_class->klass);
+ return type->data.generic_class->klass;
case MONO_TYPE_VAR:
return my_mono_class_from_generic_parameter (type->data.generic_param, FALSE);
case MONO_TYPE_MVAR:
if (context->gmethod && context->gmethod->container) {
g_assert (context->gmethod->container);
container = context->gmethod->container;
- } else if (context->ginst) {
- g_assert (context->ginst->container);
- container = context->ginst->container;
+ } else if (context->gclass) {
+ g_assert (context->gclass->container);
+ container = context->gclass->container;
} else if (context->container)
container = context->container;
}
class = mono_ptr_class_get (type->data.type);
break;
case MONO_TYPE_GENERICINST:
- g_assert (type->data.generic_inst->klass);
- class = type->data.generic_inst->klass;
+ g_assert (type->data.generic_class->klass);
+ class = type->data.generic_class->klass;
break;
default:
/* it seems any type can be stored in TypeSpec as well */
mono_class_init (klass);
g_assert (!klass->generic_container &&
- (!klass->generic_inst || !klass->generic_inst->is_open));
+ (!klass->generic_class || !klass->generic_class->is_open));
return klass->instance_size;
}
MonoClass *class = _mono_class_get (image, type_token, context);
MonoType *inflated;
- if (!class || !context || (!context->ginst && !context->gmethod))
+ if (!class || !context || (!context->gclass && !context->gmethod))
return class;
switch (class->byval_arg.type) {
case MONO_TYPE_GENERICINST:
- if (!class->generic_inst->is_open)
+ if (!class->generic_class->is_open)
return class;
break;
case MONO_TYPE_VAR:
if (klassc == mono_defaults.object_class)
return TRUE;
- if (klass->generic_inst) {
- MonoType *parent = klass->generic_inst->parent;
+ if (klass->generic_class) {
+ MonoType *parent = klass->generic_class->parent;
if (!parent)
return FALSE;
}
return mono_class_instance_size (klass) - sizeof (MonoObject);
case MONO_TYPE_GENERICINST:
- type = type->data.generic_inst->generic_type;
+ type = type->data.generic_class->generic_type;
goto handle_enum;
default:
g_error ("unknown type 0x%02x in mono_class_array_element_size", type->type);
append_class_name (res, type->data.klass, include_namespace);
break;
case MONO_TYPE_GENERICINST:
- mono_type_get_desc (res, type->data.generic_inst->generic_type, include_namespace);
+ mono_type_get_desc (res, type->data.generic_class->generic_type, include_namespace);
break;
default:
break;
int i;
if (klass->generic_container ||
- (klass->generic_inst && klass->generic_inst->is_open))
+ (klass->generic_class && klass->generic_class->is_open))
return NULL;
info = mono_marshal_load_type_info (klass);
pklass = mono_class_from_generic_parameter (&container->type_params [i], klass->image, FALSE);
mono_array_set (res, gpointer, i, mono_type_get_object (mono_object_domain (type), &pklass->byval_arg));
}
- } else if (klass->generic_inst) {
- MonoGenericInst *inst = klass->generic_inst;
+ } else if (klass->generic_class) {
+ MonoGenericClass *inst = klass->generic_class;
res = mono_array_new (mono_object_domain (type), mono_defaults.monotype_class, inst->type_argc);
for (i = 0; i < inst->type_argc; ++i) {
mono_array_set (res, gpointer, i, mono_type_get_object (mono_object_domain (type), inst->type_argv [i]));
if (klass->generic_container) {
return type; /* check this one */
}
- if (klass->generic_inst) {
- MonoType *generic_type = klass->generic_inst->generic_type;
+ if (klass->generic_class) {
+ MonoType *generic_type = klass->generic_class->generic_type;
MonoClass *generic_class = mono_class_from_mono_type (generic_type);
if (generic_class->wastypebuilder && generic_class->reflection_info)
MONO_ARCH_SAVE_REGS;
klass = mono_class_from_mono_type (type->type);
- return klass->generic_inst != NULL;
+ return klass->generic_class != NULL;
}
static gint32
MONO_ARCH_SAVE_REGS;
klass = mono_class_from_mono_type (type->type);
- if (klass->generic_container || klass->generic_inst)
+ if (klass->generic_container || klass->generic_class)
return TRUE;
return FALSE;
}
}
static MonoReflectionType*
-ves_icall_MonoGenericInst_GetParentType (MonoReflectionGenericInst *type)
+ves_icall_MonoGenericClass_GetParentType (MonoReflectionGenericClass *type)
{
- MonoGenericInst *ginst;
+ MonoGenericClass *gclass;
MonoClass *klass;
MONO_ARCH_SAVE_REGS;
- ginst = type->type.type->data.generic_inst;
- if (!ginst || !ginst->parent || (ginst->parent->type != MONO_TYPE_GENERICINST))
+ gclass = type->type.type->data.generic_class;
+ if (!gclass || !gclass->parent || (gclass->parent->type != MONO_TYPE_GENERICINST))
return NULL;
- klass = mono_class_from_mono_type (ginst->parent);
- if (!klass->generic_inst && !klass->generic_container)
+ klass = mono_class_from_mono_type (gclass->parent);
+ if (!klass->generic_class && !klass->generic_container)
return NULL;
- return mono_type_get_object (mono_object_domain (type), ginst->parent);
+ return mono_type_get_object (mono_object_domain (type), gclass->parent);
}
static MonoArray*
-ves_icall_MonoGenericInst_GetInterfaces (MonoReflectionGenericInst *type)
+ves_icall_MonoGenericClass_GetInterfaces (MonoReflectionGenericClass *type)
{
- static MonoClass *System_Reflection_MonoGenericInst;
- MonoGenericInst *ginst;
+ static MonoClass *System_Reflection_MonoGenericClass;
+ MonoGenericClass *gclass;
MonoDomain *domain;
MonoClass *klass;
MonoArray *res;
MONO_ARCH_SAVE_REGS;
- if (!System_Reflection_MonoGenericInst) {
- System_Reflection_MonoGenericInst = mono_class_from_name (
- mono_defaults.corlib, "System.Reflection", "MonoGenericInst");
- g_assert (System_Reflection_MonoGenericInst);
+ if (!System_Reflection_MonoGenericClass) {
+ System_Reflection_MonoGenericClass = mono_class_from_name (
+ mono_defaults.corlib, "System.Reflection", "MonoGenericClass");
+ g_assert (System_Reflection_MonoGenericClass);
}
domain = mono_object_domain (type);
- ginst = type->type.type->data.generic_inst;
- if (!ginst || !ginst->ifaces)
- return mono_array_new (domain, System_Reflection_MonoGenericInst, 0);
+ gclass = type->type.type->data.generic_class;
+ if (!gclass || !gclass->ifaces)
+ return mono_array_new (domain, System_Reflection_MonoGenericClass, 0);
- klass = mono_class_from_mono_type (ginst->generic_type);
+ klass = mono_class_from_mono_type (gclass->generic_type);
- res = mono_array_new (domain, System_Reflection_MonoGenericInst, ginst->count_ifaces);
+ res = mono_array_new (domain, System_Reflection_MonoGenericClass, gclass->count_ifaces);
- for (i = 0; i < ginst->count_ifaces; i++) {
- MonoReflectionType *iface = mono_type_get_object (domain, ginst->ifaces [i]);
+ for (i = 0; i < gclass->count_ifaces; i++) {
+ MonoReflectionType *iface = mono_type_get_object (domain, gclass->ifaces [i]);
mono_array_set (res, gpointer, i, iface);
}
}
static MonoArray*
-ves_icall_MonoGenericInst_GetMethods (MonoReflectionGenericInst *type,
- MonoReflectionType *reflected_type)
+ves_icall_MonoGenericClass_GetMethods (MonoReflectionGenericClass *type,
+ MonoReflectionType *reflected_type)
{
- MonoGenericInst *ginst;
- MonoDynamicGenericInst *dginst;
+ MonoGenericClass *gclass;
+ MonoDynamicGenericClass *dgclass;
MonoDomain *domain;
MonoClass *refclass;
MonoArray *res;
MONO_ARCH_SAVE_REGS;
- ginst = type->type.type->data.generic_inst;
- g_assert ((dginst = ginst->dynamic_info) != NULL);
+ gclass = type->type.type->data.generic_class;
+ g_assert ((dgclass = gclass->dynamic_info) != NULL);
refclass = mono_class_from_mono_type (reflected_type->type);
domain = mono_object_domain (type);
- res = mono_array_new (domain, mono_defaults.method_info_class, dginst->count_methods);
+ res = mono_array_new (domain, mono_defaults.method_info_class, dgclass->count_methods);
- for (i = 0; i < dginst->count_methods; i++)
+ for (i = 0; i < dgclass->count_methods; i++)
mono_array_set (res, gpointer, i,
- mono_method_get_object (domain, dginst->methods [i], refclass));
+ mono_method_get_object (domain, dgclass->methods [i], refclass));
return res;
}
static MonoArray*
-ves_icall_MonoGenericInst_GetConstructors (MonoReflectionGenericInst *type,
- MonoReflectionType *reflected_type)
+ves_icall_MonoGenericClass_GetConstructors (MonoReflectionGenericClass *type,
+ MonoReflectionType *reflected_type)
{
static MonoClass *System_Reflection_ConstructorInfo;
- MonoGenericInst *ginst;
- MonoDynamicGenericInst *dginst;
+ MonoGenericClass *gclass;
+ MonoDynamicGenericClass *dgclass;
MonoDomain *domain;
MonoClass *refclass;
MonoArray *res;
System_Reflection_ConstructorInfo = mono_class_from_name (
mono_defaults.corlib, "System.Reflection", "ConstructorInfo");
- ginst = type->type.type->data.generic_inst;
- g_assert ((dginst = ginst->dynamic_info) != NULL);
+ gclass = type->type.type->data.generic_class;
+ g_assert ((dgclass = gclass->dynamic_info) != NULL);
refclass = mono_class_from_mono_type (reflected_type->type);
domain = mono_object_domain (type);
- res = mono_array_new (domain, System_Reflection_ConstructorInfo, dginst->count_ctors);
+ res = mono_array_new (domain, System_Reflection_ConstructorInfo, dgclass->count_ctors);
- for (i = 0; i < dginst->count_ctors; i++)
+ for (i = 0; i < dgclass->count_ctors; i++)
mono_array_set (res, gpointer, i,
- mono_method_get_object (domain, dginst->ctors [i], refclass));
+ mono_method_get_object (domain, dgclass->ctors [i], refclass));
return res;
}
static MonoArray*
-ves_icall_MonoGenericInst_GetFields (MonoReflectionGenericInst *type,
- MonoReflectionType *reflected_type)
+ves_icall_MonoGenericClass_GetFields (MonoReflectionGenericClass *type,
+ MonoReflectionType *reflected_type)
{
- MonoGenericInst *ginst;
- MonoDynamicGenericInst *dginst;
+ MonoGenericClass *gclass;
+ MonoDynamicGenericClass *dgclass;
MonoDomain *domain;
MonoClass *refclass;
MonoArray *res;
MONO_ARCH_SAVE_REGS;
- ginst = type->type.type->data.generic_inst;
- g_assert ((dginst = ginst->dynamic_info) != NULL);
+ gclass = type->type.type->data.generic_class;
+ g_assert ((dgclass = gclass->dynamic_info) != NULL);
refclass = mono_class_from_mono_type (reflected_type->type);
domain = mono_object_domain (type);
- res = mono_array_new (domain, mono_defaults.field_info_class, dginst->count_fields);
+ res = mono_array_new (domain, mono_defaults.field_info_class, dgclass->count_fields);
- for (i = 0; i < dginst->count_fields; i++)
+ for (i = 0; i < dgclass->count_fields; i++)
mono_array_set (res, gpointer, i,
- mono_field_get_object (domain, refclass, &dginst->fields [i]));
+ mono_field_get_object (domain, refclass, &dgclass->fields [i]));
return res;
}
static MonoArray*
-ves_icall_MonoGenericInst_GetProperties (MonoReflectionGenericInst *type,
- MonoReflectionType *reflected_type)
+ves_icall_MonoGenericClass_GetProperties (MonoReflectionGenericClass *type,
+ MonoReflectionType *reflected_type)
{
static MonoClass *System_Reflection_PropertyInfo;
- MonoGenericInst *ginst;
- MonoDynamicGenericInst *dginst;
+ MonoGenericClass *gclass;
+ MonoDynamicGenericClass *dgclass;
MonoDomain *domain;
MonoClass *refclass;
MonoArray *res;
System_Reflection_PropertyInfo = mono_class_from_name (
mono_defaults.corlib, "System.Reflection", "PropertyInfo");
- ginst = type->type.type->data.generic_inst;
- g_assert ((dginst = ginst->dynamic_info) != NULL);
+ gclass = type->type.type->data.generic_class;
+ g_assert ((dgclass = gclass->dynamic_info) != NULL);
refclass = mono_class_from_mono_type (reflected_type->type);
domain = mono_object_domain (type);
- res = mono_array_new (domain, System_Reflection_PropertyInfo, dginst->count_properties);
+ res = mono_array_new (domain, System_Reflection_PropertyInfo, dgclass->count_properties);
- for (i = 0; i < dginst->count_properties; i++)
+ for (i = 0; i < dgclass->count_properties; i++)
mono_array_set (res, gpointer, i,
- mono_property_get_object (domain, refclass, &dginst->properties [i]));
+ mono_property_get_object (domain, refclass, &dgclass->properties [i]));
return res;
}
static MonoArray*
-ves_icall_MonoGenericInst_GetEvents (MonoReflectionGenericInst *type,
- MonoReflectionType *reflected_type)
+ves_icall_MonoGenericClass_GetEvents (MonoReflectionGenericClass *type,
+ MonoReflectionType *reflected_type)
{
static MonoClass *System_Reflection_EventInfo;
- MonoGenericInst *ginst;
- MonoDynamicGenericInst *dginst;
+ MonoGenericClass *gclass;
+ MonoDynamicGenericClass *dgclass;
MonoDomain *domain;
MonoClass *refclass;
MonoArray *res;
System_Reflection_EventInfo = mono_class_from_name (
mono_defaults.corlib, "System.Reflection", "EventInfo");
- ginst = type->type.type->data.generic_inst;
- g_assert ((dginst = ginst->dynamic_info) != NULL);
+ gclass = type->type.type->data.generic_class;
+ g_assert ((dgclass = gclass->dynamic_info) != NULL);
refclass = mono_class_from_mono_type (reflected_type->type);
domain = mono_object_domain (type);
- res = mono_array_new (domain, System_Reflection_EventInfo, dginst->count_events);
+ res = mono_array_new (domain, System_Reflection_EventInfo, dgclass->count_events);
- for (i = 0; i < dginst->count_events; i++)
+ for (i = 0; i < dgclass->count_events; i++)
mono_array_set (res, gpointer, i,
- mono_event_get_object (domain, refclass, &dginst->events [i]));
+ mono_event_get_object (domain, refclass, &dgclass->events [i]));
return res;
}
if (method->klass == NULL || (klass = method->klass->parent) == NULL)
return m;
- if (klass->generic_inst)
- klass = mono_class_from_mono_type (klass->generic_inst->generic_type);
+ if (klass->generic_class)
+ klass = mono_class_from_mono_type (klass->generic_class->generic_type);
while (result == NULL && klass != NULL && (klass->vtable_size > method->slot))
{
{"SetValueInternal", ves_icall_FieldInfo_SetValueInternal}
};
-static const IcallEntry monogenericinst_icalls [] = {
- {"GetConstructors_internal", ves_icall_MonoGenericInst_GetConstructors},
- {"GetEvents_internal", ves_icall_MonoGenericInst_GetEvents},
- {"GetFields_internal", ves_icall_MonoGenericInst_GetFields},
- {"GetInterfaces_internal", ves_icall_MonoGenericInst_GetInterfaces},
- {"GetMethods_internal", ves_icall_MonoGenericInst_GetMethods},
- {"GetParentType", ves_icall_MonoGenericInst_GetParentType},
- {"GetProperties_internal", ves_icall_MonoGenericInst_GetProperties},
- {"initialize", mono_reflection_generic_inst_initialize}
+static const IcallEntry monogenericclass_icalls [] = {
+ {"GetConstructors_internal", ves_icall_MonoGenericClass_GetConstructors},
+ {"GetEvents_internal", ves_icall_MonoGenericClass_GetEvents},
+ {"GetFields_internal", ves_icall_MonoGenericClass_GetFields},
+ {"GetInterfaces_internal", ves_icall_MonoGenericClass_GetInterfaces},
+ {"GetMethods_internal", ves_icall_MonoGenericClass_GetMethods},
+ {"GetParentType", ves_icall_MonoGenericClass_GetParentType},
+ {"GetProperties_internal", ves_icall_MonoGenericClass_GetProperties},
+ {"initialize", mono_reflection_generic_class_initialize}
};
static const IcallEntry generictypeparambuilder_icalls [] = {
{"System.Reflection.MonoCMethod", monocmethod_icalls, G_N_ELEMENTS (monocmethod_icalls)},
{"System.Reflection.MonoEventInfo", monoeventinfo_icalls, G_N_ELEMENTS (monoeventinfo_icalls)},
{"System.Reflection.MonoField", monofield_icalls, G_N_ELEMENTS (monofield_icalls)},
- {"System.Reflection.MonoGenericInst", monogenericinst_icalls, G_N_ELEMENTS (monogenericinst_icalls)},
+ {"System.Reflection.MonoGenericClass", monogenericclass_icalls, G_N_ELEMENTS (monogenericclass_icalls)},
{"System.Reflection.MonoMethod", monomethod_icalls, G_N_ELEMENTS (monomethod_icalls)},
{"System.Reflection.MonoMethodInfo", monomethodinfo_icalls, G_N_ELEMENTS (monomethodinfo_icalls)},
{"System.Reflection.MonoPropertyInfo", monopropertyinfo_icalls, G_N_ELEMENTS (monopropertyinfo_icalls)},
image->memberref_signatures = g_hash_table_new (NULL, NULL);
image->helper_signatures = g_hash_table_new (g_str_hash, g_str_equal);
- image->generic_inst_cache =
- g_hash_table_new ((GHashFunc)mono_metadata_generic_inst_hash,
- (GCompareFunc)mono_metadata_generic_inst_equal);
+ image->generic_class_cache =
+ g_hash_table_new ((GHashFunc)mono_metadata_generic_class_hash,
+ (GCompareFunc)mono_metadata_generic_class_equal);
}
static MonoImage *
g_hash_table_destroy (image->remoting_invoke_cache);
g_hash_table_destroy (image->runtime_invoke_cache);
g_hash_table_destroy (image->typespec_cache);
- g_hash_table_destroy (image->generic_inst_cache);
+ g_hash_table_destroy (image->generic_class_cache);
g_hash_table_foreach (image->memberref_signatures, free_mr_signatures, NULL);
g_hash_table_destroy (image->memberref_signatures);
g_hash_table_foreach (image->helper_signatures, free_mr_signatures, NULL);
}
mono_loader_lock ();
- if (!field->parent->generic_inst)
+ if (!field->parent->generic_class)
g_hash_table_insert (image->field_cache, GUINT_TO_POINTER (token), field);
mono_loader_unlock ();
return field;
klass = klass->parent;
}
- if (sclass->generic_inst) {
+ if (sclass->generic_class) {
MonoClass *gclass;
MonoMethod *res;
- gclass = mono_class_from_mono_type (sclass->generic_inst->generic_type);
+ gclass = mono_class_from_mono_type (sclass->generic_class->generic_type);
mono_class_init (gclass);
res = find_method (gclass, ic, name, sig);
return method->signature;
}
- if (method->klass->generic_inst)
+ if (method->klass->generic_class)
return method->signature;
if (image->dynamic)
if (klass->generic_container)
container = klass->generic_container;
- else if (klass->generic_inst) {
- g_assert (klass->generic_inst->container);
- container = klass->generic_inst->container;
+ else if (klass->generic_class) {
+ g_assert (klass->generic_class->container);
+ container = klass->generic_class->container;
}
ptr = mono_metadata_blob_heap (image, cols [MONO_MEMBERREF_SIGNATURE]);
method = find_method (klass, NULL, mname, sig);
if (!method)
g_warning ("Missing method %s in assembly %s typeref index %d", mname, image->name, nindex);
- else if (klass->generic_inst && (klass != method->klass))
+ else if (klass->generic_class && (klass != method->klass))
method = mono_class_inflate_generic_method (
- method, klass->generic_inst->context, klass);
+ method, klass->generic_class->context, klass);
mono_metadata_free_method_signature (sig);
return method;
}
g_assert (container && container->is_method);
if (context) {
- if (context->ginst) {
- g_assert (context->ginst->container);
- container->parent = context->ginst->container;
+ if (context->gclass) {
+ g_assert (context->gclass->container);
+ container->parent = context->gclass->container;
} else
container->parent = context->container;
}
} else {
new_context = g_new0 (MonoGenericContext, 1);
new_context->gmethod = gmethod;
- new_context->ginst = context->ginst;
+ new_context->gclass = context->gclass;
context = new_context;
}
g_hash_table_insert (container->method_hash, gmethod, inflated);
if (new_context)
- context->ginst = inflated->klass->generic_inst;
+ context->gclass = inflated->klass->generic_class;
return inflated;
}
if (table != MONO_TABLE_METHOD) {
MonoGenericContainer *generic_container = NULL;
if (context) {
- if (context->ginst) {
- g_assert (context->ginst->container);
- generic_container = context->ginst->container;
+ if (context->gclass) {
+ g_assert (context->gclass->container);
+ generic_container = context->gclass->container;
} else
generic_container = context->container;
}
for (i = 0; i < method->signature->param_count; ++i)
names [i] = "";
- if (klass->generic_inst) /* copy the names later */
+ if (klass->generic_class) /* copy the names later */
return;
mono_class_init (klass);
MonoClass *klass = method->klass;
MonoTableInfo *methodt;
- if (klass->generic_inst)
+ if (klass->generic_class)
g_assert_not_reached ();
mono_class_init (klass);
GHashTable *helper_signatures;
/*
- * Indexed by MonoGenericInst.
+ * Indexed by MonoGenericClass.
*/
- GHashTable *generic_inst_cache;
+ GHashTable *generic_class_cache;
/*
* Indexes namespaces to hash tables that map class name to typedef token.
}
static void
-do_mono_metadata_parse_generic_inst (MonoType *type, MonoImage *m, MonoGenericContainer *generic_container,
- const char *ptr, const char **rptr)
+do_mono_metadata_parse_generic_class (MonoType *type, MonoImage *m, MonoGenericContainer *generic_container,
+ const char *ptr, const char **rptr)
{
- MonoGenericInst *ginst = g_new0 (MonoGenericInst, 1);
- MonoGenericInst *cached;
+ MonoGenericClass *gclass = g_new0 (MonoGenericClass, 1);
+ MonoGenericClass *cached;
MonoClass *gklass;
int i, count;
- type->data.generic_inst = ginst;
+ type->data.generic_class = gclass;
- ginst->context = g_new0 (MonoGenericContext, 1);
- ginst->context->ginst = ginst;
+ gclass->context = g_new0 (MonoGenericContext, 1);
+ gclass->context->gclass = gclass;
- ginst->klass = g_new0 (MonoClass, 1);
+ gclass->klass = g_new0 (MonoClass, 1);
- ginst->generic_type = mono_metadata_parse_type_full (m, generic_container, MONO_PARSE_TYPE, 0, ptr, &ptr);
- ginst->type_argc = count = mono_metadata_decode_value (ptr, &ptr);
- ginst->type_argv = g_new0 (MonoType*, count);
+ gclass->generic_type = mono_metadata_parse_type_full (m, generic_container, MONO_PARSE_TYPE, 0, ptr, &ptr);
+ gclass->type_argc = count = mono_metadata_decode_value (ptr, &ptr);
+ gclass->type_argv = g_new0 (MonoType*, count);
- gklass = mono_class_from_mono_type (ginst->generic_type);
- g_assert ((ginst->container = gklass->generic_container) != NULL);
+ gklass = mono_class_from_mono_type (gclass->generic_type);
+ g_assert ((gclass->container = gklass->generic_container) != NULL);
/*
* Create the klass before parsing the type arguments.
* See mcs/tests/gen-23.cs for an example.
*/
- ginst->init_pending = TRUE;
+ gclass->init_pending = TRUE;
- mono_class_create_generic (ginst);
+ mono_class_create_generic (gclass);
- for (i = 0; i < ginst->type_argc; i++) {
+ for (i = 0; i < gclass->type_argc; i++) {
MonoType *t = mono_metadata_parse_type_full (m, generic_container, MONO_PARSE_TYPE, 0, ptr, &ptr);
- ginst->type_argv [i] = t;
- if (!ginst->is_open)
- ginst->is_open = mono_class_is_open_constructed_type (t);
+ gclass->type_argv [i] = t;
+ if (!gclass->is_open)
+ gclass->is_open = mono_class_is_open_constructed_type (t);
}
- mono_class_create_generic_2 (ginst);
+ mono_class_create_generic_2 (gclass);
if (rptr)
*rptr = ptr;
* instantiated type. This happens for instance if we're part of a method or
* local variable signature.
*
- * It's important to return the same MonoGenericInst * for each particualar
+ * It's important to return the same MonoGenericClass * for each particualar
* instantiation of a generic type (ie "Stack<Int32>") to make static fields
* work.
*
* type.
*/
- cached = g_hash_table_lookup (m->generic_inst_cache, ginst);
+ cached = g_hash_table_lookup (m->generic_class_cache, gclass);
if (cached) {
- g_free (ginst->klass);
- g_free (ginst->type_argv);
- g_free (ginst);
+ g_free (gclass->klass);
+ g_free (gclass->type_argv);
+ g_free (gclass);
- type->data.generic_inst = cached;
+ type->data.generic_class = cached;
return;
} else {
- g_hash_table_insert (m->generic_inst_cache, ginst, ginst);
+ g_hash_table_insert (m->generic_class_cache, gclass, gclass);
mono_stats.generic_instance_count++;
- mono_stats.generics_metadata_size += sizeof (MonoGenericInst) +
+ mono_stats.generics_metadata_size += sizeof (MonoGenericClass) +
sizeof (MonoGenericContext) +
- ginst->type_argc * sizeof (MonoType);
+ gclass->type_argc * sizeof (MonoType);
}
- ginst->init_pending = FALSE;
+ gclass->init_pending = FALSE;
}
/*
break;
case MONO_TYPE_GENERICINST:
- do_mono_metadata_parse_generic_inst (type, m, generic_container, ptr, &ptr);
+ do_mono_metadata_parse_generic_class (type, m, generic_container, ptr, &ptr);
break;
default:
case MONO_TYPE_TYPEDBYREF:
return mono_class_value_size (mono_defaults.typed_reference_class, align);
case MONO_TYPE_GENERICINST: {
- MonoGenericInst *ginst = t->data.generic_inst;
+ MonoGenericClass *gclass = t->data.generic_class;
- g_assert (!ginst->is_open && !ginst->klass->generic_container);
+ g_assert (!gclass->is_open && !gclass->klass->generic_container);
- if (MONO_TYPE_ISSTRUCT (ginst->generic_type)) {
- MonoClass *gklass = mono_class_from_mono_type (ginst->generic_type);
+ if (MONO_TYPE_ISSTRUCT (gclass->generic_type)) {
+ MonoClass *gklass = mono_class_from_mono_type (gclass->generic_type);
if (gklass->enumtype)
return mono_type_size (gklass->enum_basetype, align);
else
- return mono_class_value_size (ginst->klass, align);
+ return mono_class_value_size (gclass->klass, align);
} else {
*align = __alignof__(gpointer);
return sizeof (gpointer);
}
}
case MONO_TYPE_GENERICINST: {
- MonoGenericInst *ginst = t->data.generic_inst;
+ MonoGenericClass *gclass = t->data.generic_class;
- g_assert (!ginst->is_open && !ginst->klass->generic_container);
+ g_assert (!gclass->is_open && !gclass->klass->generic_container);
- if (MONO_TYPE_ISSTRUCT (ginst->generic_type)) {
- MonoClass *gklass = mono_class_from_mono_type (ginst->generic_type);
+ if (MONO_TYPE_ISSTRUCT (gclass->generic_type)) {
+ MonoClass *gklass = mono_class_from_mono_type (gclass->generic_type);
if (gklass->enumtype)
return mono_type_stack_size (gklass->enum_basetype, align);
else {
- guint32 size = mono_class_value_size (ginst->klass, align);
+ guint32 size = mono_class_value_size (gclass->klass, align);
*align = *align + __alignof__(gpointer) - 1;
*align &= ~(__alignof__(gpointer) - 1);
}
gboolean
-mono_metadata_generic_inst_is_valuetype (MonoGenericInst *ginst)
+mono_metadata_generic_class_is_valuetype (MonoGenericClass *gclass)
{
- return MONO_TYPE_ISSTRUCT (ginst->generic_type);
+ return MONO_TYPE_ISSTRUCT (gclass->generic_type);
}
guint
-mono_metadata_generic_inst_hash (MonoGenericInst *ginst)
+mono_metadata_generic_class_hash (MonoGenericClass *gclass)
{
- return mono_metadata_type_hash (ginst->generic_type);
+ return mono_metadata_type_hash (gclass->generic_type);
}
static gboolean
-_mono_metadata_generic_inst_equal (MonoGenericInst *g1, MonoGenericInst *g2, gboolean signature_only)
+_mono_metadata_generic_class_equal (MonoGenericClass *g1, MonoGenericClass *g2, gboolean signature_only)
{
int i;
}
gboolean
-mono_metadata_generic_inst_equal (MonoGenericInst *g1, MonoGenericInst *g2)
+mono_metadata_generic_class_equal (MonoGenericClass *g1, MonoGenericClass *g2)
{
- return _mono_metadata_generic_inst_equal (g1, g2, FALSE);
+ return _mono_metadata_generic_class_equal (g1, g2, FALSE);
}
guint
case MONO_TYPE_ARRAY:
return ((hash << 5) - hash) ^ mono_metadata_type_hash (&t1->data.array->eklass->byval_arg);
case MONO_TYPE_GENERICINST:
- return ((hash << 5) - hash) ^ mono_metadata_generic_inst_hash (t1->data.generic_inst);
+ return ((hash << 5) - hash) ^ mono_metadata_generic_class_hash (t1->data.generic_class);
}
return hash;
}
{
if (c1 == c2)
return TRUE;
- if (c1->generic_inst && c2->generic_inst)
- return _mono_metadata_generic_inst_equal (c1->generic_inst, c2->generic_inst, signature_only);
+ if (c1->generic_class && c2->generic_class)
+ return _mono_metadata_generic_class_equal (c1->generic_class, c2->generic_class, signature_only);
if ((c1->byval_arg.type == MONO_TYPE_VAR) && (c2->byval_arg.type == MONO_TYPE_VAR))
return mono_metadata_generic_param_equal (
c1->byval_arg.data.generic_param, c2->byval_arg.data.generic_param, FALSE);
return FALSE;
return mono_metadata_class_equal (t1->data.array->eklass, t2->data.array->eklass, signature_only);
case MONO_TYPE_GENERICINST:
- return _mono_metadata_generic_inst_equal (
- t1->data.generic_inst, t2->data.generic_inst, signature_only);
+ return _mono_metadata_generic_class_equal (
+ t1->data.generic_class, t2->data.generic_class, signature_only);
case MONO_TYPE_VAR:
return mono_metadata_generic_param_equal (
t1->data.generic_param, t2->data.generic_param, FALSE);
#define MONO_ZERO_LEN_ARRAY 1
#endif
-#define MONO_TYPE_ISSTRUCT(t) (!(t)->byref && (((t)->type == MONO_TYPE_VALUETYPE && !(t)->data.klass->enumtype) || ((t)->type == MONO_TYPE_TYPEDBYREF) || (((t)->type == MONO_TYPE_GENERICINST) && mono_metadata_generic_inst_is_valuetype ((t)->data.generic_inst))))
+#define MONO_TYPE_ISSTRUCT(t) (!(t)->byref && (((t)->type == MONO_TYPE_VALUETYPE && !(t)->data.klass->enumtype) || ((t)->type == MONO_TYPE_TYPEDBYREF) || (((t)->type == MONO_TYPE_GENERICINST) && mono_metadata_generic_class_is_valuetype ((t)->data.generic_class))))
#define MONO_TYPE_IS_VOID(t) ((t) && ((t)->type == MONO_TYPE_VOID) && !(t)->byref)
#define MONO_TYPE_IS_POINTER(t) ((t) && (((t)->byref || ((t)->type == MONO_TYPE_I) || (t)->type == MONO_TYPE_STRING) || ((t)->type == MONO_TYPE_SZARRAY) || ((t)->type == MONO_TYPE_CLASS) || ((t)->type == MONO_TYPE_CLASS) || ((t)->type == MONO_TYPE_OBJECT) || ((t)->type == MONO_TYPE_ARRAY) || ((t)->type == MONO_TYPE_PTR)))
((t)->type == MONO_TYPE_OBJECT) || \
((t)->type == MONO_TYPE_ARRAY)) || \
(((t)->type == MONO_TYPE_GENERICINST) && \
- !mono_metadata_generic_inst_is_valuetype ((t)->data.generic_inst))))
+ !mono_metadata_generic_class_is_valuetype ((t)->data.generic_class))))
#define MONO_CLASS_IS_INTERFACE(c) ((c->flags & TYPE_ATTRIBUTE_INTERFACE) || (c->byval_arg.type == MONO_TYPE_VAR) || (c->byval_arg.type == MONO_TYPE_MVAR))
} MonoExceptionClause;
typedef struct _MonoType MonoType;
-typedef struct _MonoGenericInst MonoGenericInst;
-typedef struct _MonoDynamicGenericInst MonoDynamicGenericInst;
+typedef struct _MonoGenericClass MonoGenericClass;
+typedef struct _MonoDynamicGenericClass MonoDynamicGenericClass;
typedef struct _MonoGenericMethod MonoGenericMethod;
typedef struct _MonoGenericContext MonoGenericContext;
typedef struct _MonoGenericContainer MonoGenericContainer;
MonoArrayType *array; /* for ARRAY */
MonoMethodSignature *method;
MonoGenericParam *generic_param; /* for VAR and MVAR */
- MonoGenericInst *generic_inst; /* for GENERICINST */
+ MonoGenericClass *generic_class; /* for GENERICINST */
} data;
unsigned int attrs : 16; /* param attributes or field flags */
unsigned int type : 8; /* ElementTypeEnum */
int mono_type_stack_size (MonoType *type,
int *alignment);
-gboolean mono_metadata_generic_inst_is_valuetype (MonoGenericInst *ginst);
-guint mono_metadata_generic_inst_hash (MonoGenericInst *ginst);
-gboolean mono_metadata_generic_inst_equal (MonoGenericInst *g1, MonoGenericInst *g2);
+gboolean mono_metadata_generic_class_is_valuetype (MonoGenericClass *gclass);
+guint mono_metadata_generic_class_hash (MonoGenericClass *gclass);
+gboolean mono_metadata_generic_class_equal (MonoGenericClass *g1, MonoGenericClass *g2);
guint mono_metadata_type_hash (MonoType *t1);
gboolean mono_metadata_type_equal (MonoType *t1, MonoType *t2);
guint32 attrs;
} MonoReflectionGenericParam;
-typedef struct _MonoReflectionGenericInst MonoReflectionGenericInst;
-struct _MonoReflectionGenericInst {
+typedef struct _MonoReflectionGenericClass MonoReflectionGenericClass;
+struct _MonoReflectionGenericClass {
MonoReflectionType type;
MonoReflectionType *generic_type;
guint32 initialized;
MonoReflectionMethod*
mono_reflection_bind_generic_method_parameters (MonoReflectionMethod *method, MonoArray *types);
void
-mono_reflection_generic_inst_initialize (MonoReflectionGenericInst *type, MonoArray *methods, MonoArray *ctors, MonoArray *fields, MonoArray *properties, MonoArray *events);
+mono_reflection_generic_class_initialize (MonoReflectionGenericClass *type, MonoArray *methods, MonoArray *ctors, MonoArray *fields, MonoArray *properties, MonoArray *events);
MonoReflectionEvent *
mono_reflection_event_builder_get_event_info (MonoReflectionTypeBuilder *tb, MonoReflectionEventBuilder *eb);
}
static void
-encode_generic_inst (MonoDynamicImage *assembly, MonoGenericInst *ginst, char *p, char **endbuf)
+encode_generic_class (MonoDynamicImage *assembly, MonoGenericClass *gclass, char *p, char **endbuf)
{
int i;
- if (!ginst) {
+ if (!gclass) {
g_assert_not_reached ();
return;
}
mono_metadata_encode_value (MONO_TYPE_GENERICINST, p, &p);
- encode_type (assembly, ginst->generic_type, p, &p);
- mono_metadata_encode_value (ginst->type_argc, p, &p);
- for (i = 0; i < ginst->type_argc; ++i)
- encode_type (assembly, ginst->type_argv [i], p, &p);
+ encode_type (assembly, gclass->generic_type, p, &p);
+ mono_metadata_encode_value (gclass->type_argc, p, &p);
+ for (i = 0; i < gclass->type_argc; ++i)
+ encode_type (assembly, gclass->type_argv [i], p, &p);
*endbuf = p;
}
mono_metadata_encode_value (0, p, &p);
break;
case MONO_TYPE_GENERICINST:
- encode_generic_inst (assembly, type->data.generic_inst, p, &p);
+ encode_generic_class (assembly, type->data.generic_class, p, &p);
break;
case MONO_TYPE_VAR:
case MONO_TYPE_MVAR:
}
static guint32
-generic_inst_get_signature_size (MonoGenericInst *ginst)
+generic_class_get_signature_size (MonoGenericClass *gclass)
{
guint32 size = 0;
int i;
- if (!ginst) {
+ if (!gclass) {
g_assert_not_reached ();
}
- size += 1 + type_get_signature_size (ginst->generic_type);
+ size += 1 + type_get_signature_size (gclass->generic_type);
size += 4;
- for (i = 0; i < ginst->type_argc; ++i)
- size += type_get_signature_size (ginst->type_argv [i]);
+ for (i = 0; i < gclass->type_argc; ++i)
+ size += type_get_signature_size (gclass->type_argv [i]);
return size;
}
case MONO_TYPE_ARRAY:
return size + 7 + type_get_signature_size (&type->data.array->eklass->byval_arg);
case MONO_TYPE_GENERICINST:
- return size + generic_inst_get_signature_size (type->data.generic_inst);
+ return size + generic_class_get_signature_size (type->data.generic_class);
case MONO_TYPE_VAR:
case MONO_TYPE_MVAR:
return size + 5;
case MONO_TYPE_CLASS:
case MONO_TYPE_VALUETYPE: {
MonoClass *k = mono_class_from_mono_type (type);
- if (!k || !k->generic_inst)
+ if (!k || !k->generic_class)
return 0;
- encode_generic_inst (assembly, k->generic_inst, p, &p);
+ encode_generic_class (assembly, k->generic_class, p, &p);
break;
}
default:
} else if (!strcmp (iltoken->member->vtable->klass->name, "MonoMethod") ||
!strcmp (iltoken->member->vtable->klass->name, "MonoCMethod")) {
MonoMethod *m = ((MonoReflectionMethod*)iltoken->member)->method;
- g_assert (m->klass->generic_inst);
+ g_assert (m->klass->generic_class);
continue;
} else if (!strcmp (iltoken->member->vtable->klass->name, "FieldBuilder")) {
continue;
MonoReflectionType *tb = (MonoReflectionType *)obj;
token = mono_metadata_token_from_dor (
mono_image_typedef_or_ref (assembly, tb->type));
- } else if (strcmp (klass->name, "MonoGenericInst") == 0) {
+ } else if (strcmp (klass->name, "MonoGenericClass") == 0) {
MonoReflectionType *tb = (MonoReflectionType *)obj;
token = mono_metadata_token_from_dor (
mono_image_typedef_or_ref (assembly, tb->type));
else
token = mono_image_get_inflated_method_token (assembly, m->method);
} else if ((m->method->klass->image == &assembly->image) &&
- !m->method->klass->generic_inst) {
+ !m->method->klass->generic_class) {
static guint32 method_table_idx = 0xffffff;
if (m->method->klass->wastypebuilder) {
/* we use the same token as the one that was assigned
return t1->data.array->eklass == t2->data.array->eklass;
case MONO_TYPE_GENERICINST: {
int i;
- if (t1->data.generic_inst->type_argc != t2->data.generic_inst->type_argc)
+ if (t1->data.generic_class->type_argc != t2->data.generic_class->type_argc)
return FALSE;
- if (!mono_metadata_type_equal (t1->data.generic_inst->generic_type, t2->data.generic_inst->generic_type))
+ if (!mono_metadata_type_equal (t1->data.generic_class->generic_type, t2->data.generic_class->generic_type))
return FALSE;
- for (i = 0; i < t1->data.generic_inst->type_argc; ++i) {
- if (!mono_metadata_type_equal (t1->data.generic_inst->type_argv [i], t2->data.generic_inst->type_argv [i]))
+ for (i = 0; i < t1->data.generic_class->type_argc; ++i) {
+ if (!mono_metadata_type_equal (t1->data.generic_class->type_argv [i], t2->data.generic_class->type_argv [i]))
return FALSE;
}
return TRUE;
return hash;
}
-static MonoReflectionGenericInst*
-mono_generic_inst_get_object (MonoDomain *domain, MonoType *geninst)
+static MonoReflectionGenericClass*
+mono_generic_class_get_object (MonoDomain *domain, MonoType *geninst)
{
- static MonoClass *System_Reflection_MonoGenericInst;
- MonoReflectionGenericInst *res;
- MonoGenericInst *ginst;
+ static MonoClass *System_Reflection_MonoGenericClass;
+ MonoReflectionGenericClass *res;
+ MonoGenericClass *gclass;
MonoClass *gklass;
- if (!System_Reflection_MonoGenericInst) {
- System_Reflection_MonoGenericInst = mono_class_from_name (
- mono_defaults.corlib, "System.Reflection", "MonoGenericInst");
- g_assert (System_Reflection_MonoGenericInst);
+ if (!System_Reflection_MonoGenericClass) {
+ System_Reflection_MonoGenericClass = mono_class_from_name (
+ mono_defaults.corlib, "System.Reflection", "MonoGenericClass");
+ g_assert (System_Reflection_MonoGenericClass);
}
- ginst = geninst->data.generic_inst;
- gklass = mono_class_from_mono_type (ginst->generic_type);
+ gclass = geninst->data.generic_class;
+ gklass = mono_class_from_mono_type (gclass->generic_type);
- mono_class_init (ginst->klass);
+ mono_class_init (gclass->klass);
- res = (MonoReflectionGenericInst *) mono_object_new (domain, System_Reflection_MonoGenericInst);
+ res = (MonoReflectionGenericClass *) mono_object_new (domain, System_Reflection_MonoGenericClass);
res->type.type = geninst;
if (gklass->wastypebuilder && gklass->reflection_info)
res->generic_type = gklass->reflection_info;
else
- res->generic_type = mono_type_get_object (domain, ginst->generic_type);
+ res->generic_type = mono_type_get_object (domain, gclass->generic_type);
return res;
}
mono_domain_unlock (domain);
return res;
}
- if ((type->type == MONO_TYPE_GENERICINST) && type->data.generic_inst->is_dynamic) {
- res = (MonoReflectionType *)mono_generic_inst_get_object (domain, type);
+ if ((type->type == MONO_TYPE_GENERICINST) && type->data.generic_class->is_dynamic) {
+ res = (MonoReflectionType *)mono_generic_class_get_object (domain, type);
mono_g_hash_table_insert (domain->type_hash, type, res);
mono_domain_unlock (domain);
return res;
if (!methodsig->param_count)
return;
- if (klass->generic_inst) {
+ if (klass->generic_class) {
return; /* FIXME - ??? */
}
g_assert_not_reached ();
} else if (m->method->signature->generic_param_count) {
g_assert_not_reached ();
- } else if (m->method->klass->generic_inst) {
+ } else if (m->method->klass->generic_class) {
g_assert_not_reached ();
} else {
token = m->method->token;
method_index = find_method_index (method);
ca = &image->tables [MONO_TABLE_METHOD];
- if (method->klass->generic_inst || method->klass->generic_container ||
+ if (method->klass->generic_class || method->klass->generic_container ||
method->signature->generic_param_count) {
/* FIXME FIXME FIXME */
return NULL;
{
MonoClass *klass, *gklass;
MonoReflectionTypeBuilder *tb = NULL;
- MonoGenericInst *ginst, *cached;
+ MonoGenericClass *gclass, *cached;
MonoDomain *domain;
MonoType *geninst;
int icount, i;
klass = mono_class_from_mono_type (type->type);
- if (!klass->generic_container && !klass->generic_inst &&
+ if (!klass->generic_container && !klass->generic_class &&
!(klass->nested_in && klass->nested_in->generic_container))
return NULL;
domain = mono_object_domain (type);
- ginst = g_new0 (MonoGenericInst, 1);
+ gclass = g_new0 (MonoGenericClass, 1);
- ginst->type_argc = type_argc;
- ginst->type_argv = types;
+ gclass->type_argc = type_argc;
+ gclass->type_argv = types;
- for (i = 0; i < ginst->type_argc; ++i) {
- if (!ginst->is_open)
- ginst->is_open = mono_class_is_open_constructed_type (types [i]);
+ for (i = 0; i < gclass->type_argc; ++i) {
+ if (!gclass->is_open)
+ gclass->is_open = mono_class_is_open_constructed_type (types [i]);
}
- ginst->generic_type = &klass->byval_arg;
+ gclass->generic_type = &klass->byval_arg;
- if (klass->generic_inst) {
- MonoGenericInst *kginst = klass->generic_inst;
- MonoGenericInst *oginst = ginst;
+ if (klass->generic_class) {
+ MonoGenericClass *kgclass = klass->generic_class;
+ MonoGenericClass *ogclass = gclass;
- oginst->context = g_new0 (MonoGenericContext, 1);
- oginst->context->ginst = oginst;
+ ogclass->context = g_new0 (MonoGenericContext, 1);
+ ogclass->context->gclass = ogclass;
- ginst = g_new0 (MonoGenericInst, 1);
+ gclass = g_new0 (MonoGenericClass, 1);
- ginst->type_argc = kginst->type_argc;
- ginst->type_argv = g_new0 (MonoType *, ginst->type_argc);
+ gclass->type_argc = kgclass->type_argc;
+ gclass->type_argv = g_new0 (MonoType *, gclass->type_argc);
- for (i = 0; i < ginst->type_argc; i++) {
- MonoType *t = kginst->type_argv [i];
+ for (i = 0; i < gclass->type_argc; i++) {
+ MonoType *t = kgclass->type_argv [i];
- t = mono_class_inflate_generic_type (t, oginst->context);
+ t = mono_class_inflate_generic_type (t, ogclass->context);
- if (!ginst->is_open)
- ginst->is_open = mono_class_is_open_constructed_type (t);
+ if (!gclass->is_open)
+ gclass->is_open = mono_class_is_open_constructed_type (t);
- ginst->type_argv [i] = t;
+ gclass->type_argv [i] = t;
}
- ginst->generic_type = kginst->generic_type;
+ gclass->generic_type = kgclass->generic_type;
}
geninst = g_new0 (MonoType, 1);
geninst->type = MONO_TYPE_GENERICINST;
- cached = g_hash_table_lookup (klass->image->generic_inst_cache, ginst);
+ cached = g_hash_table_lookup (klass->image->generic_class_cache, gclass);
if (cached) {
- g_free (ginst);
+ g_free (gclass);
mono_loader_unlock ();
- geninst->data.generic_inst = cached;
+ geninst->data.generic_class = cached;
return geninst;
}
- gklass = mono_class_from_mono_type (ginst->generic_type);
- g_assert ((ginst->container = gklass->generic_container) != NULL);
+ gklass = mono_class_from_mono_type (gclass->generic_type);
+ g_assert ((gclass->container = gklass->generic_container) != NULL);
- geninst->data.generic_inst = ginst;
+ geninst->data.generic_class = gclass;
- ginst->parent = parent;
+ gclass->parent = parent;
- ginst->context = g_new0 (MonoGenericContext, 1);
- ginst->context->ginst = ginst;
+ gclass->context = g_new0 (MonoGenericContext, 1);
+ gclass->context->gclass = gclass;
if (!strcmp (((MonoObject *) type)->vtable->klass->name, "TypeBuilder")) {
tb = (MonoReflectionTypeBuilder *) type;
icount = tb->interfaces ? mono_array_length (tb->interfaces) : 0;
- ginst->is_dynamic = TRUE;
- } else if (!strcmp (((MonoObject *) type)->vtable->klass->name, "MonoGenericInst")) {
- MonoReflectionGenericInst *rgi = (MonoReflectionGenericInst *) type;
+ gclass->is_dynamic = TRUE;
+ } else if (!strcmp (((MonoObject *) type)->vtable->klass->name, "MonoGenericClass")) {
+ MonoReflectionGenericClass *rgi = (MonoReflectionGenericClass *) type;
MonoReflectionType *rgt = rgi->generic_type;
g_assert (!strcmp (((MonoObject *) rgt)->vtable->klass->name, "TypeBuilder"));
tb = (MonoReflectionTypeBuilder *) rgt;
icount = tb->interfaces ? mono_array_length (tb->interfaces) : 0;
- ginst->is_dynamic = TRUE;
+ gclass->is_dynamic = TRUE;
} else {
icount = klass->interface_count;
}
- ginst->ifaces = g_new0 (MonoType *, icount);
- ginst->count_ifaces = icount;
+ gclass->ifaces = g_new0 (MonoType *, icount);
+ gclass->count_ifaces = icount;
for (i = 0; i < icount; i++) {
MonoReflectionType *itype;
itype = mono_array_get (tb->interfaces, MonoReflectionType *, i);
else
itype = mono_type_get_object (domain, &klass->interfaces [i]->byval_arg);
- ginst->ifaces [i] = mono_reflection_bind_generic_parameters (itype, type_argc, types);
- if (!ginst->ifaces [i])
- ginst->ifaces [i] = itype->type;
+ gclass->ifaces [i] = mono_reflection_bind_generic_parameters (itype, type_argc, types);
+ if (!gclass->ifaces [i])
+ gclass->ifaces [i] = itype->type;
}
- mono_class_create_generic (ginst);
- mono_class_create_generic_2 (ginst);
+ mono_class_create_generic (gclass);
+ mono_class_create_generic_2 (gclass);
- g_hash_table_insert (klass->image->generic_inst_cache, ginst, ginst);
+ g_hash_table_insert (klass->image->generic_class_cache, gclass, gclass);
mono_loader_unlock ();
MonoReflectionType *parent = NULL;
MonoType *the_parent = NULL, *geninst;
MonoReflectionTypeBuilder *tb = NULL;
- MonoGenericInst *ginst;
+ MonoGenericClass *gclass;
MonoDomain *domain;
domain = mono_object_domain (type);
pklass = klass->parent;
if (pklass)
parent = mono_type_get_object (domain, &pklass->byval_arg);
- else if (klass->generic_inst && klass->generic_inst->parent) {
- parent = mono_type_get_object (domain, klass->generic_inst->parent);
- pklass = mono_class_from_mono_type (klass->generic_inst->parent);
+ else if (klass->generic_class && klass->generic_class->parent) {
+ parent = mono_type_get_object (domain, klass->generic_class->parent);
+ pklass = mono_class_from_mono_type (klass->generic_class->parent);
}
}
- if (pklass && pklass->generic_inst)
+ if (pklass && pklass->generic_class)
the_parent = mono_reflection_bind_generic_parameters (parent, type_argc, types);
geninst = do_mono_reflection_bind_generic_parameters (type, type_argc, types, the_parent);
if (!geninst)
return NULL;
- ginst = geninst->data.generic_inst;
+ gclass = geninst->data.generic_class;
return geninst;
}
gmethod->reflection_info = rmethod;
context = g_new0 (MonoGenericContext, 1);
- context->ginst = method->klass->generic_inst;
+ context->gclass = method->klass->generic_class;
context->gmethod = gmethod;
inflated = mono_class_inflate_generic_method (method, context, NULL);
}
static MonoMethod *
-inflate_mono_method (MonoReflectionGenericInst *type, MonoMethod *method, MonoObject *obj)
+inflate_mono_method (MonoReflectionGenericClass *type, MonoMethod *method, MonoObject *obj)
{
MonoGenericMethod *gmethod;
- MonoGenericInst *ginst;
+ MonoGenericClass *gclass;
MonoGenericContext *context;
int i;
- ginst = type->type.type->data.generic_inst;
+ gclass = type->type.type->data.generic_class;
gmethod = g_new0 (MonoGenericMethod, 1);
gmethod->reflection_info = obj;
}
context = g_new0 (MonoGenericContext, 1);
- context->ginst = ginst;
+ context->gclass = gclass;
context->gmethod = gmethod;
- return mono_class_inflate_generic_method (method, context, ginst->klass);
+ return mono_class_inflate_generic_method (method, context, gclass->klass);
}
static MonoMethod *
-inflate_method (MonoReflectionGenericInst *type, MonoObject *obj)
+inflate_method (MonoReflectionGenericClass *type, MonoObject *obj)
{
MonoMethod *method;
MonoClass *klass;
}
void
-mono_reflection_generic_inst_initialize (MonoReflectionGenericInst *type, MonoArray *methods,
- MonoArray *ctors, MonoArray *fields, MonoArray *properties, MonoArray *events)
+mono_reflection_generic_class_initialize (MonoReflectionGenericClass *type, MonoArray *methods,
+ MonoArray *ctors, MonoArray *fields, MonoArray *properties,
+ MonoArray *events)
{
- MonoGenericInst *ginst;
- MonoDynamicGenericInst *dginst;
+ MonoGenericClass *gclass;
+ MonoDynamicGenericClass *dgclass;
MonoClass *klass, *gklass, *pklass;
int i;
MONO_ARCH_SAVE_REGS;
klass = mono_class_from_mono_type (type->type.type);
- ginst = type->type.type->data.generic_inst;
+ gclass = type->type.type->data.generic_class;
- if (ginst->initialized)
+ if (gclass->initialized)
return;
- dginst = ginst->dynamic_info = g_new0 (MonoDynamicGenericInst, 1);
+ dgclass = gclass->dynamic_info = g_new0 (MonoDynamicGenericClass, 1);
- gklass = mono_class_from_mono_type (ginst->generic_type);
+ gklass = mono_class_from_mono_type (gclass->generic_type);
mono_class_init (gklass);
- if (ginst->parent)
- pklass = mono_class_from_mono_type (ginst->parent);
+ if (gclass->parent)
+ pklass = mono_class_from_mono_type (gclass->parent);
else
pklass = gklass->parent;
mono_class_setup_parent (klass, pklass);
- dginst->count_methods = methods ? mono_array_length (methods) : 0;
- dginst->count_ctors = ctors ? mono_array_length (ctors) : 0;
- dginst->count_fields = fields ? mono_array_length (fields) : 0;
- dginst->count_properties = properties ? mono_array_length (properties) : 0;
- dginst->count_events = events ? mono_array_length (events) : 0;
+ dgclass->count_methods = methods ? mono_array_length (methods) : 0;
+ dgclass->count_ctors = ctors ? mono_array_length (ctors) : 0;
+ dgclass->count_fields = fields ? mono_array_length (fields) : 0;
+ dgclass->count_properties = properties ? mono_array_length (properties) : 0;
+ dgclass->count_events = events ? mono_array_length (events) : 0;
- dginst->methods = g_new0 (MonoMethod *, dginst->count_methods);
- dginst->ctors = g_new0 (MonoMethod *, dginst->count_ctors);
- dginst->fields = g_new0 (MonoClassField, dginst->count_fields);
- dginst->properties = g_new0 (MonoProperty, dginst->count_properties);
- dginst->events = g_new0 (MonoEvent, dginst->count_events);
+ dgclass->methods = g_new0 (MonoMethod *, dgclass->count_methods);
+ dgclass->ctors = g_new0 (MonoMethod *, dgclass->count_ctors);
+ dgclass->fields = g_new0 (MonoClassField, dgclass->count_fields);
+ dgclass->properties = g_new0 (MonoProperty, dgclass->count_properties);
+ dgclass->events = g_new0 (MonoEvent, dgclass->count_events);
- for (i = 0; i < dginst->count_methods; i++) {
+ for (i = 0; i < dgclass->count_methods; i++) {
MonoObject *obj = mono_array_get (methods, gpointer, i);
- dginst->methods [i] = inflate_method (type, obj);
+ dgclass->methods [i] = inflate_method (type, obj);
}
- for (i = 0; i < dginst->count_ctors; i++) {
+ for (i = 0; i < dgclass->count_ctors; i++) {
MonoObject *obj = mono_array_get (ctors, gpointer, i);
- dginst->ctors [i] = inflate_method (type, obj);
+ dgclass->ctors [i] = inflate_method (type, obj);
}
- for (i = 0; i < dginst->count_fields; i++) {
+ for (i = 0; i < dgclass->count_fields; i++) {
MonoObject *obj = mono_array_get (fields, gpointer, i);
MonoClassField *field;
MonoInflatedField *ifield;
ifield->generic_type = field->type;
ifield->reflection_info = obj;
- dginst->fields [i] = *field;
- dginst->fields [i].generic_info = ifield;
- dginst->fields [i].type = mono_class_inflate_generic_type (field->type, ginst->context);
+ dgclass->fields [i] = *field;
+ dgclass->fields [i].generic_info = ifield;
+ dgclass->fields [i].type = mono_class_inflate_generic_type (field->type, gclass->context);
}
- for (i = 0; i < dginst->count_properties; i++) {
+ for (i = 0; i < dgclass->count_properties; i++) {
MonoObject *obj = mono_array_get (properties, gpointer, i);
- MonoProperty *property = &dginst->properties [i];
+ MonoProperty *property = &dgclass->properties [i];
if (!strcmp (obj->vtable->klass->name, "PropertyBuilder")) {
MonoReflectionPropertyBuilder *pb = (MonoReflectionPropertyBuilder *) obj;
g_assert_not_reached ();
}
- for (i = 0; i < dginst->count_events; i++) {
+ for (i = 0; i < dgclass->count_events; i++) {
MonoObject *obj = mono_array_get (events, gpointer, i);
- MonoEvent *event = &dginst->events [i];
+ MonoEvent *event = &dgclass->events [i];
if (!strcmp (obj->vtable->klass->name, "EventBuilder")) {
MonoReflectionEventBuilder *eb = (MonoReflectionEventBuilder *) obj;
g_assert_not_reached ();
}
- ginst->initialized = TRUE;
+ gclass->initialized = TRUE;
}
static void
case MONO_TYPE_TYPEDBYREF:
return CEE_LDOBJ;
case MONO_TYPE_GENERICINST:
- type = type->data.generic_inst->generic_type;
+ type = type->data.generic_class->generic_type;
goto handle_enum;
default:
g_error ("unknown type 0x%02x in type_to_ldind", type->type);
case MONO_TYPE_TYPEDBYREF:
return CEE_STOBJ;
case MONO_TYPE_GENERICINST:
- type = type->data.generic_inst->generic_type;
+ type = type->data.generic_class->generic_type;
goto handle_enum;
default:
g_error ("unknown type 0x%02x in type_to_stind", type->type);
inst->type = STACK_VTYPE;
return;
case MONO_TYPE_GENERICINST:
- type = type->data.generic_inst->generic_type;
+ type = type->data.generic_class->generic_type;
goto handle_enum;
default:
g_error ("unknown type 0x%02x in eval stack type", type->type);
case MONO_TYPE_TYPEDBYREF:
return calli? OP_VCALL_REG: virt? OP_VCALLVIRT: OP_VCALL;
case MONO_TYPE_GENERICINST:
- type = type->data.generic_inst->generic_type;
+ type = type->data.generic_class->generic_type;
goto handle_enum;
default:
g_error ("unknown type 0x%02x in ret_type_to_call_opcode", type->type);
return 1;
continue;
case MONO_TYPE_GENERICINST:
- simple_type = simple_type->data.generic_inst->generic_type;
+ simple_type = simple_type->data.generic_class->generic_type;
goto handle_enum;
default:
NEW_LOCSTORE (cfg, store, i, ins);
MONO_ADD_INS (init_localsbb, store);
} else if ((t == MONO_TYPE_VALUETYPE) || (t == MONO_TYPE_TYPEDBYREF) ||
- ((t == MONO_TYPE_GENERICINST) && mono_metadata_generic_inst_is_valuetype (ptype->data.generic_inst))) {
+ ((t == MONO_TYPE_GENERICINST) && mono_metadata_generic_class_is_valuetype (ptype->data.generic_class))) {
NEW_LOCLOADA (cfg, ins, i);
handle_initobj (cfg, init_localsbb, ins, NULL, mono_class_from_mono_type (ptype), NULL, NULL);
break;